diff options
| author | hathach <[email protected]> | 2013-05-28 15:24:27 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-05-28 15:24:27 +0700 |
| commit | 1e5bd82af28c6005fa0ecf008e44322a6ee46461 (patch) | |
| tree | e9618a6a79880a0c681a6c213d8560c286e3475f /demos/device/keyboard | |
| parent | 7ae986de95ccb049611340164246e17ee0023c87 (diff) | |
rename NGX to ngx
add a bunch of stub header for dcd (175x_6x, 13xx, 18xx_43xx)
add dcd_nxp_romdriver for handling usb rom driver
add BIT_TEST_ in binary.h
remove mw_usbd_hid.h include due to lexical conflict
Diffstat (limited to 'demos/device/keyboard')
| -rw-r--r-- | demos/device/keyboard/.cproject | 4 | ||||
| -rw-r--r-- | demos/device/keyboard/.project | 4 | ||||
| -rw-r--r-- | demos/device/keyboard/tusb_config.h | 3 | ||||
| -rw-r--r-- | demos/device/keyboard/tusb_descriptors.c (renamed from demos/device/keyboard/descriptors.c) | 23 | ||||
| -rw-r--r-- | demos/device/keyboard/tusb_descriptors.h (renamed from demos/device/keyboard/descriptors.h) | 45 |
5 files changed, 40 insertions, 39 deletions
diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject index f62592331..dd8283469 100644 --- a/demos/device/keyboard/.cproject +++ b/demos/device/keyboard/.cproject @@ -81,7 +81,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="bsp/boards/embedded_artists/oem_base_board|bsp/lpc43xx|bsp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="bsp/boards/embedded_artists/oem_base_board|bsp/lpc11uxx|bsp/lpc43xx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -1389,7 +1389,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/sdio.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_timer.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_ssp.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_sct.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rtc.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rit.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_qei.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_lcd.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_i2s.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_evrt.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_emc.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_dac.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_can.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_atimer.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_adc.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/LCDTerm.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/Font5x7.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/debug_frmwrk.c|bsp/lpc13uxx|bsp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_can.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/sdio.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/LCDTerm.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_evrt.c|bsp/lpc11uxx|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_gpdma.c|bsp/lpc13uxx|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_lcd.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_ssp.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rit.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_qei.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_atimer.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_wwdt.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_mcpwm.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/debug_frmwrk.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_i2s.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_emc.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_sct.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_rtc.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_dac.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/Font5x7.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_timer.c|bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/src/lpc43xx_adc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> diff --git a/demos/device/keyboard/.project b/demos/device/keyboard/.project index ebcb46372..d2ab64e32 100644 --- a/demos/device/keyboard/.project +++ b/demos/device/keyboard/.project @@ -88,12 +88,12 @@ <link> <name>tinyusb</name> <type>2</type> - <location>C:/Users/hathach/Dropbox/tinyusb/workspace/tinyusb/tinyusb</location> + <locationURI>PARENT-3-PROJECT_LOC/tinyusb</locationURI> </link> </linkedResources> <filteredResources> <filter> - <id>1357896068317</id> + <id>1369631005268</id> <name></name> <type>26</type> <matcher> diff --git a/demos/device/keyboard/tusb_config.h b/demos/device/keyboard/tusb_config.h index 8ca515033..e7e9207ab 100644 --- a/demos/device/keyboard/tusb_config.h +++ b/demos/device/keyboard/tusb_config.h @@ -81,8 +81,7 @@ //--------------------------------------------------------------------+ // DEVICE CONFIGURATION //--------------------------------------------------------------------+ - -//------------- CORE/CONTROLLER -------------// +#define TUSB_CFG_DEVICE_USE_ROM_DRIVER 1 //------------- CLASS -------------// #define TUSB_CFG_DEVICE_HID_KEYBOARD 1 diff --git a/demos/device/keyboard/descriptors.c b/demos/device/keyboard/tusb_descriptors.c index e17527f63..f392d65ea 100644 --- a/demos/device/keyboard/descriptors.c +++ b/demos/device/keyboard/tusb_descriptors.c @@ -1,5 +1,5 @@ /* - * descriptors.c + * tusb_descriptors.c * * Created on: Nov 26, 2012 * Author: hathach @@ -35,7 +35,7 @@ * This file is part of the tinyUSB stack */ -#include "descriptors.h" +#include "tusb_descriptors.h" #if TUSB_CFG_DEVICE_HID_KEYBOARD TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) @@ -120,7 +120,7 @@ const uint8_t mouse_report_descriptor[] = { #endif TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) -tusb_descriptor_device_t const desc_device = +tusb_descriptor_device_t const app_desc_device = { .bLength = sizeof(tusb_descriptor_device_t), .bDescriptorType = TUSB_DESC_TYPE_DEVICE, @@ -131,7 +131,7 @@ tusb_descriptor_device_t const desc_device = .bMaxPacketSize0 = USB_MAX_PACKET0, - .idVendor = CFG_USB_VENDORID, + .idVendor = TUSB_CFG_DEVICE_VENDORID, .idProduct = USB_PRODUCT_ID, .bcdDevice = 0x0100, @@ -144,14 +144,14 @@ tusb_descriptor_device_t const desc_device = TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) -const app_configuration_desc_t desc_configuration = +const app_descriptor_configuration_t app_desc_configuration = { .configuration = { .bLength = sizeof(tusb_descriptor_configuration_t), .bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION, - .wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination + .wTotalLength = sizeof(app_descriptor_configuration_t) - 1, // exclude termination .bNumInterfaces = TOTAL_INTEFACES, .bConfigurationValue = 1, @@ -380,17 +380,18 @@ const app_configuration_desc_t desc_configuration = .null_termination = 0, }; -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) const USB_STR_DESCRIPTOR USB_StringDescriptor = +TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) +const app_descriptor_string_t app_desc_strings = { - .LangID = { .bLength = 0x04, .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, + .LangID = { .bLength = 0x04, .bDescriptorType = TUSB_DESC_TYPE_STRING }, .strLangID= {0x0409}, // US English - .Manufacturer = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_MANUFACTURER)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, + .Manufacturer = { .bLength = USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1), .bDescriptorType = TUSB_DESC_TYPE_STRING }, .strManufacturer = {'t', 'i', 'n', 'y', 'U', 'S', 'B'}, - .Product = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_PRODUCT)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, + .Product = { .bLength = USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_PRODUCT)-1), .bDescriptorType = TUSB_DESC_TYPE_STRING }, .strProduct = {'D', 'e', 'v', 'i', 'c', 'e', ' ', 'K', 'e', 'y', 'b', 'o', 'a', 'r', 'd'}, - .Serial = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_SERIAL)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE }, + .Serial = { .bLength = USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_SERIAL)-1), .bDescriptorType = TUSB_DESC_TYPE_STRING }, .strSerial = {'1', '2', '3', '4'} }; diff --git a/demos/device/keyboard/descriptors.h b/demos/device/keyboard/tusb_descriptors.h index 0c89ba4bd..a3beb66f2 100644 --- a/demos/device/keyboard/descriptors.h +++ b/demos/device/keyboard/tusb_descriptors.h @@ -1,5 +1,5 @@ /* - * descriptors.h + * tusb_descriptors.h * * Created on: Nov 26, 2012 * Author: hathachtware License Agreement (BSD License) @@ -35,30 +35,31 @@ #include "tusb.h" -#define CFG_USB_STRING_MANUFACTURER "tinyUSB" -#define CFG_USB_STRING_PRODUCT "Device Keyboard" -#define CFG_USB_STRING_SERIAL "1234" -#define CFG_USB_VENDORID 0x1FC9 +#define TUSB_CFG_DEVICE_STRING_MANUFACTURER "tinyUSB" +#define TUSB_CFG_DEVICE_STRING_PRODUCT "Device Keyboard" +#define TUSB_CFG_DEVICE_STRING_SERIAL "1234" +#define TUSB_CFG_DEVICE_VENDORID 0x1FC9 +//#define TUSB_CFG_DEVICE_PRODUCTID /* USB Serial uses the MCUs unique 128-bit chip ID via an IAP call = 32 hex chars */ #define USB_STRING_SERIAL_LEN 32 #define USB_STRING_LEN(n) (2 + ((n)<<1)) -typedef ATTR_PREPACKED struct ATTR_PACKED _USB_STR_DESCRIPTOR +typedef ATTR_PACKED_STRUCT(struct) { - USB_COMMON_DESCRIPTOR LangID; + tusb_descriptor_header_t LangID; uint16_t strLangID[1]; - USB_COMMON_DESCRIPTOR Manufacturer; - uint16_t strManufacturer[sizeof(CFG_USB_STRING_MANUFACTURER)-1]; // exclude null-character + tusb_descriptor_header_t Manufacturer; + uint16_t strManufacturer[sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1]; // exclude null-character - USB_COMMON_DESCRIPTOR Product; - uint16_t strProduct[sizeof(CFG_USB_STRING_PRODUCT)-1]; // exclude null-character + tusb_descriptor_header_t Product; + uint16_t strProduct[sizeof(TUSB_CFG_DEVICE_STRING_PRODUCT)-1]; // exclude null-character - USB_COMMON_DESCRIPTOR Serial; - uint16_t strSerial[sizeof(CFG_USB_STRING_SERIAL)-1]; -} USB_STR_DESCRIPTOR; + tusb_descriptor_header_t Serial; + uint16_t strSerial[sizeof(TUSB_CFG_DEVICE_STRING_SERIAL)-1]; +} app_descriptor_string_t; // USB Interface Assosication Descriptor #define USB_DEVICE_CLASS_IAD USB_DEVICE_CLASS_MISCELLANEOUS @@ -113,7 +114,7 @@ typedef ATTR_PREPACKED struct ATTR_PACKED _USB_STR_DESCRIPTOR PRODUCTID_BITMAP(HID_GENERIC, 3) | PRODUCTID_BITMAP(MASS_STORAGE, 4) ) ) /////////////////////////////////////////////////////////////////////// -typedef struct +typedef ATTR_PACKED_STRUCT(struct) { tusb_descriptor_configuration_t configuration; @@ -150,14 +151,14 @@ typedef struct tusb_descriptor_endpoint_t mouse_endpoint; #endif - uint8_t null_termination; -} app_configuration_desc_t; - -extern const tusb_descriptor_device_t desc_device; -extern const app_configuration_desc_t desc_configuration; -extern const USB_STR_DESCRIPTOR USB_StringDescriptor; + uint8_t null_termination; // NXP rom driver requires this to work +} app_descriptor_configuration_t; +extern const tusb_descriptor_device_t app_desc_device; +extern const app_descriptor_configuration_t app_desc_configuration; +extern const app_descriptor_string_t app_desc_strings; extern const uint8_t keyboard_report_descriptor[]; -extern const uint8_t HID_MouseReportDescriptor[]; + +//extern const uint8_t HID_MouseReportDescriptor[]; #endif |
