diff --git a/demos/device/keyboard/.cproject b/demos/device/keyboard/.cproject
index b97fad98c..e06b38e20 100644
--- a/demos/device/keyboard/.cproject
+++ b/demos/device/keyboard/.cproject
@@ -119,7 +119,7 @@
-
+
-
+
@@ -150,7 +150,7 @@
-
+
@@ -277,45 +277,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<TargetConfig>
-<Properties property_0="" property_3="NXP" property_4="LPC11U37/401" property_count="5" version="1"/>
-<infoList vendor="NXP"><info chip="LPC11U37/401" match_id="0x00017C40" name="LPC11U37/401" stub="crt_emu_lpc11_13_nxp"><chip><name>LPC11U37/401</name>
-<family>LPC11Uxx</family>
+<Properties property_0="" property_3="NXP" property_4="LPC1347" property_count="5" version="1"/>
+<infoList vendor="NXP"><info chip="LPC1347" match_id="0x08020543" name="LPC1347" stub="crt_emu_lpc11_13_nxp"><chip><name>LPC1347</name>
+<family>LPC13xx (12bit ADC)</family>
<vendor>NXP (formerly Philips)</vendor>
<reset board="None" core="Real" sys="Real"/>
<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
<memory id="RAM" type="RAM"/>
<memory id="Periph" is_volatile="true" type="Peripheral"/>
-<memoryInstance derived_from="Flash" id="MFlash128" location="0x0" size="0x20000"/>
+<memoryInstance derived_from="Flash" id="MFlash64" location="0x0" size="0x10000"/>
<memoryInstance derived_from="RAM" id="RamLoc8" location="0x10000000" size="0x2000"/>
<memoryInstance derived_from="RAM" id="RamUsb2" location="0x20004000" size="0x800"/>
-<prog_flash blocksz="0x1000" location="0x0" maxprgbuff="0x400" progwithcode="TRUE" size="0x20000"/>
-<peripheralInstance derived_from="CM0_NVIC" id="NVIC" location="0xe000e000"/>
-<peripheralInstance derived_from="LPC11U_GPIO" id="GPIO" location="0x50000000"/>
-<peripheralInstance derived_from="LPC11U_USBDEV" id="USB" location="0x40080000"/>
-<peripheralInstance derived_from="CM0_DCR" id="DCR" location="0xe000edf0"/>
-<peripheralInstance derived_from="LPC11U_GPIO_GROUP_INT" id="GPIOGROUP0INT" location="0x40060000"/>
-<peripheralInstance derived_from="LPC11U_GPIO_GROUP_INT" id="GPIOGROUP1INT" location="0x4005c000"/>
-<peripheralInstance derived_from="LPC11U_GPIO_INT" id="GPIOINT" location="0x4004c000"/>
-<peripheralInstance derived_from="LPC11_13_SSP" id="SSP1" location="0x40058000"/>
-<peripheralInstance derived_from="LPC11U_FMC" id="FMC" location="0x4003c000"/>
-<peripheralInstance derived_from="LPC11U_SYSCTL" id="SYSCTL" location="0x40048000"/>
-<peripheralInstance derived_from="LPC11U_IOCON" id="IOCON" location="0x40044000"/>
-<peripheralInstance derived_from="LPC11_13_SSP" id="SSP0" location="0x40040000"/>
-<peripheralInstance derived_from="LPC11_13_PMU" id="PMU" location="0x40038000"/>
-<peripheralInstance derived_from="LPC11_13_ADC" id="ADC" location="0x4001c000"/>
-<peripheralInstance derived_from="LPC11_13_TIMER32" id="TIMER1" location="0x40018000"/>
-<peripheralInstance derived_from="LPC11_13_TIMER32" id="TIMER0" location="0x40014000"/>
-<peripheralInstance derived_from="LPC11_13_TIMER16" id="TMR161" location="0x40010000"/>
-<peripheralInstance derived_from="LPC11_13_TIMER16" id="TMR160" location="0x4000c000"/>
-<peripheralInstance derived_from="LPC1xxx_UART_MODEM" id="UART0" location="0x40008000"/>
-<peripheralInstance derived_from="LPC11_13_WDT" id="WDT" location="0x40004000"/>
-<peripheralInstance derived_from="LPC11_13_I2C" id="I2C0" location="0x40000000"/>
+<memoryInstance derived_from="RAM" id="RamPeriph2" location="0x20000000" size="0x800"/>
+<prog_flash blocksz="0x1000" location="0x0" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/>
+<peripheralInstance derived_from="V7M_MPU" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="I2C" id="I2C" location="0x40000000"/>
+<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40004000"/>
+<peripheralInstance derived_from="USART" id="USART" location="0x40008000"/>
+<peripheralInstance derived_from="CT16B0" id="CT16B0" location="0x4000c000"/>
+<peripheralInstance derived_from="CT16B1" id="CT16B1" location="0x40010000"/>
+<peripheralInstance derived_from="CT32B0" id="CT32B0" location="0x40014000"/>
+<peripheralInstance derived_from="CT32B1" id="CT32B1" location="0x40018000"/>
+<peripheralInstance derived_from="ADC" id="ADC" location="0x4001c000"/>
+<peripheralInstance derived_from="PMU" id="PMU" location="0x40038000"/>
+<peripheralInstance derived_from="FLASHCTRL" id="FLASHCTRL" location="0x4003c000"/>
+<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40040000"/>
+<peripheralInstance derived_from="IOCON" id="IOCON" location="0x40044000"/>
+<peripheralInstance derived_from="SYSCON" id="SYSCON" location="0x40048000"/>
+<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x4004c000"/>
+<peripheralInstance derived_from="SSP1" id="SSP1" location="0x40058000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x4005c000"/>
+<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40060000"/>
+<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x40064000"/>
+<peripheralInstance derived_from="USB" id="USB" location="0x40080000"/>
+<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x50000000"/>
</chip>
-<processor><name gcc_name="cortex-m0">Cortex-M0</name>
+<processor><name gcc_name="cortex-m3">Cortex-M3</name>
<family>Cortex-M</family>
</processor>
-<link href="nxp_lpc11_13_peripheral.xme" show="embed" type="simple"/>
+<link href="nxp_lpc13Uxx_peripheral.xme" show="embed" type="simple"/>
</info>
</infoList>
</TargetConfig>
diff --git a/demos/device/keyboard/main.c b/demos/device/keyboard/main.c
index 22ceffb0d..cdf7fe452 100644
--- a/demos/device/keyboard/main.c
+++ b/demos/device/keyboard/main.c
@@ -100,9 +100,12 @@ void keyboard_device_app_task(void * p_para)
static uint32_t count =0;
if (count < 4)
{
- uint8_t keys[6] = {0x04}; // A character
- tusbd_hid_keyboard_send_report(0x00, keys, 1);
count++;
+
+ tusbd_hid_keyboard_send_report(
+ &(tusb_keyboard_report_t) {
+ .keycode = { 0x04 } }
+ );
}
}
}
diff --git a/tests/test/device/usbd/test_usbd.c b/tests/test/device/usbd/test_usbd.c
index 05c338199..e8f114b0a 100644
--- a/tests/test/device/usbd/test_usbd.c
+++ b/tests/test/device/usbd/test_usbd.c
@@ -43,8 +43,9 @@
#include "tusb_descriptors.h"
-#include "mock_dcd.h"
#include "usbd.h"
+#include "mock_dcd.h"
+//#include "mock_"
void setUp(void)
{
diff --git a/tinyusb/class/hid_device.c b/tinyusb/class/hid_device.c
index 2e68fd4d0..dc340841f 100644
--- a/tinyusb/class/hid_device.c
+++ b/tinyusb/class/hid_device.c
@@ -226,7 +226,7 @@ tusb_error_t hidd_configured(USBD_HANDLE_T hUsb)
}
#if TUSB_CFG_DEVICE_HID_KEYBOARD
-tusb_error_t tusbd_hid_keyboard_send_report(uint8_t modifier, uint8_t keycodes[], uint8_t numkey)
+tusb_error_t tusbd_hid_keyboard_send_report(tusb_keyboard_report_t *p_kbd_report)
{
// uint32_t start_time = systickGetSecondsActive();
// while (bKeyChanged) // TODO blocking while previous key has yet sent - can use fifo to improve this
@@ -239,12 +239,9 @@ tusb_error_t tusbd_hid_keyboard_send_report(uint8_t modifier, uint8_t keycodes[]
return TUSB_ERROR_FAILED;
}
- ASSERT(keycodes && numkey && numkey <=6, ERR_FAILED);
-
- hid_keyboard_report.modifier = modifier;
- memset(hid_keyboard_report.keycode, 0, 6);
- memcpy(hid_keyboard_report.keycode, keycodes, numkey);
+ ASSERT_PTR(p_kbd_report, TUSB_ERROR_FAILED);
+ hid_keyboard_report = *p_kbd_report;
bKeyChanged = true;
return TUSB_ERROR_NONE;
diff --git a/tinyusb/class/hid_device.h b/tinyusb/class/hid_device.h
index f01685e25..38282f624 100644
--- a/tinyusb/class/hid_device.h
+++ b/tinyusb/class/hid_device.h
@@ -36,12 +36,6 @@
*/
/**************************************************************************/
-/** \file
- * \brief TBD
- *
- * \note TBD
- */
-
/** \ingroup TBD
* \defgroup TBD
* \brief TBD
@@ -63,8 +57,8 @@
//--------------------------------------------------------------------+
// KEYBOARD Application API
//--------------------------------------------------------------------+
-tusb_error_t tusbd_hid_keyboard_send_report(uint8_t modifier, uint8_t keycodes[], uint8_t numkey);
-tusb_error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y);
+tusb_error_t tusbd_hid_keyboard_send_report(tusb_keyboard_report_t *p_kbd_report);
+tusb_error_t tusbd_hid_mouse_send_report(uint8_t buttons, int8_t x, int8_t y);
//--------------------------------------------------------------------+
// USBD-CLASS DRIVER API
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index bed745985..5fb5d0202 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -61,11 +61,34 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
+static tusb_error_t usbd_string_descriptor_init(void);
+
+//--------------------------------------------------------------------+
+// APPLICATION INTERFACE
+//--------------------------------------------------------------------+
+//bool tusbd_is_configured(uint8_t coreid)
+//{
+//
+//}
//--------------------------------------------------------------------+
// IMPLEMENTATION
//--------------------------------------------------------------------+
tusb_error_t usbd_init (void)
+{
+ ASSERT_STATUS ( usbd_string_descriptor_init() );
+
+ ASSERT_STATUS ( dcd_init() );
+
+ return TUSB_ERROR_NONE;
+}
+
+#endif
+
+//--------------------------------------------------------------------+
+// HELPER
+//--------------------------------------------------------------------+
+static tusb_error_t usbd_string_descriptor_init(void)
{
ASSERT_INT( USB_STRING_LEN(sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1),
app_tusb_desc_strings.manufacturer.bLength, TUSB_ERROR_USBD_DESCRIPTOR_STRING);
@@ -78,22 +101,18 @@ tusb_error_t usbd_init (void)
for(uint32_t i=0; i < sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER)-1; i++)
{
- app_tusb_desc_strings.manufacturer.unicode_string[i] = TUSB_CFG_DEVICE_STRING_MANUFACTURER[i];
+ app_tusb_desc_strings.manufacturer.unicode_string[i] = (uint16_t) TUSB_CFG_DEVICE_STRING_MANUFACTURER[i];
}
for(uint32_t i=0; i < sizeof(TUSB_CFG_DEVICE_STRING_PRODUCT)-1; i++)
{
- app_tusb_desc_strings.product.unicode_string[i] = TUSB_CFG_DEVICE_STRING_PRODUCT[i];
+ app_tusb_desc_strings.product.unicode_string[i] = (uint16_t) TUSB_CFG_DEVICE_STRING_PRODUCT[i];
}
for(uint32_t i=0; i < sizeof(TUSB_CFG_DEVICE_STRING_SERIAL)-1; i++)
{
- app_tusb_desc_strings.serial.unicode_string[i] = TUSB_CFG_DEVICE_STRING_SERIAL[i];
+ app_tusb_desc_strings.serial.unicode_string[i] = (uint16_t) TUSB_CFG_DEVICE_STRING_SERIAL[i];
}
- ASSERT_STATUS ( dcd_init() );
-
return TUSB_ERROR_NONE;
}
-
-#endif
diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h
index 25aaaa946..5ed8ebd93 100644
--- a/tinyusb/device/usbd.h
+++ b/tinyusb/device/usbd.h
@@ -67,6 +67,7 @@
//--------------------------------------------------------------------+
// APPLICATION API
//--------------------------------------------------------------------+
+bool tusbd_is_configured(uint8_t coreid) ATTR_WARN_UNUSED_RESULT;
//--------------------------------------------------------------------+
// CLASS-USBD & INTERNAL API