diff options
author | fauxpark <fauxpark@gmail.com> | 2020-02-03 07:17:05 +1100 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2020-02-26 10:15:12 +0900 |
commit | df6e5f16b6c334f464ac444f6c0e350daf7ec873 (patch) | |
tree | 601dbb44b560888cb6679ec56234da7124a6c814 /tmk_core/protocol/arm_atsam | |
parent | 4c88e39d157e59d42e83100d2c1c54417b804c23 (diff) |
Dedupe extrakey report struct, and send functions in V-USB & LUFA (#7993)
* Dedupe extrakey report struct, and send functions in V-USB & LUFA
* Doc comment for consistency
* Wrap it in ifdef to prevent unused function error
* Do the same for ATSAM
Diffstat (limited to 'tmk_core/protocol/arm_atsam')
-rw-r--r-- | tmk_core/protocol/arm_atsam/main_arm_atsam.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c index a42d9daf38..e15d51a263 100644 --- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c +++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c @@ -110,40 +110,34 @@ void send_mouse(report_mouse_t *report) { #endif // MOUSEKEY_ENABLE } -void send_system(uint16_t data) { #ifdef EXTRAKEY_ENABLE +void send_extra(uint8_t report_id, uint16_t data) { uint32_t irqflags; irqflags = __get_PRIMASK(); __disable_irq(); __DMB(); - udi_hid_exk_report.desc.report_id = REPORT_ID_SYSTEM; - if (data != 0) data = data - SYSTEM_POWER_DOWN + 1; + udi_hid_exk_report.desc.report_id = report_id; udi_hid_exk_report.desc.report_data = data; udi_hid_exk_b_report_valid = 1; udi_hid_exk_send_report(); __DMB(); __set_PRIMASK(irqflags); +} +#endif // EXTRAKEY_ENABLE + +void send_system(uint16_t data) { +#ifdef EXTRAKEY_ENABLE + if (data != 0) data = data - SYSTEM_POWER_DOWN + 1; + send_extra(REPORT_ID_SYSTEM, data); #endif // EXTRAKEY_ENABLE } void send_consumer(uint16_t data) { #ifdef EXTRAKEY_ENABLE - uint32_t irqflags; - - irqflags = __get_PRIMASK(); - __disable_irq(); - __DMB(); - - udi_hid_exk_report.desc.report_id = REPORT_ID_CONSUMER; - udi_hid_exk_report.desc.report_data = data; - udi_hid_exk_b_report_valid = 1; - udi_hid_exk_send_report(); - - __DMB(); - __set_PRIMASK(irqflags); + send_extra(REPORT_ID_CONSUMER, data); #endif // EXTRAKEY_ENABLE } |