diff options
author | László Monda <laci@monda.hu> | 2013-10-06 22:16:20 +0200 |
---|---|---|
committer | László Monda <laci@monda.hu> | 2013-10-06 22:16:20 +0200 |
commit | 9ef29ea2293dde7225360fe258224d22d3a68756 (patch) | |
tree | 8b97bebc31be97f73384a605ccc2f41b2a04d492 /Projects/SerialToLCD | |
parent | cd3aae87daa243413413ab9fc4e32c225c3bea03 (diff) | |
download | lufa-9ef29ea2293dde7225360fe258224d22d3a68756.tar.gz lufa-9ef29ea2293dde7225360fe258224d22d3a68756.tar.bz2 lufa-9ef29ea2293dde7225360fe258224d22d3a68756.zip |
Extract interface numbers into enums.
Diffstat (limited to 'Projects/SerialToLCD')
-rw-r--r-- | Projects/SerialToLCD/Descriptors.c | 4 | ||||
-rw-r--r-- | Projects/SerialToLCD/Descriptors.h | 16 | ||||
-rw-r--r-- | Projects/SerialToLCD/SerialToLCD.c | 2 | ||||
-rw-r--r-- | Projects/SerialToLCD/SerialToLCD.h | 26 |
4 files changed, 29 insertions, 19 deletions
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 <avr/io.h> - #include <avr/wdt.h> - #include <avr/interrupt.h> - #include <avr/power.h> + /* Includes: */ + #include <avr/io.h> + #include <avr/wdt.h> + #include <avr/interrupt.h> + #include <avr/power.h> - #include "Descriptors.h" + #include "Descriptors.h" #include "Lib/HD44780.h" - #include <LUFA/Version.h> - #include <LUFA/Drivers/Misc/RingBuffer.h> - #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Version.h> + #include <LUFA/Drivers/Misc/RingBuffer.h> + #include <LUFA/Drivers/USB/USB.h> #include <LUFA/Platform/Platform.h> /* 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 |