diff options
| author | hathach <[email protected]> | 2013-06-03 14:31:17 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-06-03 14:31:17 +0700 |
| commit | b527e6ec4a9d0b6ecad5a6ce74b27458d1cd24be (patch) | |
| tree | 2d7c009e15d1fd73d9df62217c9e4a748ebe026f /tinyusb/device/usbd.c | |
| parent | 7d78fc1baf24c537ea7386f698e1e20ed80f16ba (diff) | |
refractor tusb_descriptors
usbd device_class_driver
added & tested HID mouse for device (work together with hid keyboard)
rename DEVICE_ROM_REG_BASE, DEVICE_ROM_DRIVER_ADDR
Diffstat (limited to 'tinyusb/device/usbd.c')
| -rw-r--r-- | tinyusb/device/usbd.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 594112c88..160302d99 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -56,7 +56,15 @@ // //}; - +// TODO fix/compress number of class driver +static device_class_driver_t const usbh_class_drivers[TUSB_CLASS_MAX_CONSEC_NUMBER] = +{ +#if DEVICE_CLASS_HID + [TUSB_CLASS_HID] = { + .init = hidd_init, + }, +#endif +}; //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION @@ -80,8 +88,14 @@ tusb_error_t usbd_init (void) ASSERT_STATUS ( dcd_init() ); + uint16_t length = 0; + #if TUSB_CFG_DEVICE_HID_KEYBOARD - ASSERT_STATUS( hidd_init(&app_tusb_desc_configuration.keyboard_interface) ); + ASSERT_STATUS( hidd_init(&app_tusb_desc_configuration.keyboard_interface, &length) ); + #endif + + #if TUSB_CFG_DEVICE_HID_MOUSE + ASSERT_STATUS( hidd_init(&app_tusb_desc_configuration.mouse_interface, &length) ); #endif #ifndef _TEST_ @@ -100,13 +114,13 @@ tusb_error_t usbd_init (void) //--------------------------------------------------------------------+ static tusb_error_t usbd_string_descriptor_init(void) { - ASSERT_INT( USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1), + ASSERT_INT( STRING_LEN_BYTE2UNICODE(sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1), app_tusb_desc_strings.manufacturer.bLength, TUSB_ERROR_USBD_DESCRIPTOR_STRING); - ASSERT_INT( USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_PRODUCT)-1) , + ASSERT_INT( STRING_LEN_BYTE2UNICODE(sizeof(TUSB_CFG_DEVICE_STRING_PRODUCT)-1) , app_tusb_desc_strings.product.bLength , TUSB_ERROR_USBD_DESCRIPTOR_STRING); - ASSERT_INT( USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_SERIAL)-1) , + ASSERT_INT( STRING_LEN_BYTE2UNICODE(sizeof(TUSB_CFG_DEVICE_STRING_SERIAL)-1) , app_tusb_desc_strings.serial.bLength , TUSB_ERROR_USBD_DESCRIPTOR_STRING); for(uint32_t i=0; i < sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1; i++) |
