-
Notifications
You must be signed in to change notification settings - Fork 194
Ability to toggle the power LED state #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11d6890
10ea2b8
1257c92
8c2818f
9149e69
c6b2ac3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | |
| // Firmware version | ||
| ReportData_u8[INDEX_FW_VER_MAJOR] = VERSION_OF_FIRMWARE_MAJOR; | ||
| ReportData_u8[INDEX_FW_VER_MINOR] = VERSION_OF_FIRMWARE_MINOR; | ||
| ReportData_u8[INDEX_FW_VER_UNOFFICIAL] = VERSION_OF_FIRMWARE_UNOFFICIAL; | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -115,7 +116,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | |
| const void* ReportData, | ||
| const uint16_t ReportSize) | ||
| { | ||
|
|
||
| uint8_t *ReportData_u8 = (uint8_t *)ReportData; | ||
|
|
||
| uint8_t cmd = ReportData_u8[0]; //[0]; // command from enum COMMANDS{ ... }; | ||
|
|
@@ -211,6 +212,19 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | |
| case CMD_NOP: | ||
| break; | ||
|
|
||
|
|
||
| // Unofficial commands | ||
| case CMD_UNOFFICIAL_SET_USBLED: | ||
|
|
||
| g_Settings.isUsbLedEnabled = ReportData_u8[1]; | ||
| if (g_Settings.isUsbLedEnabled) { | ||
| SET(USBLED); | ||
| } else { | ||
| CLR(USBLED); | ||
| } | ||
|
|
||
| break; | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have never looked into the firmware build. Are the settings persisted across device reboots? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, they are not persistent. |
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't test this - all bytes in
ReportData_u8are zero unless set here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, before this function is called the whole array is set to zero.
Also, the array is 64 bytes long, so there can't be a buffer overrun.