From 9ef29ea2293dde7225360fe258224d22d3a68756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 6 Oct 2013 22:16:20 +0200 Subject: Extract interface numbers into enums. --- Projects/AVRISP-MKII/AVRISPDescriptors.c | 2 +- Projects/AVRISP-MKII/AVRISPDescriptors.h | 17 +++++++++++++---- Projects/Benito/Benito.c | 2 +- Projects/Benito/Descriptors.c | 4 ++-- Projects/Benito/Descriptors.h | 16 +++++++++++++--- Projects/LEDNotifier/Descriptors.c | 4 ++-- Projects/LEDNotifier/Descriptors.h | 16 +++++++++++++--- Projects/LEDNotifier/LEDNotifier.c | 2 +- Projects/MIDIToneGenerator/Descriptors.c | 4 ++-- Projects/MIDIToneGenerator/Descriptors.h | 16 +++++++++++++--- Projects/MIDIToneGenerator/MIDIToneGenerator.c | 2 +- Projects/Magstripe/Descriptors.c | 2 +- Projects/Magstripe/Descriptors.h | 17 +++++++++++++---- Projects/Magstripe/Magstripe.c | 2 +- Projects/MediaController/Descriptors.c | 2 +- Projects/MediaController/Descriptors.h | 17 +++++++++++++---- Projects/MediaController/MediaController.c | 2 +- Projects/RelayBoard/Descriptors.c | 2 +- Projects/RelayBoard/Descriptors.h | 17 +++++++++++++---- Projects/SerialToLCD/Descriptors.c | 4 ++-- Projects/SerialToLCD/Descriptors.h | 16 +++++++++++++--- Projects/SerialToLCD/SerialToLCD.c | 2 +- Projects/SerialToLCD/SerialToLCD.h | 26 +++++++++++++------------- Projects/TempDataLogger/Descriptors.c | 4 ++-- Projects/TempDataLogger/Descriptors.h | 16 +++++++++++++--- Projects/TempDataLogger/TempDataLogger.c | 4 ++-- Projects/USBtoSerial/Descriptors.c | 4 ++-- Projects/USBtoSerial/Descriptors.h | 16 +++++++++++++--- Projects/USBtoSerial/USBtoSerial.c | 2 +- Projects/Webserver/Descriptors.c | 6 +++--- Projects/Webserver/Descriptors.h | 17 ++++++++++++++--- Projects/Webserver/USBDeviceMode.c | 4 ++-- Projects/XPLAINBridge/USARTDescriptors.c | 4 ++-- Projects/XPLAINBridge/USARTDescriptors.h | 18 ++++++++++++++---- Projects/XPLAINBridge/XPLAINBridge.c | 2 +- 35 files changed, 204 insertions(+), 87 deletions(-) (limited to 'Projects') diff --git a/Projects/AVRISP-MKII/AVRISPDescriptors.c b/Projects/AVRISP-MKII/AVRISPDescriptors.c index cb19051f4..c185cb9f4 100644 --- a/Projects/AVRISP-MKII/AVRISPDescriptors.c +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.c @@ -101,7 +101,7 @@ AVRISP_USB_Descriptor_Configuration_t AVRISP_ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AVRISP, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/AVRISP-MKII/AVRISPDescriptors.h b/Projects/AVRISP-MKII/AVRISPDescriptors.h index 2f1192384..68bb10359 100644 --- a/Projects/AVRISP-MKII/AVRISPDescriptors.h +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.h @@ -86,16 +86,25 @@ USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint; } AVRISP_USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AVRISP = 0, /**< AVRISP interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum AVRISP_StringDescriptors_t { - AVRISP_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - AVRISP_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - AVRISP_STRING_ID_Product = 2, /**< Product string ID */ - AVRISP_STRING_ID_Serial = 3, /**< Serial number string ID */ + AVRISP_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + AVRISP_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + AVRISP_STRING_ID_Product = 2, /**< Product string ID */ + AVRISP_STRING_ID_Serial = 3, /**< Serial number string ID */ }; /* External Variables: */ diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index a89e6caf6..2ecee0711 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -62,7 +62,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/Benito/Descriptors.c b/Projects/Benito/Descriptors.c index ebb11cac5..8bd0907d5 100644 --- a/Projects/Benito/Descriptors.c +++ b/Projects/Benito/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -141,7 +141,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/Benito/Descriptors.h b/Projects/Benito/Descriptors.h index 12be7bf9c..5c67e7174 100644 --- a/Projects/Benito/Descriptors.h +++ b/Projects/Benito/Descriptors.h @@ -81,15 +81,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c index 1875bba01..f228c69ef 100644 --- a/Projects/LEDNotifier/Descriptors.c +++ b/Projects/LEDNotifier/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/LEDNotifier/Descriptors.h b/Projects/LEDNotifier/Descriptors.h index 363951c5b..ed19d84f8 100644 --- a/Projects/LEDNotifier/Descriptors.h +++ b/Projects/LEDNotifier/Descriptors.h @@ -79,15 +79,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c index d6a8fdca3..e1d5dd97f 100644 --- a/Projects/LEDNotifier/LEDNotifier.c +++ b/Projects/LEDNotifier/LEDNotifier.c @@ -44,7 +44,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/MIDIToneGenerator/Descriptors.c b/Projects/MIDIToneGenerator/Descriptors.c index 5413f27f5..220d37dff 100644 --- a/Projects/MIDIToneGenerator/Descriptors.c +++ b/Projects/MIDIToneGenerator/Descriptors.c @@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_AudioControl, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -118,7 +118,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/MIDIToneGenerator/Descriptors.h b/Projects/MIDIToneGenerator/Descriptors.h index cb8789187..dab2fd5a6 100644 --- a/Projects/MIDIToneGenerator/Descriptors.h +++ b/Projects/MIDIToneGenerator/Descriptors.h @@ -79,15 +79,25 @@ USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ + INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c index 662c815bc..ed2d33420 100644 --- a/Projects/MIDIToneGenerator/MIDIToneGenerator.c +++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c @@ -44,7 +44,7 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface = { .Config = { - .StreamingInterfaceNumber = 1, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, .DataINEndpoint = { .Address = MIDI_STREAM_IN_EPADDR, diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c index 680944092..c707c1cf6 100644 --- a/Projects/Magstripe/Descriptors.c +++ b/Projects/Magstripe/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Keyboard, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Projects/Magstripe/Descriptors.h b/Projects/Magstripe/Descriptors.h index 0f4869fb7..46218fc2c 100644 --- a/Projects/Magstripe/Descriptors.h +++ b/Projects/Magstripe/Descriptors.h @@ -56,18 +56,27 @@ // Keyboard HID Interface USB_Descriptor_Interface_t HID_Interface; /**< Keyboard interface descriptor */ USB_HID_Descriptor_HID_t HID_KeyboardHID; /**< Keyboard HID descriptor */ - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */ + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */ } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_Keyboard = 0, /**< Keyboard interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index 8dba7370b..a0b6f1b01 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -56,7 +56,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_EPADDR, diff --git a/Projects/MediaController/Descriptors.c b/Projects/MediaController/Descriptors.c index 636bbb618..353e5fe2f 100644 --- a/Projects/MediaController/Descriptors.c +++ b/Projects/MediaController/Descriptors.c @@ -122,7 +122,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_HID, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Projects/MediaController/Descriptors.h b/Projects/MediaController/Descriptors.h index 9f889641e..827885de6 100644 --- a/Projects/MediaController/Descriptors.h +++ b/Projects/MediaController/Descriptors.h @@ -53,18 +53,27 @@ // Media Controller HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MediaControlHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_HID = 0, /**< HID interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Macros: */ diff --git a/Projects/MediaController/MediaController.c b/Projects/MediaController/MediaController.c index d12a21aac..bda252a55 100644 --- a/Projects/MediaController/MediaController.c +++ b/Projects/MediaController/MediaController.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t MediaControl_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_HID, .ReportINEndpoint = { .Address = MEDIACONTROL_HID_EPADDR, diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c index c6b2d8f56..646f7ca08 100644 --- a/Projects/RelayBoard/Descriptors.c +++ b/Projects/RelayBoard/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_RelayBoard, .AlternateSetting = 0, .TotalEndpoints = 0, diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h index 97ed22516..c2fc16efa 100644 --- a/Projects/RelayBoard/Descriptors.h +++ b/Projects/RelayBoard/Descriptors.h @@ -54,16 +54,25 @@ USB_Descriptor_Interface_t RelayBoardInterface; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_RelayBoard = 0, /**< Relay board interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ - STRING_ID_Serial = 3, /**< Serial number string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Serial = 3, /**< Serial number string ID */ }; /* Function Prototypes: */ diff --git a/Projects/SerialToLCD/Descriptors.c b/Projects/SerialToLCD/Descriptors.c index 8a55f82a4..baf33c0ce 100644 --- a/Projects/SerialToLCD/Descriptors.c +++ b/Projects/SerialToLCD/Descriptors.c @@ -103,7 +103,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -154,7 +154,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/SerialToLCD/Descriptors.h b/Projects/SerialToLCD/Descriptors.h index 5776098e3..f6619296d 100644 --- a/Projects/SerialToLCD/Descriptors.h +++ b/Projects/SerialToLCD/Descriptors.h @@ -80,15 +80,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/SerialToLCD/SerialToLCD.c b/Projects/SerialToLCD/SerialToLCD.c index aac4fadfb..21a5d68cb 100644 --- a/Projects/SerialToLCD/SerialToLCD.c +++ b/Projects/SerialToLCD/SerialToLCD.c @@ -51,7 +51,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/SerialToLCD/SerialToLCD.h b/Projects/SerialToLCD/SerialToLCD.h index 22537d609..bafc03c27 100644 --- a/Projects/SerialToLCD/SerialToLCD.h +++ b/Projects/SerialToLCD/SerialToLCD.h @@ -37,28 +37,28 @@ #ifndef _SERIALTOLCD_H_ #define _SERIALTOLCD_H_ - /* Includes: */ - #include - #include - #include - #include + /* Includes: */ + #include + #include + #include + #include - #include "Descriptors.h" + #include "Descriptors.h" #include "Lib/HD44780.h" - #include - #include - #include + #include + #include + #include #include /* Macros: */ #define COMMAND_ESCAPE 0x1B - /* Function Prototypes: */ - void SetupHardware(void); + /* Function Prototypes: */ + void SetupHardware(void); - void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ControlRequest(void); #endif diff --git a/Projects/TempDataLogger/Descriptors.c b/Projects/TempDataLogger/Descriptors.c index 6ec6f64aa..452c4c6ec 100644 --- a/Projects/TempDataLogger/Descriptors.c +++ b/Projects/TempDataLogger/Descriptors.c @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -145,7 +145,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_HID, .AlternateSetting = 0, .TotalEndpoints = 1, diff --git a/Projects/TempDataLogger/Descriptors.h b/Projects/TempDataLogger/Descriptors.h index 91e238fc1..63c3fae02 100644 --- a/Projects/TempDataLogger/Descriptors.h +++ b/Projects/TempDataLogger/Descriptors.h @@ -56,15 +56,25 @@ USB_Descriptor_Endpoint_t HID_ReportINEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */ + INTERFACE_ID_HID = 1, /**< HID interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c index bbbea47f2..66f933586 100644 --- a/Projects/TempDataLogger/TempDataLogger.c +++ b/Projects/TempDataLogger/TempDataLogger.c @@ -44,7 +44,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, @@ -72,7 +72,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface = { .Config = { - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_HID, .ReportINEndpoint = { .Address = GENERIC_IN_EPADDR, diff --git a/Projects/USBtoSerial/Descriptors.c b/Projects/USBtoSerial/Descriptors.c index b2d228588..ea0a84a0c 100644 --- a/Projects/USBtoSerial/Descriptors.c +++ b/Projects/USBtoSerial/Descriptors.c @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/USBtoSerial/Descriptors.h b/Projects/USBtoSerial/Descriptors.h index 363951c5b..ed19d84f8 100644 --- a/Projects/USBtoSerial/Descriptors.h +++ b/Projects/USBtoSerial/Descriptors.h @@ -79,15 +79,25 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c index 6df906340..84ec2befa 100644 --- a/Projects/USBtoSerial/USBtoSerial.c +++ b/Projects/USBtoSerial/USBtoSerial.c @@ -56,7 +56,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c index 8fcba5cc8..b8acf42a2 100644 --- a/Projects/Webserver/Descriptors.c +++ b/Projects/Webserver/Descriptors.c @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -156,7 +156,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -192,7 +192,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h index 2c25512e4..c649cf56f 100644 --- a/Projects/Webserver/Descriptors.h +++ b/Projects/Webserver/Descriptors.h @@ -96,15 +96,26 @@ USB_Descriptor_Endpoint_t MS_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + INTERFACE_ID_MassStorage = 2, /**< Mass storage interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum StringDescriptors_t { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c index 7d5beb93a..f889b6be6 100644 --- a/Projects/Webserver/USBDeviceMode.c +++ b/Projects/Webserver/USBDeviceMode.c @@ -44,7 +44,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, @@ -76,7 +76,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c index 0e0ac8534..b1bfd4e81 100644 --- a/Projects/XPLAINBridge/USARTDescriptors.c +++ b/Projects/XPLAINBridge/USARTDescriptors.c @@ -91,7 +91,7 @@ const USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_CDC_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -142,7 +142,7 @@ const USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_CDC_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Projects/XPLAINBridge/USARTDescriptors.h b/Projects/XPLAINBridge/USARTDescriptors.h index 954867c18..130c695b9 100644 --- a/Projects/XPLAINBridge/USARTDescriptors.h +++ b/Projects/XPLAINBridge/USARTDescriptors.h @@ -81,22 +81,32 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USART_USB_Descriptor_Configuration_t; + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum USART_InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should * have a unique ID index associated with it, which can be used to refer to the string from * other descriptors. */ enum USART_StringDescriptors_t { - USART_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - USART_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - USART_STRING_ID_Product = 2, /**< Product string ID */ + USART_STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + USART_STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + USART_STRING_ID_Product = 2, /**< Product string ID */ }; /* Function Prototypes: */ uint16_t USART_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, const void** const DescriptorAddress, - uint8_t* const DescriptorMemorySpace); + uint8_t* const DescriptorMemorySpace); #endif diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 2ef1d20ee..1c63b71d8 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -47,7 +47,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, -- cgit v1.2.3