Skip to content

Instantly share code, notes, and snippets.

@mondalaci
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mondalaci/be72d8613ba3c2f3f38e to your computer and use it in GitHub Desktop.
Save mondalaci/be72d8613ba3c2f3f38e to your computer and use it in GitHub Desktop.
Emit the scancode of the "x" character per second
uint8_t isSecondElapsed = 0;
int main(void)
{
while (1) {
_delay_us(1000);
isSecondElapsed = 1;
}
}
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
if (isSecondElapsed) {
KeyboardReport->KeyCode[0] = HID_KEYBOARD_SC_X;
isSecondElapsed = 0;
}
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment