mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 22:43:49 +00:00
update hid_composite freertos with capslock as well
This commit is contained in:
parent
ca98996e1f
commit
6de023d54b
@ -274,7 +274,8 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t rep
|
||||
board_led_write(true);
|
||||
}else
|
||||
{
|
||||
// Caplocks Off: back to normal link
|
||||
// Caplocks Off: back to normal blink
|
||||
board_led_write(false);
|
||||
blink_interval_ms = BLINK_MOUNTED;
|
||||
}
|
||||
}
|
||||
|
@ -315,12 +315,31 @@ uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t
|
||||
// received data on OUT endpoint ( Report ID = 0, Type = 0 )
|
||||
void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize)
|
||||
{
|
||||
// TODO set LED based on CAPLOCK, NUMLOCK etc...
|
||||
(void) itf;
|
||||
(void) report_id;
|
||||
(void) report_type;
|
||||
(void) buffer;
|
||||
(void) bufsize;
|
||||
|
||||
if (report_type == HID_REPORT_TYPE_OUTPUT)
|
||||
{
|
||||
// Set keyboard LED e.g Capslock, Numlock etc...
|
||||
if (report_id == REPORT_ID_KEYBOARD)
|
||||
{
|
||||
// bufsize should be (at least) 1
|
||||
if ( bufsize < 1 ) return;
|
||||
|
||||
uint8_t const kbd_leds = buffer[0];
|
||||
|
||||
if (kbd_leds & KEYBOARD_LED_CAPSLOCK)
|
||||
{
|
||||
// Capslock On: disable blink, turn led on
|
||||
xTimerStop(blinky_tm, portMAX_DELAY);
|
||||
board_led_write(true);
|
||||
}else
|
||||
{
|
||||
// Caplocks Off: back to normal blink
|
||||
board_led_write(false);
|
||||
xTimerStart(blinky_tm, portMAX_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
Loading…
x
Reference in New Issue
Block a user