diff options
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/chibios/suspend.c | 4 | ||||
-rw-r--r-- | tmk_core/common/host.c | 15 | ||||
-rw-r--r-- | tmk_core/common/host.h | 2 | ||||
-rw-r--r-- | tmk_core/common/host_driver.h | 1 | ||||
-rw-r--r-- | tmk_core/common/report.h | 6 |
5 files changed, 26 insertions, 2 deletions
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 991fe6e08..9310a9992 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "action.h" | 7 | #include "action.h" |
8 | #include "action_util.h" | 8 | #include "action_util.h" |
9 | #include "mousekey.h" | 9 | #include "mousekey.h" |
10 | #include "programmable_button.h" | ||
10 | #include "host.h" | 11 | #include "host.h" |
11 | #include "suspend.h" | 12 | #include "suspend.h" |
12 | #include "led.h" | 13 | #include "led.h" |
@@ -79,6 +80,9 @@ void suspend_wakeup_init(void) { | |||
79 | #ifdef MOUSEKEY_ENABLE | 80 | #ifdef MOUSEKEY_ENABLE |
80 | mousekey_clear(); | 81 | mousekey_clear(); |
81 | #endif /* MOUSEKEY_ENABLE */ | 82 | #endif /* MOUSEKEY_ENABLE */ |
83 | #ifdef PROGRAMMABLE_BUTTON_ENABLE | ||
84 | programmable_button_clear(); | ||
85 | #endif /* PROGRAMMABLE_BUTTON_ENABLE */ | ||
82 | #ifdef EXTRAKEY_ENABLE | 86 | #ifdef EXTRAKEY_ENABLE |
83 | host_system_send(0); | 87 | host_system_send(0); |
84 | host_consumer_send(0); | 88 | host_consumer_send(0); |
diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index f0c396b18..56d4bb084 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c | |||
@@ -30,8 +30,9 @@ extern keymap_config_t keymap_config; | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | static host_driver_t *driver; | 32 | static host_driver_t *driver; |
33 | static uint16_t last_system_report = 0; | 33 | static uint16_t last_system_report = 0; |
34 | static uint16_t last_consumer_report = 0; | 34 | static uint16_t last_consumer_report = 0; |
35 | static uint32_t last_programmable_button_report = 0; | ||
35 | 36 | ||
36 | void host_set_driver(host_driver_t *d) { driver = d; } | 37 | void host_set_driver(host_driver_t *d) { driver = d; } |
37 | 38 | ||
@@ -122,6 +123,16 @@ void host_digitizer_send(digitizer_t *digitizer) { | |||
122 | 123 | ||
123 | __attribute__((weak)) void send_digitizer(report_digitizer_t *report) {} | 124 | __attribute__((weak)) void send_digitizer(report_digitizer_t *report) {} |
124 | 125 | ||
126 | void host_programmable_button_send(uint32_t report) { | ||
127 | if (report == last_programmable_button_report) return; | ||
128 | last_programmable_button_report = report; | ||
129 | |||
130 | if (!driver) return; | ||
131 | (*driver->send_programmable_button)(report); | ||
132 | } | ||
133 | |||
125 | uint16_t host_last_system_report(void) { return last_system_report; } | 134 | uint16_t host_last_system_report(void) { return last_system_report; } |
126 | 135 | ||
127 | uint16_t host_last_consumer_report(void) { return last_consumer_report; } | 136 | uint16_t host_last_consumer_report(void) { return last_consumer_report; } |
137 | |||
138 | uint32_t host_last_programmable_button_report(void) { return last_programmable_button_report; } | ||
diff --git a/tmk_core/common/host.h b/tmk_core/common/host.h index 2cffef6e1..6b15f0d0c 100644 --- a/tmk_core/common/host.h +++ b/tmk_core/common/host.h | |||
@@ -47,9 +47,11 @@ void host_keyboard_send(report_keyboard_t *report); | |||
47 | void host_mouse_send(report_mouse_t *report); | 47 | void host_mouse_send(report_mouse_t *report); |
48 | void host_system_send(uint16_t data); | 48 | void host_system_send(uint16_t data); |
49 | void host_consumer_send(uint16_t data); | 49 | void host_consumer_send(uint16_t data); |
50 | void host_programmable_button_send(uint32_t data); | ||
50 | 51 | ||
51 | uint16_t host_last_system_report(void); | 52 | uint16_t host_last_system_report(void); |
52 | uint16_t host_last_consumer_report(void); | 53 | uint16_t host_last_consumer_report(void); |
54 | uint32_t host_last_programmable_button_report(void); | ||
53 | 55 | ||
54 | #ifdef __cplusplus | 56 | #ifdef __cplusplus |
55 | } | 57 | } |
diff --git a/tmk_core/common/host_driver.h b/tmk_core/common/host_driver.h index 2aebca043..affd0dcb3 100644 --- a/tmk_core/common/host_driver.h +++ b/tmk_core/common/host_driver.h | |||
@@ -29,6 +29,7 @@ typedef struct { | |||
29 | void (*send_mouse)(report_mouse_t *); | 29 | void (*send_mouse)(report_mouse_t *); |
30 | void (*send_system)(uint16_t); | 30 | void (*send_system)(uint16_t); |
31 | void (*send_consumer)(uint16_t); | 31 | void (*send_consumer)(uint16_t); |
32 | void (*send_programmable_button)(uint32_t); | ||
32 | } host_driver_t; | 33 | } host_driver_t; |
33 | 34 | ||
34 | void send_digitizer(report_digitizer_t *report); \ No newline at end of file | 35 | void send_digitizer(report_digitizer_t *report); \ No newline at end of file |
diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index f2223e806..1adc892f3 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h | |||
@@ -29,6 +29,7 @@ enum hid_report_ids { | |||
29 | REPORT_ID_MOUSE, | 29 | REPORT_ID_MOUSE, |
30 | REPORT_ID_SYSTEM, | 30 | REPORT_ID_SYSTEM, |
31 | REPORT_ID_CONSUMER, | 31 | REPORT_ID_CONSUMER, |
32 | REPORT_ID_PROGRAMMABLE_BUTTON, | ||
32 | REPORT_ID_NKRO, | 33 | REPORT_ID_NKRO, |
33 | REPORT_ID_JOYSTICK, | 34 | REPORT_ID_JOYSTICK, |
34 | REPORT_ID_DIGITIZER | 35 | REPORT_ID_DIGITIZER |
@@ -196,6 +197,11 @@ typedef struct { | |||
196 | } __attribute__((packed)) report_extra_t; | 197 | } __attribute__((packed)) report_extra_t; |
197 | 198 | ||
198 | typedef struct { | 199 | typedef struct { |
200 | uint8_t report_id; | ||
201 | uint32_t usage; | ||
202 | } __attribute__((packed)) report_programmable_button_t; | ||
203 | |||
204 | typedef struct { | ||
199 | #ifdef MOUSE_SHARED_EP | 205 | #ifdef MOUSE_SHARED_EP |
200 | uint8_t report_id; | 206 | uint8_t report_id; |
201 | #endif | 207 | #endif |