Indicator LED
This commit is contained in:
parent
cbf19a1303
commit
b059dfddb5
3 changed files with 8 additions and 6 deletions
|
|
@ -27,10 +27,8 @@
|
|||
#include "class/midi/midi_device.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
/* declarations */
|
||||
uint8_t keyboard_leds(void) {
|
||||
// TODO
|
||||
return 0;
|
||||
return get_keyboard_led_status();
|
||||
}
|
||||
|
||||
void send_keyboard(report_keyboard_t *report) {
|
||||
|
|
@ -92,7 +90,7 @@ void send_consumer(uint16_t data) {
|
|||
tud_task();
|
||||
}
|
||||
|
||||
void raw_hid_send(uint8_t* data, uint8_t length) {
|
||||
void raw_hid_send(uint8_t *data, uint8_t length) {
|
||||
while (!tud_hid_n_ready(ITF_NUM_HID_RAW)) {
|
||||
tud_task();
|
||||
if (!tud_ready()) {
|
||||
|
|
|
|||
|
|
@ -265,12 +265,14 @@ uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t
|
|||
static uint8_t keyboard_indicator_led;
|
||||
uint8_t get_keyboard_led_status(void) { return keyboard_indicator_led; }
|
||||
|
||||
__attribute__((weak)) void raw_hid_receive(uint8_t* data, uint8_t length) {}
|
||||
|
||||
// Invoked when received SET_REPORT control request or
|
||||
// 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) {
|
||||
switch (itf) {
|
||||
case ITF_NUM_HID_KEYBOARD:
|
||||
// LED status
|
||||
keyboard_indicator_led = buffer[0];
|
||||
break;
|
||||
case ITF_NUM_HID_RAW:
|
||||
raw_hid_receive((uint8_t*)buffer, bufsize);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -56,3 +56,5 @@ enum {
|
|||
HID_REPORT_SIZE(0x08), \
|
||||
HID_OUTPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE | HID_NON_VOLATILE), \
|
||||
HID_COLLECTION_END
|
||||
|
||||
uint8_t get_keyboard_led_status(void);
|
||||
|
|
|
|||
Loading…
Reference in a new issue