USB device stack for NUCLEO-F042K6, NUCLEO-L152RE and NUCLEO-F103RB.
Fork of L152RE_USBDevice by
I tried USB device using HAL_PCD.
Nucleo-F042K6 | USB |
---|---|
PA11 (CN3-13) | DM (2 WHITE) |
PA12 (CN3-5) | DP (3 GREEN) |
GND (CN3-4) | GND (5 BLACK) |
VIN (CN4-1) | VBUS(1 RED) |
Examples
Import programF042K6_USBDevice_example
NUCLEO-F042K6 USBDevice example code
Import programL152RE_USBDevice_example
L152RE_USBDevice example code
Import programF042K6_Simple-CMSIS-DAP
cmsis-dap debug adapter
Import programL152RE_Simple-CMSIS-DAP
cmsis-dap debug adapter
Diff: USBHID/USBKeyboard.cpp
- Revision:
- 25:7c72828865f3
- Parent:
- 11:eeb3cbbaa996
- Child:
- 47:a0cd9646ecd1
--- a/USBHID/USBKeyboard.cpp Fri May 16 09:00:39 2014 +0100 +++ b/USBHID/USBKeyboard.cpp Tue Jun 03 11:30:32 2014 +0100 @@ -183,7 +183,7 @@ {0x4a, 0}, /* HOME */ {0x4b, 0}, /* PAGE_UP */ {0x4e, 0}, /* PAGE_DOWN */ - + {0x4f, 0}, /* RIGHT_ARROW */ {0x50, 0}, /* LEFT_ARROW */ {0x51, 0}, /* DOWN_ARROW */ @@ -344,7 +344,7 @@ {0x4a, 0}, /* HOME */ {0x4b, 0}, /* PAGE_UP */ {0x4e, 0}, /* PAGE_DOWN */ - + {0x4f, 0}, /* RIGHT_ARROW */ {0x50, 0}, /* LEFT_ARROW */ {0x51, 0}, /* DOWN_ARROW */ @@ -424,10 +424,10 @@ uint32_t bytesRead = 0; uint8_t led[65]; USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE); - + // we take led[1] because led[0] is the report ID lock_status = led[1] & 0x07; - + // We activate the endpoint to be able to recceive data if (!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE)) return false;