aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/host.c')
-rw-r--r--tmk_core/common/host.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c
index f5d041699..ce39760a5 100644
--- a/tmk_core/common/host.c
+++ b/tmk_core/common/host.c
@@ -23,40 +23,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
23#include "debug.h" 23#include "debug.h"
24 24
25#ifdef NKRO_ENABLE 25#ifdef NKRO_ENABLE
26 #include "keycode_config.h" 26# include "keycode_config.h"
27 extern keymap_config_t keymap_config; 27extern keymap_config_t keymap_config;
28#endif 28#endif
29 29
30static host_driver_t *driver; 30static host_driver_t *driver;
31static uint16_t last_system_report = 0; 31static uint16_t last_system_report = 0;
32static uint16_t last_consumer_report = 0; 32static uint16_t last_consumer_report = 0;
33 33
34void host_set_driver(host_driver_t *d) { driver = d; }
34 35
35void host_set_driver(host_driver_t *d) 36host_driver_t *host_get_driver(void) { return driver; }
36{
37 driver = d;
38}
39
40host_driver_t *host_get_driver(void)
41{
42 return driver;
43}
44 37
45uint8_t host_keyboard_leds(void) 38uint8_t host_keyboard_leds(void) {
46{
47 if (!driver) return 0; 39 if (!driver) return 0;
48 return (*driver->keyboard_leds)(); 40 return (*driver->keyboard_leds)();
49} 41}
50/* send report */ 42/* send report */
51void host_keyboard_send(report_keyboard_t *report) 43void host_keyboard_send(report_keyboard_t *report) {
52{
53 if (!driver) return; 44 if (!driver) return;
54#if defined(NKRO_ENABLE) && defined(NKRO_SHARED_EP) 45#if defined(NKRO_ENABLE) && defined(NKRO_SHARED_EP)
55 if (keyboard_protocol && keymap_config.nkro) { 46 if (keyboard_protocol && keymap_config.nkro) {
56 /* The callers of this function assume that report->mods is where mods go in. 47 /* The callers of this function assume that report->mods is where mods go in.
57 * But report->nkro.mods can be at a different offset if core keyboard does not have a report ID. 48 * But report->nkro.mods can be at a different offset if core keyboard does not have a report ID.
58 */ 49 */
59 report->nkro.mods = report->mods; 50 report->nkro.mods = report->mods;
60 report->nkro.report_id = REPORT_ID_NKRO; 51 report->nkro.report_id = REPORT_ID_NKRO;
61 } else 52 } else
62#endif 53#endif
@@ -76,8 +67,7 @@ void host_keyboard_send(report_keyboard_t *report)
76 } 67 }
77} 68}
78 69
79void host_mouse_send(report_mouse_t *report) 70void host_mouse_send(report_mouse_t *report) {
80{
81 if (!driver) return; 71 if (!driver) return;
82#ifdef MOUSE_SHARED_EP 72#ifdef MOUSE_SHARED_EP
83 report->report_id = REPORT_ID_MOUSE; 73 report->report_id = REPORT_ID_MOUSE;
@@ -85,8 +75,7 @@ void host_mouse_send(report_mouse_t *report)
85 (*driver->send_mouse)(report); 75 (*driver->send_mouse)(report);
86} 76}
87 77
88void host_system_send(uint16_t report) 78void host_system_send(uint16_t report) {
89{
90 if (report == last_system_report) return; 79 if (report == last_system_report) return;
91 last_system_report = report; 80 last_system_report = report;
92 81
@@ -94,8 +83,7 @@ void host_system_send(uint16_t report)
94 (*driver->send_system)(report); 83 (*driver->send_system)(report);
95} 84}
96 85
97void host_consumer_send(uint16_t report) 86void host_consumer_send(uint16_t report) {
98{
99 if (report == last_consumer_report) return; 87 if (report == last_consumer_report) return;
100 last_consumer_report = report; 88 last_consumer_report = report;
101 89
@@ -103,12 +91,6 @@ void host_consumer_send(uint16_t report)
103 (*driver->send_consumer)(report); 91 (*driver->send_consumer)(report);
104} 92}
105 93
106uint16_t host_last_system_report(void) 94uint16_t host_last_system_report(void) { return last_system_report; }
107{
108 return last_system_report;
109}
110 95
111uint16_t host_last_consumer_report(void) 96uint16_t host_last_consumer_report(void) { return last_consumer_report; }
112{
113 return last_consumer_report;
114}