Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4670

SDK • Setting LEDs on keyboard freezes up

$
0
0
Hello everyone,

I'm trying to set the LEDs on my keyboard when the caps/num/scroll Locks however the core freezes up likely locked in a loop and without keyboard control.

Code:

void set_leds (uint8_t leds){    if (!Keyboard_Addr) return;    if ( leds != keylock_flags )    {        keylock_flags = leds;    #if 0 // still not working        tusb_control_request_t ledreq = {            .bmRequestType_bit.recipient = TUSB_REQ_RCPT_INTERFACE,            .bmRequestType_bit.type = TUSB_REQ_TYPE_CLASS,            .bmRequestType_bit.direction = TUSB_DIR_OUT,            .bRequest = HID_REQ_CONTROL_SET_REPORT,            .wValue = HID_REPORT_TYPE_OUTPUT << 8,            .wIndex = 0,    // Interface number            .wLength = sizeof (keylock_flags)            };            tuh_xfer_t ledxfer = {                .daddr = Keyboard_Addr,                .setup = &ledreq,                .buffer = &keylock_flags,                .complete_cb = NULL                };            tuh_control_xfer (&ledxfer);    #endif    }}
I set Keyboard_Addr when the keyboard is mounted

Have I missed anything where is the example code for this I've had to gleam what I can from other projects.

I'm uses SDK 2.0.0 not sure what version TinyUSB is 0.17.0 I think. Any help would be great

Thank you

Statistics: Posted by DarkElvenAngel — Wed Nov 13, 2024 12:31 am — Replies 0 — Views 43



Viewing all articles
Browse latest Browse all 4670

Trending Articles