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. --- Demos/Device/ClassDriver/AudioInput/AudioInput.c | 4 +-- Demos/Device/ClassDriver/AudioInput/Descriptors.c | 6 ++-- Demos/Device/ClassDriver/AudioInput/Descriptors.h | 16 +++++++-- Demos/Device/ClassDriver/AudioOutput/AudioOutput.c | 4 +-- Demos/Device/ClassDriver/AudioOutput/Descriptors.c | 6 ++-- Demos/Device/ClassDriver/AudioOutput/Descriptors.h | 16 +++++++-- .../ClassDriver/DualVirtualSerial/Descriptors.c | 8 ++--- .../ClassDriver/DualVirtualSerial/Descriptors.h | 18 ++++++++-- .../DualVirtualSerial/DualVirtualSerial.c | 4 +-- Demos/Device/ClassDriver/GenericHID/Descriptors.c | 2 +- Demos/Device/ClassDriver/GenericHID/Descriptors.h | 17 +++++++--- Demos/Device/ClassDriver/GenericHID/GenericHID.c | 2 +- Demos/Device/ClassDriver/Joystick/Descriptors.c | 2 +- Demos/Device/ClassDriver/Joystick/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/Joystick/Joystick.c | 2 +- Demos/Device/ClassDriver/Keyboard/Descriptors.c | 2 +- Demos/Device/ClassDriver/Keyboard/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/Keyboard/Keyboard.c | 2 +- .../Device/ClassDriver/KeyboardMouse/Descriptors.c | 38 ++++++++++++---------- .../Device/ClassDriver/KeyboardMouse/Descriptors.h | 16 +++++++-- .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 4 +-- .../KeyboardMouseMultiReport/Descriptors.c | 2 +- .../KeyboardMouseMultiReport/Descriptors.h | 15 +++++++-- .../KeyboardMouseMultiReport.c | 2 +- Demos/Device/ClassDriver/MIDI/Descriptors.c | 4 +-- Demos/Device/ClassDriver/MIDI/Descriptors.h | 16 +++++++-- Demos/Device/ClassDriver/MIDI/MIDI.c | 2 +- Demos/Device/ClassDriver/MassStorage/Descriptors.c | 2 +- Demos/Device/ClassDriver/MassStorage/Descriptors.h | 15 +++++++-- Demos/Device/ClassDriver/MassStorage/MassStorage.c | 2 +- .../ClassDriver/MassStorageKeyboard/Descriptors.c | 4 +-- .../ClassDriver/MassStorageKeyboard/Descriptors.h | 16 +++++++-- .../MassStorageKeyboard/MassStorageKeyboard.c | 4 +-- Demos/Device/ClassDriver/Mouse/Descriptors.c | 2 +- Demos/Device/ClassDriver/Mouse/Descriptors.h | 17 +++++++--- Demos/Device/ClassDriver/Mouse/Mouse.c | 2 +- .../Device/ClassDriver/RNDISEthernet/Descriptors.c | 4 +-- .../Device/ClassDriver/RNDISEthernet/Descriptors.h | 16 +++++++-- .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 2 +- .../Device/ClassDriver/VirtualSerial/Descriptors.c | 4 +-- .../Device/ClassDriver/VirtualSerial/Descriptors.h | 16 +++++++-- .../ClassDriver/VirtualSerial/VirtualSerial.c | 2 +- .../VirtualSerialMassStorage/Descriptors.c | 6 ++-- .../VirtualSerialMassStorage/Descriptors.h | 17 ++++++++-- .../VirtualSerialMassStorage.c | 4 +-- .../ClassDriver/VirtualSerialMouse/Descriptors.c | 6 ++-- .../ClassDriver/VirtualSerialMouse/Descriptors.h | 17 ++++++++-- .../VirtualSerialMouse/VirtualSerialMouse.c | 4 +-- .../Incomplete/TestAndMeasurement/Descriptors.c | 2 +- .../Incomplete/TestAndMeasurement/Descriptors.h | 15 +++++++-- Demos/Device/LowLevel/AudioInput/Descriptors.c | 6 ++-- Demos/Device/LowLevel/AudioInput/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/AudioOutput/Descriptors.c | 6 ++-- Demos/Device/LowLevel/AudioOutput/Descriptors.h | 16 +++++++-- .../LowLevel/DualVirtualSerial/Descriptors.c | 8 ++--- .../LowLevel/DualVirtualSerial/Descriptors.h | 18 ++++++++-- Demos/Device/LowLevel/GenericHID/Descriptors.c | 2 +- Demos/Device/LowLevel/GenericHID/Descriptors.h | 19 ++++++++--- Demos/Device/LowLevel/Joystick/Descriptors.c | 2 +- Demos/Device/LowLevel/Joystick/Descriptors.h | 17 +++++++--- Demos/Device/LowLevel/Keyboard/Descriptors.c | 2 +- Demos/Device/LowLevel/Keyboard/Descriptors.h | 19 ++++++++--- Demos/Device/LowLevel/KeyboardMouse/Descriptors.c | 38 ++++++++++++---------- Demos/Device/LowLevel/KeyboardMouse/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/MIDI/Descriptors.c | 4 +-- Demos/Device/LowLevel/MIDI/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/MassStorage/Descriptors.c | 2 +- Demos/Device/LowLevel/MassStorage/Descriptors.h | 15 +++++++-- Demos/Device/LowLevel/Mouse/Descriptors.c | 2 +- Demos/Device/LowLevel/Mouse/Descriptors.h | 17 +++++++--- Demos/Device/LowLevel/RNDISEthernet/Descriptors.c | 4 +-- Demos/Device/LowLevel/RNDISEthernet/Descriptors.h | 16 +++++++-- Demos/Device/LowLevel/VirtualSerial/Descriptors.c | 4 +-- Demos/Device/LowLevel/VirtualSerial/Descriptors.h | 16 +++++++-- .../ClassDriver/MouseHostDevice/Descriptors.c | 2 +- .../ClassDriver/MouseHostDevice/Descriptors.h | 17 +++++++--- .../ClassDriver/MouseHostDevice/DeviceFunctions.c | 2 +- 77 files changed, 509 insertions(+), 212 deletions(-) (limited to 'Demos') diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 9eec39ca2..02bd1e45a 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -44,8 +44,8 @@ USB_ClassInfo_Audio_Device_t Microphone_Audio_Interface = { .Config = { - .ControlInterfaceNumber = 0, - .StreamingInterfaceNumber = 1, + .ControlInterfaceNumber = INTERFACE_ID_AudioControl, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, .DataINEndpoint = { .Address = AUDIO_STREAM_EPADDR, diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.c b/Demos/Device/ClassDriver/AudioInput/Descriptors.c index eb4c21c02..a48738735 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioInput/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, @@ -150,7 +150,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 = 0, @@ -166,7 +166,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 = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.h b/Demos/Device/ClassDriver/AudioInput/Descriptors.h index 1bb38ff65..fe099570f 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_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/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 81fd95b16..432f5e0fa 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -44,8 +44,8 @@ USB_ClassInfo_Audio_Device_t Speaker_Audio_Interface = { .Config = { - .ControlInterfaceNumber = 0, - .StreamingInterfaceNumber = 1, + .ControlInterfaceNumber = INTERFACE_ID_AudioControl, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, .DataOUTEndpoint = { .Address = AUDIO_STREAM_EPADDR, diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c index 4ced7a0eb..aec2c5f51 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioOutput/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, @@ -150,7 +150,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 = 0, @@ -166,7 +166,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 = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h index 80f142683..cb67f02ec 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_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/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c index d0992de4b..245231852 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/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_CDC1_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_CDC1_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -206,7 +206,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_CDC2_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -257,7 +257,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 3, + .InterfaceNumber = INTERFACE_ID_CDC2_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h index 1105ab7b3..98170269a 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h +++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h @@ -102,15 +102,27 @@ USB_Descriptor_Endpoint_t CDC2_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_CDC1_CCI = 0, /**< CDC1 CCI interface descriptor ID */ + INTERFACE_ID_CDC1_DCI = 1, /**< CDC1 DCI interface descriptor ID */ + INTERFACE_ID_CDC2_CCI = 2, /**< CDC2 CCI interface descriptor ID */ + INTERFACE_ID_CDC2_DCI = 3, /**< CDC2 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/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c index eaba6185a..070ebc791 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c @@ -45,7 +45,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC1_CCI, .DataINEndpoint = { .Address = CDC1_TX_EPADDR, @@ -76,7 +76,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 2, + .ControlInterfaceNumber = INTERFACE_ID_CDC2_CCI, .DataINEndpoint = { .Address = CDC2_TX_EPADDR, diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.c b/Demos/Device/ClassDriver/GenericHID/Descriptors.c index 57c3502b9..b070d8640 100644 --- a/Demos/Device/ClassDriver/GenericHID/Descriptors.c +++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.c @@ -108,7 +108,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_GenericHID, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.h b/Demos/Device/ClassDriver/GenericHID/Descriptors.h index b598e9889..4500f2c10 100644 --- a/Demos/Device/ClassDriver/GenericHID/Descriptors.h +++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.h @@ -55,18 +55,27 @@ // Generic HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_GenericHID; - 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_GenericHID = 0, /**< GenericHID 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/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 182aa5a58..8f5b86131 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_GenericHID, .ReportINEndpoint = { .Address = GENERIC_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.c b/Demos/Device/ClassDriver/Joystick/Descriptors.c index 8a6ef2052..2d416528b 100644 --- a/Demos/Device/ClassDriver/Joystick/Descriptors.c +++ b/Demos/Device/ClassDriver/Joystick/Descriptors.c @@ -108,7 +108,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Joystick, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.h b/Demos/Device/ClassDriver/Joystick/Descriptors.h index 89c0584d9..839cd28eb 100644 --- a/Demos/Device/ClassDriver/Joystick/Descriptors.h +++ b/Demos/Device/ClassDriver/Joystick/Descriptors.h @@ -56,15 +56,24 @@ 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_Joystick = 0, /**< Joystick interface desciptor 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/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index 809c41060..bbe85584a 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Joystick, .ReportINEndpoint = { .Address = JOYSTICK_EPADDR, diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.c b/Demos/Device/ClassDriver/Keyboard/Descriptors.c index f40e3b932..4340ec657 100644 --- a/Demos/Device/ClassDriver/Keyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.c @@ -104,7 +104,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/Demos/Device/ClassDriver/Keyboard/Descriptors.h b/Demos/Device/ClassDriver/Keyboard/Descriptors.h index abaf9c62a..ce029bb75 100644 --- a/Demos/Device/ClassDriver/Keyboard/Descriptors.h +++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.h @@ -56,15 +56,24 @@ 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_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/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index b3cc67e1e..68e3fbe1b 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_EPADDR, diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c index c3b2e2c7b..0d350c764 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c @@ -120,7 +120,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, @@ -157,7 +157,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x01, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, @@ -269,28 +269,30 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, break; case HID_DTYPE_HID: - if (!(wIndex)) + switch (wIndex) { - Address = &ConfigurationDescriptor.HID1_KeyboardHID; - Size = sizeof(USB_HID_Descriptor_HID_t); - } - else - { - Address = &ConfigurationDescriptor.HID2_MouseHID; - Size = sizeof(USB_HID_Descriptor_HID_t); + case INTERFACE_ID_Keyboard: + Address = &ConfigurationDescriptor.HID1_KeyboardHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; + case INTERFACE_ID_Mouse: + Address = &ConfigurationDescriptor.HID2_MouseHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; } break; case HID_DTYPE_Report: - if (!(wIndex)) + switch (wIndex) { - Address = &KeyboardReport; - Size = sizeof(KeyboardReport); - } - else - { - Address = &MouseReport; - Size = sizeof(MouseReport); + case INTERFACE_ID_Keyboard: + Address = &KeyboardReport; + Size = sizeof(KeyboardReport); + break; + case INTERFACE_ID_Mouse: + Address = &MouseReport; + Size = sizeof(MouseReport); + break; } break; diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h index 27120eb34..1a45f74bd 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h @@ -61,15 +61,25 @@ USB_Descriptor_Endpoint_t HID2_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_Keyboard = 0, /**< Keyboard interface descriptor ID */ + INTERFACE_ID_Mouse = 1, /**< Mouse 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/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index f663f1683..789fc215d 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -51,7 +51,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_IN_EPADDR, @@ -72,7 +72,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c index a36147321..477cad0a4 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c @@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_KeyboardAndMouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h index a47d18577..f5d68be69 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h @@ -56,15 +56,24 @@ 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_KeyboardAndMouse = 0, /**< Combined keyboard and mouse 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/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c index f15d134ff..0ec878894 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Device_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_KeyboardAndMouse, .ReportINEndpoint = { .Address = HID_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.c b/Demos/Device/ClassDriver/MIDI/Descriptors.c index 5413f27f5..746bcc484 100644 --- a/Demos/Device/ClassDriver/MIDI/Descriptors.c +++ b/Demos/Device/ClassDriver/MIDI/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_MidiAudioControl, .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_MidiAudioStreaming, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.h b/Demos/Device/ClassDriver/MIDI/Descriptors.h index 92c6c38d9..d6f230a8d 100644 --- a/Demos/Device/ClassDriver/MIDI/Descriptors.h +++ b/Demos/Device/ClassDriver/MIDI/Descriptors.h @@ -77,15 +77,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_MidiAudioControl = 0, /**< MIDI audio control interface descriptor ID */ + INTERFACE_ID_MidiAudioStreaming = 1, /**< MIDI audio streaming 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/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index bec442883..79a831762 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -44,7 +44,7 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface = { .Config = { - .StreamingInterfaceNumber = 1, + .StreamingInterfaceNumber = INTERFACE_ID_MidiAudioStreaming, .DataINEndpoint = { .Address = MIDI_STREAM_IN_EPADDR, diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.c b/Demos/Device/ClassDriver/MassStorage/Descriptors.c index d069bcece..2be052b07 100644 --- a/Demos/Device/ClassDriver/MassStorage/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorage/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_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.h b/Demos/Device/ClassDriver/MassStorage/Descriptors.h index 3b9a96c8a..674bd2960 100644 --- a/Demos/Device/ClassDriver/MassStorage/Descriptors.h +++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.h @@ -68,15 +68,24 @@ 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_MassStorage = 0, /**< 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/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 82f02b918..32b4c2634 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.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, diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c index 2209d5144..5749b365f 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c @@ -106,7 +106,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, @@ -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_Keyboard, .AlternateSetting = 0, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h index 2b70e11b4..606e47d91 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h @@ -80,15 +80,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_Keyboard = 1, /**< 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 */ }; /* Function Prototypes: */ diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 2ed3f411b..8ed0d3b64 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -45,7 +45,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_MassStorage, .DataINEndpoint = { .Address = MASS_STORAGE_IN_EPADDR, @@ -73,7 +73,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface = { .Config = { - .InterfaceNumber = 1, + .InterfaceNumber = INTERFACE_ID_Keyboard, .ReportINEndpoint = { .Address = KEYBOARD_EPADDR, diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.c b/Demos/Device/ClassDriver/Mouse/Descriptors.c index c21a8cc65..09278a790 100644 --- a/Demos/Device/ClassDriver/Mouse/Descriptors.c +++ b/Demos/Device/ClassDriver/Mouse/Descriptors.c @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.h b/Demos/Device/ClassDriver/Mouse/Descriptors.h index a5380a11a..3b637e21f 100644 --- a/Demos/Device/ClassDriver/Mouse/Descriptors.h +++ b/Demos/Device/ClassDriver/Mouse/Descriptors.h @@ -60,18 +60,27 @@ // Mouse HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MouseHID; - 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_Mouse = 0, /**< Mouse 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/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 8432b65a9..1e8f7ab93 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_EPADDR, diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c index ca70633be..7474e5499 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/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/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h index be5015725..c782a5ea7 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h @@ -81,15 +81,25 @@ USB_Descriptor_Endpoint_t RNDIS_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/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index 54d551142..e38dfec26 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -44,7 +44,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface = { .Config = { - .ControlInterfaceNumber = 0, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, .DataINEndpoint = { .Address = CDC_TX_EPADDR, diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c index 9432562cc..33f63371d 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerial/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/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h index e2d09b218..20caec05c 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerial/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/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c index 0079acbfa..56b248d3c 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.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/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c index e41a91a18..b8a07f4c2 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/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/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h index 25d31bff8..ac6e4fa8e 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/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/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c index 03f422b45..6dc1ab662 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.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, @@ -74,7 +74,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/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c index 42c77dde8..43c849b79 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c @@ -124,7 +124,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, @@ -175,7 +175,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, @@ -211,7 +211,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0, .TotalEndpoints = 1, diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h index 1bce49627..7ac638bd6 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h @@ -91,15 +91,26 @@ 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_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + INTERFACE_ID_Mouse = 2, /**< Mouse 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/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index 73f9e3875..d4aba4851 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.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, @@ -77,7 +77,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface = { .Config = { - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_EPADDR, diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c index 8bf92371d..6b27db8b3 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c +++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c @@ -92,7 +92,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_TestAndMeasurement, .AlternateSetting = 0x00, .TotalEndpoints = 3, diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h index 9beb3d272..07464486d 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h +++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h @@ -74,15 +74,24 @@ USB_Descriptor_Endpoint_t TM_NotificationEndpoint; } 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_TestAndMeasurement = 0, /**< Test and measurement 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/Demos/Device/LowLevel/AudioInput/Descriptors.c b/Demos/Device/LowLevel/AudioInput/Descriptors.c index b3490d005..444f16046 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.c +++ b/Demos/Device/LowLevel/AudioInput/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, @@ -150,7 +150,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 = 0, @@ -166,7 +166,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 = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.h b/Demos/Device/LowLevel/AudioInput/Descriptors.h index a3d3ec3ef..7dbb9aa22 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioInput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_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/Demos/Device/LowLevel/AudioOutput/Descriptors.c b/Demos/Device/LowLevel/AudioOutput/Descriptors.c index 43f717549..7879c3463 100644 --- a/Demos/Device/LowLevel/AudioOutput/Descriptors.c +++ b/Demos/Device/LowLevel/AudioOutput/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, @@ -150,7 +150,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 = 0, @@ -166,7 +166,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 = 1, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.h b/Demos/Device/LowLevel/AudioOutput/Descriptors.h index b8ae901d7..07d1becbd 100644 --- a/Demos/Device/LowLevel/AudioOutput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.h @@ -75,15 +75,25 @@ USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_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/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c index d0992de4b..245231852 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c +++ b/Demos/Device/LowLevel/DualVirtualSerial/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_CDC1_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_CDC1_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -206,7 +206,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 2, + .InterfaceNumber = INTERFACE_ID_CDC2_CCI, .AlternateSetting = 0, .TotalEndpoints = 1, @@ -257,7 +257,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 3, + .InterfaceNumber = INTERFACE_ID_CDC2_DCI, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h index a5a87dc3d..dc19cfe34 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h +++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h @@ -102,15 +102,27 @@ USB_Descriptor_Endpoint_t CDC2_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_CDC1_CCI = 0, /**< CDC1 CCI interface descriptor ID */ + INTERFACE_ID_CDC1_DCI = 1, /**< CDC1 DCI interface descriptor ID */ + INTERFACE_ID_CDC2_CCI = 2, /**< CDC2 CCI interface descriptor ID */ + INTERFACE_ID_CDC2_DCI = 3, /**< CDC2 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/Demos/Device/LowLevel/GenericHID/Descriptors.c b/Demos/Device/LowLevel/GenericHID/Descriptors.c index bcbb386ce..2e7536001 100644 --- a/Demos/Device/LowLevel/GenericHID/Descriptors.c +++ b/Demos/Device/LowLevel/GenericHID/Descriptors.c @@ -116,7 +116,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_GenericHID, .AlternateSetting = 0x00, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.h b/Demos/Device/LowLevel/GenericHID/Descriptors.h index 884233445..c37c68b13 100644 --- a/Demos/Device/LowLevel/GenericHID/Descriptors.h +++ b/Demos/Device/LowLevel/GenericHID/Descriptors.h @@ -55,19 +55,28 @@ // Generic HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_GenericHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; - USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; } 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_GenericHID = 0, /**< GenericHID 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/Demos/Device/LowLevel/Joystick/Descriptors.c b/Demos/Device/LowLevel/Joystick/Descriptors.c index 376238708..2f9eb0099 100644 --- a/Demos/Device/LowLevel/Joystick/Descriptors.c +++ b/Demos/Device/LowLevel/Joystick/Descriptors.c @@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Joystick, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.h b/Demos/Device/LowLevel/Joystick/Descriptors.h index f06b3cae3..2600e0cac 100644 --- a/Demos/Device/LowLevel/Joystick/Descriptors.h +++ b/Demos/Device/LowLevel/Joystick/Descriptors.h @@ -53,18 +53,27 @@ // Joystick HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_JoystickHID; - 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_Joystick = 0, /**< Joystick 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/Demos/Device/LowLevel/Keyboard/Descriptors.c b/Demos/Device/LowLevel/Keyboard/Descriptors.c index e3da4b6a9..6a644d80c 100644 --- a/Demos/Device/LowLevel/Keyboard/Descriptors.c +++ b/Demos/Device/LowLevel/Keyboard/Descriptors.c @@ -133,7 +133,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 = 2, diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.h b/Demos/Device/LowLevel/Keyboard/Descriptors.h index f9d54243a..dcd757233 100644 --- a/Demos/Device/LowLevel/Keyboard/Descriptors.h +++ b/Demos/Device/LowLevel/Keyboard/Descriptors.h @@ -54,19 +54,28 @@ // Keyboard HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_KeyboardHID; - USB_Descriptor_Endpoint_t HID_ReportINEndpoint; - USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; + USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint; } 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/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c index d45cd593f..4a339f415 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c +++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c @@ -168,7 +168,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 = 2, @@ -215,7 +215,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x01, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, @@ -327,27 +327,29 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, break; case HID_DTYPE_HID: - if (!(wIndex)) + switch (wIndex) { - Address = &ConfigurationDescriptor.HID1_KeyboardHID; - Size = sizeof(USB_HID_Descriptor_HID_t); - } - else - { - Address = &ConfigurationDescriptor.HID2_MouseHID; - Size = sizeof(USB_HID_Descriptor_HID_t); + case (INTERFACE_ID_Keyboard): + Address = &ConfigurationDescriptor.HID1_KeyboardHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; + case (INTERFACE_ID_Mouse): + Address = &ConfigurationDescriptor.HID2_MouseHID; + Size = sizeof(USB_HID_Descriptor_HID_t); + break; } break; case HID_DTYPE_Report: - if (!(wIndex)) + switch (wIndex) { - Address = &KeyboardReport; - Size = sizeof(KeyboardReport); - } - else - { - Address = &MouseReport; - Size = sizeof(MouseReport); + case INTERFACE_ID_Keyboard: + Address = &KeyboardReport; + Size = sizeof(KeyboardReport); + break; + case INTERFACE_ID_Mouse: + Address = &MouseReport; + Size = sizeof(MouseReport); + break; } break; diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h index 6d2543ac2..99f423e1b 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h +++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h @@ -63,15 +63,25 @@ USB_Descriptor_Endpoint_t HID2_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_Keyboard = 0, /**< Keyboard interface descriptor ID */ + INTERFACE_ID_Mouse = 1, /**< Mouse 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/Demos/Device/LowLevel/MIDI/Descriptors.c b/Demos/Device/LowLevel/MIDI/Descriptors.c index 5413f27f5..220d37dff 100644 --- a/Demos/Device/LowLevel/MIDI/Descriptors.c +++ b/Demos/Device/LowLevel/MIDI/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/Demos/Device/LowLevel/MIDI/Descriptors.h b/Demos/Device/LowLevel/MIDI/Descriptors.h index 1572b1cbc..649b2acb6 100644 --- a/Demos/Device/LowLevel/MIDI/Descriptors.h +++ b/Demos/Device/LowLevel/MIDI/Descriptors.h @@ -77,15 +77,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/Demos/Device/LowLevel/MassStorage/Descriptors.c b/Demos/Device/LowLevel/MassStorage/Descriptors.c index d069bcece..2be052b07 100644 --- a/Demos/Device/LowLevel/MassStorage/Descriptors.c +++ b/Demos/Device/LowLevel/MassStorage/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_MassStorage, .AlternateSetting = 0, .TotalEndpoints = 2, diff --git a/Demos/Device/LowLevel/MassStorage/Descriptors.h b/Demos/Device/LowLevel/MassStorage/Descriptors.h index dc6748f85..7c3196b93 100644 --- a/Demos/Device/LowLevel/MassStorage/Descriptors.h +++ b/Demos/Device/LowLevel/MassStorage/Descriptors.h @@ -68,15 +68,24 @@ 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_MassStorage = 0, /**< 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/Demos/Device/LowLevel/Mouse/Descriptors.c b/Demos/Device/LowLevel/Mouse/Descriptors.c index 99780a44d..23e8d7f44 100644 --- a/Demos/Device/LowLevel/Mouse/Descriptors.c +++ b/Demos/Device/LowLevel/Mouse/Descriptors.c @@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.h b/Demos/Device/LowLevel/Mouse/Descriptors.h index a5380a11a..3b637e21f 100644 --- a/Demos/Device/LowLevel/Mouse/Descriptors.h +++ b/Demos/Device/LowLevel/Mouse/Descriptors.h @@ -60,18 +60,27 @@ // Mouse HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MouseHID; - 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_Mouse = 0, /**< Mouse 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/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c index ca70633be..7474e5499 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c +++ b/Demos/Device/LowLevel/RNDISEthernet/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/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h index 763bc0c7c..9db67965f 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h @@ -81,15 +81,25 @@ USB_Descriptor_Endpoint_t RNDIS_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/Demos/Device/LowLevel/VirtualSerial/Descriptors.c b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c index 9432562cc..33f63371d 100644 --- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c +++ b/Demos/Device/LowLevel/VirtualSerial/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/Demos/Device/LowLevel/VirtualSerial/Descriptors.h b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h index a704614a6..8ece697fd 100644 --- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h +++ b/Demos/Device/LowLevel/VirtualSerial/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/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c index 6b714eb7d..13c6cbcc7 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = 0x00, + .InterfaceNumber = INTERFACE_ID_Mouse, .AlternateSetting = 0x00, .TotalEndpoints = 1, diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h index eca1e7981..a19b61267 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h @@ -53,18 +53,27 @@ // Mouse HID Interface USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_MouseHID; - 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_Mouse = 0, /**< Mouse interface descriptor ID (must be zero) */ + }; + /** 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/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c index ef9280ce8..2bbeb2dee 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c @@ -47,7 +47,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface = { .Config = { - .InterfaceNumber = 0, + .InterfaceNumber = INTERFACE_ID_Mouse, .ReportINEndpoint = { .Address = MOUSE_EPADDR, -- cgit v1.2.3