alres arena

[TIPS] uTasker USB HID Keyboard State Detection

Discussion created by alres arena on Jan 11, 2018

[TIPS] uTasker USB HID Keyboard State Detection

 

usb_application.c :

 

static unsigned char ucLockKeys = 0;
#define NUM_LOCK_FLAG    0x01
#define CAPS_LOCK_FLAG   0x02
#define SCROLL_LOCK_FLAG 0x04
#define LOCK_KEYS        (NUM_LOCK_FLAG | CAPS_LOCK_FLAG | SCROLL_LOCK_FLAG)
static void fnSetKeyboardOutput(unsigned char ucOutputs) // assumed to be set report with a single byte content
{
    // Directly change the state of outputs
    //
    ucLockKeys = (ucOutputs & LOCK_KEYS);                 // present lock key states
}

 

Credits by: Mark Butcher 

Outcomes