Added brace guards to macros with parameters to prevent unintended changed evaluation of the macro expression.
Minor code cleanups (remove redundant comments, fix spacing, etc.).
* \param[in] dataarr Command byte array to check against\r
* \param[in] cb1 First command byte to check\r
*/\r
- #define IS_ONEBYTE_COMMAND(dataarr, cb1) (dataarr[0] == cb1)\r
+ #define IS_ONEBYTE_COMMAND(dataarr, cb1) (dataarr[0] == (cb1))\r
\r
/** Convenience macro, used to determine if the issued command is the given two-byte long command.\r
*\r
* \param[in] cb1 First command byte to check\r
* \param[in] cb2 Second command byte to check\r
*/\r
- #define IS_TWOBYTE_COMMAND(dataarr, cb1, cb2) ((dataarr[0] == cb1) && (dataarr[1] == cb2))\r
+ #define IS_TWOBYTE_COMMAND(dataarr, cb1, cb2) ((dataarr[0] == (cb1)) && (dataarr[1] == (cb2)))\r
\r
/** Length of the DFU file suffix block, appended to the end of each complete memory write command.\r
* The DFU file suffix is currently unused (but is designed to give extra file information, such as\r
#include "MassStorage.h"\r
#include "Descriptors.h"\r
\r
- #include <LUFA/Common/Common.h> // Function Attribute, Atomic, Debug and ISR Macros\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
- #include <LUFA/Drivers/USB/Class/MassStorage.h> // Mass Storage Class Driver\r
- #include <LUFA/Drivers/Board/Dataflash.h> // Dataflash chip driver\r
+ #include <LUFA/Common/Common.h>\r
+ #include <LUFA/Drivers/USB/USB.h>\r
+ #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
+ #include <LUFA/Drivers/Board/Dataflash.h>\r
\r
/* Preprocessor Checks: */\r
#if (DATAFLASH_PAGE_SIZE % 16)\r
* \param[in] acode New SCSI additional sense key to set the additional sense code to\r
* \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to\r
*/\r
- #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = key; \\r
- SenseData.AdditionalSenseCode = acode; \\r
- SenseData.AdditionalSenseQualifier = aqual; }MACROE\r
+ #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = (key); \\r
+ SenseData.AdditionalSenseCode = (acode); \\r
+ SenseData.AdditionalSenseQualifier = (aqual); }MACROE\r
\r
/** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */\r
#define DATA_READ true\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/** Total number of logical drives within the device - must be non-zero. */\r
#define TOTAL_LUNS 1\r
#include "MassStorageKeyboard.h"\r
#include "Descriptors.h"\r
\r
- #include <LUFA/Common/Common.h> // Function Attribute, Atomic, Debug and ISR Macros\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
- #include <LUFA/Drivers/Board/Dataflash.h> // Dataflash chip driver\r
+ #include <LUFA/Common/Common.h>\r
+ #include <LUFA/Drivers/USB/USB.h>\r
+ #include <LUFA/Drivers/Board/Dataflash.h>\r
\r
/* Preprocessor Checks: */\r
#if (DATAFLASH_PAGE_SIZE % 16)\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/** Total number of logical drives within the device - must be non-zero. */\r
#define TOTAL_LUNS 1\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
Size = pgm_read_byte(&SerialNumberString.Header.Size);\r
break;\r
case 0xEE:\r
- /* Great, another Microsoft-proprietary extention. String address 0xEE is used\r
- by Windows for "OS Descriptors", which in this case allows us to indicate that\r
- our device is Sideshow compatible. Most people would be happy using the normal\r
- 0xFF 0x?? 0x?? Class/Subclass/Protocol values like the USBIF intended. */\r
- \r
+ /* A Microsoft-proprietary extention. String address 0xEE is used by Windows for\r
+ "OS Descriptors", which in this case allows us to indicate that our device is\r
+ Sideshow compatible regardless of VID/PID values. */\r
Address = (void*)&OSDescriptorString;\r
Size = pgm_read_byte(&OSDescriptorString.Header.Size);\r
break;\r
#include <LUFA/Drivers/Peripheral/SerialStream.h>\r
\r
/* Macros: */\r
+ /** Device control request for used in the Microsoft OS Descriptor for retrieving the OS Feature\r
+ * descriptors of the device\r
+ */\r
#define REQ_GetOSFeatureDescriptor 0x01\r
\r
+ /** Descriptor index for a Microsoft Proprietary Extended Device Compatibility descriptor */\r
#define EXTENDED_COMPAT_ID_DESCRIPTOR 0x0004\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
- #define LEDMASK_USB_NOTREADY LEDS_LED1\r
+ #define LEDMASK_USB_NOTREADY LEDS_LED1\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
- #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)\r
+ #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
- #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)\r
+ #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)\r
\r
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
- #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
+ #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
*\r
* \param[in] freq Required audio sampling frequency in HZ\r
*/\r
- #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}\r
+ #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)(freq) & 0x00FFFF), HighByte: (((uint32_t)(freq) >> 16) & 0x0000FF)}\r
\r
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint\r
* accepts only filled endpoint packets of audio samples.\r
#define EP_ACCEPTS_SMALL_PACKETS (0 << 7)\r
\r
/** Endpoint number of the Audio isochronous streaming data endpoint. */\r
- #define AUDIO_STREAM_EPNUM 1\r
+ #define AUDIO_STREAM_EPNUM 1\r
\r
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires\r
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller\r
*\r
* \param[in] freq Required audio sampling frequency in HZ\r
*/\r
- #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}\r
+ #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)(freq) & 0x00FFFF), HighByte: (((uint32_t)(freq) >> 16) & 0x0000FF)}\r
\r
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint\r
* accepts only filled endpoint packets of audio samples.\r
\r
/* Macros: */\r
/** CDC Class specific request to get the current virtual serial port configuration settings. */\r
- #define REQ_GetLineEncoding 0x21\r
+ #define REQ_GetLineEncoding 0x21\r
\r
/** CDC Class specific request to set the current virtual serial port configuration settings. */\r
- #define REQ_SetLineEncoding 0x20\r
+ #define REQ_SetLineEncoding 0x20\r
\r
/** CDC Class specific request to set the current virtual serial port handshake line states. */\r
- #define REQ_SetControlLineState 0x22\r
+ #define REQ_SetControlLineState 0x22\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
\r
/* Macros: */\r
/** HID Class specific request to get the next HID report from the device. */\r
- #define REQ_GetReport 0x01\r
+ #define REQ_GetReport 0x01\r
\r
/** HID Class specific request to send the next HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
\r
/* Macros: */\r
/** HID Class specific request to get the next HID report from the device. */\r
- #define REQ_GetReport 0x01\r
+ #define REQ_GetReport 0x01\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
\r
/* Macros: */\r
/** Idle period indicating that reports should be sent only when the inputs have changed */\r
- #define HID_IDLE_CHANGESONLY 0\r
+ #define HID_IDLE_CHANGESONLY 0\r
\r
/** HID Class specific request to get the next HID report from the device. */\r
- #define REQ_GetReport 0x01\r
+ #define REQ_GetReport 0x01\r
\r
/** HID Class specific request to get the idle timeout period of the device. */\r
- #define REQ_GetIdle 0x02\r
+ #define REQ_GetIdle 0x02\r
\r
/** HID Class specific request to send the next HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** HID Class specific request to set the idle timeout period of the device. */\r
- #define REQ_SetIdle 0x0A\r
+ #define REQ_SetIdle 0x0A\r
\r
/** HID Class specific request to get the current HID protocol in use, either report or boot. */\r
- #define REQ_GetProtocol 0x03\r
+ #define REQ_GetProtocol 0x03\r
\r
/** HID Class specific request to set the current HID protocol in use, either report or boot. */\r
- #define REQ_SetProtocol 0x0B\r
+ #define REQ_SetProtocol 0x0B\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
\r
/* Macros: */\r
/** HID Class specific request to get the next HID report from the device. */\r
- #define REQ_GetReport 0x01\r
+ #define REQ_GetReport 0x01\r
\r
/** HID Class specific request to send the next HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** HID Class specific request to get the current HID protocol in use, either report or boot. */\r
- #define REQ_GetProtocol 0x03\r
+ #define REQ_GetProtocol 0x03\r
\r
/** HID Class specific request to set the current HID protocol in use, either report or boot. */\r
- #define REQ_SetProtocol 0x0B\r
+ #define REQ_SetProtocol 0x0B\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
*\r
* \param[in] channel MIDI channel number to address\r
*/\r
- #define MIDI_CHANNEL(channel) (channel - 1)\r
+ #define MIDI_CHANNEL(channel) ((channel) - 1)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#include "MassStorage.h"\r
#include "Descriptors.h"\r
\r
- #include <LUFA/Common/Common.h> // Function Attribute, Atomic, Debug and ISR Macros\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
- #include <LUFA/Drivers/Board/Dataflash.h> // Dataflash chip driver\r
+ #include <LUFA/Common/Common.h>\r
+ #include <LUFA/Drivers/USB/USB.h>\r
+ #include <LUFA/Drivers/Board/Dataflash.h>\r
\r
/* Preprocessor Checks: */\r
#if (DATAFLASH_PAGE_SIZE % 16)\r
#include <avr/io.h>\r
#include <avr/pgmspace.h>\r
\r
- #include <LUFA/Common/Common.h> // Function Attribute, Atomic, Debug and ISR Macros\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
- #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver\r
+ #include <LUFA/Common/Common.h>\r
+ #include <LUFA/Drivers/USB/USB.h>\r
+ #include <LUFA/Drivers/Board/LEDs.h>\r
\r
#include "MassStorage.h"\r
#include "Descriptors.h"\r
* \param[in] acode New SCSI additional sense key to set the additional sense code to\r
* \param[in] aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to\r
*/\r
- #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = key; \\r
- SenseData.AdditionalSenseCode = acode; \\r
- SenseData.AdditionalSenseQualifier = aqual; }MACROE\r
+ #define SCSI_SET_SENSE(key, acode, aqual) MACROS{ SenseData.SenseKey = (key); \\r
+ SenseData.AdditionalSenseCode = (acode); \\r
+ SenseData.AdditionalSenseQualifier = (aqual); }MACROE\r
\r
/** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */\r
- #define DATA_READ true\r
+ #define DATA_READ true\r
\r
/** Macro for the SCSI_Command_ReadWrite_10() function, to indicate that data is to be written to the storage medium. */\r
- #define DATA_WRITE false\r
+ #define DATA_WRITE false\r
\r
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */\r
- #define DEVICE_TYPE_BLOCK 0x00\r
+ #define DEVICE_TYPE_BLOCK 0x00\r
\r
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */\r
- #define DEVICE_TYPE_CDROM 0x05\r
+ #define DEVICE_TYPE_CDROM 0x05\r
\r
/* Type Defines: */\r
/** Type define for a SCSI response structure to a SCSI INQUIRY command. For details of the\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Type defines: */\r
/** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */\r
\r
/* Macros: */\r
/** Idle period indicating that reports should be sent only when the inputs have changed */\r
- #define HID_IDLE_CHANGESONLY 0\r
+ #define HID_IDLE_CHANGESONLY 0\r
\r
/** HID Class specific request to get the next HID report from the device. */\r
- #define REQ_GetReport 0x01\r
+ #define REQ_GetReport 0x01\r
\r
/** HID Class specific request to get the idle timeout period of the device. */\r
- #define REQ_GetIdle 0x02\r
+ #define REQ_GetIdle 0x02\r
\r
/** HID Class specific request to send the next HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** HID Class specific request to set the idle timeout period of the device. */\r
- #define REQ_SetIdle 0x0A\r
+ #define REQ_SetIdle 0x0A\r
\r
/** HID Class specific request to get the current HID protocol in use, either report or boot. */\r
- #define REQ_GetProtocol 0x03\r
+ #define REQ_GetProtocol 0x03\r
\r
/** HID Class specific request to set the current HID protocol in use, either report or boot. */\r
- #define REQ_SetProtocol 0x0B\r
+ #define REQ_SetProtocol 0x0B\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Type Defines: */\r
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification\r
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
- #define LEDMASK_USB_NOTREADY LEDS_LED1\r
+ #define LEDMASK_USB_NOTREADY LEDS_LED1\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
- #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)\r
+ #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
- #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)\r
+ #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)\r
\r
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
- #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
+ #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/* Type Defines: */\r
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "BluetoothHost.h"\r
\r
#define _DEVICEDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "BluetoothHost.h"\r
\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "GenericHIDHost.h"\r
\r
/* Macros: */\r
/** Interface Class value for the Human Interface Device class */\r
- #define HID_CLASS 0x03\r
+ #define HID_CLASS 0x03\r
\r
/** Maximum size of a device configuration descriptor which can be processed by the host, in bytes */\r
#define MAX_CONFIG_DESCRIPTOR_SIZE 512\r
\r
/* Macros: */\r
/** Pipe number for the HID data IN pipe */\r
- #define HID_DATA_IN_PIPE 1\r
+ #define HID_DATA_IN_PIPE 1\r
\r
/** Pipe number for the HID data OUT pipe */\r
- #define HID_DATA_OUT_PIPE 2\r
+ #define HID_DATA_OUT_PIPE 2\r
\r
/** HID Class specific request to send a HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "HIDReport.h"\r
\r
\r
/* Macros: */\r
/** Pipe number for the joystick report data pipe */\r
- #define JOYSTICK_DATAPIPE 1\r
+ #define JOYSTICK_DATAPIPE 1\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "KeyboardHost.h"\r
\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "HIDReport.h"\r
\r
\r
/* Macros: */\r
/** Pipe number for the keyboard report data pipe */\r
- #define KEYBOARD_DATAPIPE 1\r
+ #define KEYBOARD_DATAPIPE 1\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "MIDIHost.h"\r
\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "MassStorageHost.h"\r
\r
#define COMMAND_DIRECTION_DATA_IN (1 << 7)\r
\r
/** Timeout period between the issuing of a CBW to a device, and the reception of the first packet */\r
- #define COMMAND_DATA_TIMEOUT_MS 2000\r
+ #define COMMAND_DATA_TIMEOUT_MS 10000\r
\r
/** Pipe number of the Mass Storage data IN pipe */\r
#define MASS_STORE_DATA_IN_PIPE 1\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void MassStorage_Task(void);\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "MouseHost.h"\r
\r
\r
/* Macros: */\r
/** Pipe number for the mouse data IN pipe */\r
- #define MOUSE_DATAPIPE 1\r
+ #define MOUSE_DATAPIPE 1\r
\r
/** HID Class Specific request to set the report protocol mode */\r
- #define REQ_SetProtocol 0x0B\r
+ #define REQ_SetProtocol 0x0B\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "HIDReport.h"\r
\r
\r
/* Macros: */\r
/** Pipe number for the mouse report data pipe */\r
- #define MOUSE_DATAPIPE 1\r
+ #define MOUSE_DATAPIPE 1\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void EVENT_USB_Host_DeviceAttached(void);\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "RNDISEthernetHost.h"\r
\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Type Defines: */\r
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification\r
#define _CONFIGDESCRIPTOR_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "StillImageHost.h"\r
\r
#define _STILL_IMAGE_COMMANDS_H_\r
\r
/* Includes: */\r
- #include <LUFA/Drivers/USB/USB.h> // USB Functionality\r
+ #include <LUFA/Drivers/USB/USB.h>\r
\r
#include "PIMACodes.h"\r
\r
*\r
* \param[in] chars Total number of Unicode characters in the string\r
*/\r
- #define UNICODE_STRING_LENGTH(chars) (chars << 1)\r
+ #define UNICODE_STRING_LENGTH(chars) ((chars) << 1)\r
\r
/** Timeout period between the issuing of a command to a device, and the reception of the first packet */\r
- #define COMMAND_DATA_TIMEOUT_MS 5000\r
+ #define COMMAND_DATA_TIMEOUT_MS 10000\r
\r
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for\r
* a command container.\r
* \param[in] params Number of parameters which are to be sent in the Param field of the container\r
*/\r
#define PIMA_COMMAND_SIZE(params) ((sizeof(PIMA_SendBlock) - sizeof(PIMA_SendBlock.Params)) + \\r
- (params * sizeof(PIMA_SendBlock.Params[0])))\r
+ ((params) * sizeof(PIMA_SendBlock.Params[0])))\r
\r
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for\r
* a data container.\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* Function Prototypes: */\r
void StillImage_Task(void);\r
#define Dataflash_GetSelectedChip() (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK)\r
\r
#define Dataflash_SelectChip(mask) MACROS{ DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT \\r
- & ~DATAFLASH_CHIPCS_MASK) | mask); }MACROE\r
+ & ~DATAFLASH_CHIPCS_MASK) | (mask)); }MACROE\r
\r
#define Dataflash_DeselectChip() Dataflash_SelectChip(DATAFLASH_NO_CHIP)\r
#endif\r
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)\r
#define COMMAND_DIRECTION_DATA_IN (1 << 7)\r
\r
- #define COMMAND_DATA_TIMEOUT_MS 2000\r
+ #define COMMAND_DATA_TIMEOUT_MS 10000\r
\r
#define MS_FOUND_DATAPIPE_IN (1 << 0)\r
#define MS_FOUND_DATAPIPE_OUT (1 << 1)\r
#define SI_FOUND_DATAPIPE_IN (1 << 1)\r
#define SI_FOUND_DATAPIPE_OUT (1 << 2)\r
\r
- #define COMMAND_DATA_TIMEOUT_MS 5000\r
+ #define COMMAND_DATA_TIMEOUT_MS 10000\r
\r
/* Function Prototypes: */\r
#if defined(INCLUDE_FROM_SI_CLASS_HOST_C)\r
#endif\r
\r
/** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */\r
- #define USB_CONFIG_POWER_MA(mA) (mA >> 1)\r
+ #define USB_CONFIG_POWER_MA(mA) ((mA) >> 1)\r
\r
/** Macro to calculate the Unicode length of a string with a given number of Unicode characters.\r
* Should be used in string descriptor's headers for giving the string descriptor's byte length.\r
*/\r
- #define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + (str << 1))\r
+ #define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + ((str) << 1))\r
\r
/** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded\r
* Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* Macros: */\r
- #define VERSION_TENS(x) (int)(x / 10)\r
- #define VERSION_ONES(x) (int)(x - (10 * VERSION_TENS(x)))\r
- #define VERSION_TENTHS(x) (int)((x - (int)x) * 10)\r
- #define VERSION_HUNDREDTHS(x) (int)(((x - (int)x) * 100) - (10 * VERSION_TENTHS(x)))\r
+ #define VERSION_TENS(x) (int)((x) / 10)\r
+ #define VERSION_ONES(x) (int)((x) - (10 * VERSION_TENS(x)))\r
+ #define VERSION_TENTHS(x) (int)(((x) - (int)(x)) * 10)\r
+ #define VERSION_HUNDREDTHS(x) (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))\r
#endif\r
\r
/* Disable C linkage for C++ Compilers: */\r
#endif\r
\r
/* Macros: */\r
- #define HOST_TASK_NONBLOCK_WAIT(duration, nextstate) MACROS{USB_HostState = HOST_STATE_WaitForDevice; WaitMSRemaining = duration; PostWaitState = nextstate; }MACROE\r
+ #define HOST_TASK_NONBLOCK_WAIT(duration, nextstate) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \\r
+ WaitMSRemaining = (duration); \\r
+ PostWaitState = (nextstate); }MACROE\r
#endif\r
\r
/* Disable C linkage for C++ Compilers: */\r
#if !defined(CONTROL_ONLY_DEVICE)\r
#define Endpoint_SelectEndpoint(epnum) MACROS{ UENUM = (epnum); }MACROE\r
#else\r
- #define Endpoint_SelectEndpoint(epnum) (void)epnum\r
+ #define Endpoint_SelectEndpoint(epnum) (void)(epnum)\r
#endif\r
\r
#define Endpoint_ResetFIFO(epnum) MACROS{ UERST = (1 << (epnum)); UERST = 0; }MACROE\r
* - Fixed HID Parser not distributing the Usage Min and Usage Max values across an array of report items\r
* - Fixed Mass Storage Host Class driver and Low Level demo not clearing the error condition if an attached device returns a\r
* STALL to a GET MAX LUN request (thanks to Martin Luxen)\r
+ * - Fixed TeensyHID bootloader not properly shutting down the USB interface to trigger a disconnection on the host before resetting\r
+ * - Fixed MassStorageHost Class driver demo not having USB_STREAM_TIMEOUT_MS compile time option set properly to prevent slow \r
+ * devices from timing out the data pipes\r
*\r
* \section Sec_ChangeLog091122 Version 091122\r
*\r
* -# Write LUFA tutorials\r
* - Demos/Projects\r
* -# Multiple-Report HID device\r
- * -# Device/Host bridge\r
+ * -# Device/Host USB bridge\r
+ * -# Finish BluetoothHost demo\r
+ * -# Finish MIDI class Bootloader\r
+ * -# Finish SideShow demo\r
+ * -# Finish StandaloneProgrammer project\r
* - Ports\r
* -# AVR32 UC3B series microcontrollers\r
* -# Atmel ARM7 series microcontrollers\r
/* Macros: */\r
/** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
- #define PROGRAMMER_ID "AVRISP_MK2"\r
+ #define PROGRAMMER_ID "AVRISP_MK2"\r
\r
/** Timeout in milliseconds of target busy-wait loops waiting for a command to complete */\r
#define TARGET_BUSY_TIMEOUT_MS 240\r
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
- #define LEDMASK_USB_BUSY (LEDS_LED2)\r
+ #define LEDMASK_USB_BUSY LEDS_LED2\r
\r
/* External Variables: */\r
extern FILE DiskStream;\r
USB_ControlRequest = (USB_Request_Header_t)\r
{\r
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),\r
- .bRequest = 0x09,\r
+ .bRequest = REQ_SetReport,\r
.wValue = 0x02,\r
.wIndex = 0x01,\r
.wLength = ReportLength,\r
\r
/* Macros: */\r
/** Pipe number for the HID data IN pipe */\r
- #define HID_DATA_IN_PIPE 1\r
+ #define HID_DATA_IN_PIPE 1\r
\r
/** Pipe number for the HID data OUT pipe */\r
- #define HID_DATA_OUT_PIPE 2\r
+ #define HID_DATA_OUT_PIPE 2\r
\r
/** HID Class specific request to send a HID report to the device. */\r
- #define REQ_SetReport 0x09\r
+ #define REQ_SetReport 0x09\r
\r
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
#define LEDMASK_USB_NOTREADY LEDS_LED1\r