aboutsummaryrefslogtreecommitdiffstats
path: root/common/host.c
diff options
context:
space:
mode:
authorGravatar tmk <nobody@nowhere>2012-10-06 02:23:12 +0900
committerGravatar tmk <nobody@nowhere>2012-10-17 15:55:37 +0900
commit4ae979f6ef8dbf9e1d1f35be15322ad6d02e2958 (patch)
tree9f5132005c27ef04ae793b77d4699cb285479466 /common/host.c
parent93e33fb8f694c9685accd72ed0458a2cf3d3f04a (diff)
downloadqmk_firmware-4ae979f6ef8dbf9e1d1f35be15322ad6d02e2958.tar.gz
Initial version of new code for layer switch is added.
Diffstat (limited to 'common/host.c')
-rw-r--r--common/host.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/common/host.c b/common/host.c
index 8dd2abbee..fddd5b662 100644
--- a/common/host.c
+++ b/common/host.c
@@ -56,6 +56,19 @@ uint8_t host_keyboard_leds(void)
return (*driver->keyboard_leds)();
}
+/* new interface */
+void host_register_key(uint8_t key)
+{
+ host_add_key(key);
+ host_send_keyboard_report();
+}
+
+void host_unregister_key(uint8_t key)
+{
+ host_del_key(key);
+ host_send_keyboard_report();
+}
+
/* keyboard report operations */
void host_add_key(uint8_t key)
{
@@ -158,6 +171,14 @@ void host_send_keyboard_report(void)
{
if (!driver) return;
(*driver->send_keyboard)(keyboard_report);
+
+ if (debug_keyboard) {
+ print("keys: ");
+ for (int i = 0; i < REPORT_KEYS; i++) {
+ phex(keyboard_report->keys[i]); print(" ");
+ }
+ print(" mods: "); phex(keyboard_report->mods); print("\n");
+ }
}
void host_mouse_send(report_mouse_t *report)
@@ -216,7 +237,6 @@ static inline void del_key_byte(uint8_t code)
for (; i < REPORT_KEYS; i++) {
if (keyboard_report->keys[i] == code) {
keyboard_report->keys[i] = 0;
- break;
}
}
}