From 147c2bfda33ae29fe66ebccae303a867073a6672 Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Mon, 26 Dec 2011 15:02:39 -0800 Subject: [PATCH] Did some more splitting of responsibilities in the code --- cdc_device_definition.c | 29 +++++++++++++++++++++++++++++ cdc_device_definition.h | 13 +++++++++++++ usb_serial/usb_serial.c | 22 +--------------------- 3 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 cdc_device_definition.c create mode 100644 cdc_device_definition.h diff --git a/cdc_device_definition.c b/cdc_device_definition.c new file mode 100644 index 0000000..15cb596 --- /dev/null +++ b/cdc_device_definition.c @@ -0,0 +1,29 @@ +/* + * cdc_device_definition.c + * + * Created on: Dec 26, 2011 + * Author: Doug + */ + +#include "LUFA/Drivers/USB/USB.h" +#include "Descriptors.h" + +USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = +{ + .Config = + { + .ControlInterfaceNumber = 0, + + .DataINEndpointNumber = CDC_TX_EPNUM, + .DataINEndpointSize = CDC_TXRX_EPSIZE, + .DataINEndpointDoubleBank = true, + + .DataOUTEndpointNumber = CDC_RX_EPNUM, + .DataOUTEndpointSize = CDC_TXRX_EPSIZE, + .DataOUTEndpointDoubleBank = true, + + .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, + .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, + .NotificationEndpointDoubleBank = false, + }, +}; diff --git a/cdc_device_definition.h b/cdc_device_definition.h new file mode 100644 index 0000000..70050ac --- /dev/null +++ b/cdc_device_definition.h @@ -0,0 +1,13 @@ +/* + * cdc_device_definition.h + * + * Created on: Dec 26, 2011 + * Author: Doug + */ + +#ifndef CDC_DEVICE_DEFINITION_H_ +#define CDC_DEVICE_DEFINITION_H_ + +extern USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface; + +#endif /* CDC_DEVICE_DEFINITION_H_ */ diff --git a/usb_serial/usb_serial.c b/usb_serial/usb_serial.c index 5687fa3..06911e8 100644 --- a/usb_serial/usb_serial.c +++ b/usb_serial/usb_serial.c @@ -7,7 +7,7 @@ #include "usb_serial.h" #include "../LUFA/Drivers/USB/USB.h" -#include "../Descriptors.h" +#include "../cdc_device_definition.h" #include "../external_mem.h" #include "../tests/simm_electrical_test.h" #include "../programmer_protocol.h" @@ -22,26 +22,6 @@ #error Write chunk size should be a multiple of 4 bytes #endif -USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = -{ - .Config = - { - .ControlInterfaceNumber = 0, - - .DataINEndpointNumber = CDC_TX_EPNUM, - .DataINEndpointSize = CDC_TXRX_EPSIZE, - .DataINEndpointDoubleBank = true, - - .DataOUTEndpointNumber = CDC_RX_EPNUM, - .DataOUTEndpointSize = CDC_TXRX_EPSIZE, - .DataOUTEndpointDoubleBank = true, - - .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, - .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, - .NotificationEndpointDoubleBank = false, - }, -}; - void USBSerial_Init(void) { USB_Init();