-
can someone show a simple minimalistic program for accessing keyboard's LEDs CapLock/Mayus .etc bitfield in a get & set manner thx ^-^ ! |
Beta Was this translation helpful? Give feedback.
Answered by
WormPatch
Aug 26, 2023
Replies: 2 comments 1 reply
-
here a minimal code #include "Adafruit_TinyUSB.h"
uint8_t const desc_hid_report[] = { TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(RID_KEYBOARD)) };
Adafruit_USBD_HID usb_hid(desc_hid_report, sizeof(desc_hid_report), 2, false);
void setup() {
usb_hid.begin();
while (!USBDevice.mounted()) delay(1);
do delay(50); while (!usb_hid.ready());
}
void loop() {} |
Beta Was this translation helpful? Give feedback.
0 replies
-
ok i realized there is no such keyboard HID that sets leds from byte, but you can read #include "Adafruit_TinyUSB.h"
uint8_t leds = 0;
uint8_t const desc_hid_report[] = { TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(RID_KEYBOARD)) };
Adafruit_USBD_HID usb_hid(desc_hid_report, sizeof(desc_hid_report), 2, false);
void setup() {
usb_hid.setReportCallback(NULL, hid_report_callback);
usb_hid.begin();
while (!USBDevice.mounted()) delay(1);
do delay(50); while (!usb_hid.ready());
}
void loop() {}
void hid_report_callback(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) {
if (report_type == HID_REPORT_TYPE_OUTPUT) leds = buffer[0];
} a way to write it is pressing led state keys like bloqnum or capslock |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
WormPatch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok i realized there is no such keyboard HID that sets leds from byte, but you can read
a way to …