X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=common%2Fhost.c;h=2c2279aa4e072dec4d52f03931e907d66c888b86;hb=92b0674a7f7923f8efbe3bac1b5b8a410c5756cf;hp=261ec6472fa4f9e209260e6bd9afd24c9f3be891;hpb=1677b021d7bff6af7763532b038612363b61dada;p=max%2Ftmk_keyboard.git diff --git a/common/host.c b/common/host.c index 261ec647..2c2279aa 100644 --- a/common/host.c +++ b/common/host.c @@ -63,11 +63,11 @@ void host_keyboard_send(report_keyboard_t *report) (*driver->send_keyboard)(report); if (debug_keyboard) { - print("keys: "); + dprint("keys: "); for (int i = 0; i < REPORT_KEYS; i++) { - phex(keyboard_report->keys[i]); print(" "); + dprintf("%02X ", keyboard_report->keys[i]); } - print(" mods: "); phex(keyboard_report->mods); print("\n"); + dprintf(" mods: %02X\n", keyboard_report->mods); } } @@ -127,14 +127,19 @@ void host_clear_keys(void) } } -void host_add_mod_bit(uint8_t mod) +uint8_t host_get_mods(void) { - keyboard_report->mods |= mod; + return keyboard_report->mods; } -void host_del_mod_bit(uint8_t mod) +void host_add_mods(uint8_t mods) { - keyboard_report->mods &= ~mod; + keyboard_report->mods |= mods; +} + +void host_del_mods(uint8_t mods) +{ + keyboard_report->mods &= ~mods; } void host_set_mods(uint8_t mods) @@ -230,7 +235,7 @@ static inline void add_key_bit(uint8_t code) if ((code>>3) < REPORT_KEYS) { keyboard_report->keys[code>>3] |= 1<<(code&7); } else { - debug("add_key_bit: can't add: "); phex(code); debug("\n"); + dprintf("add_key_bit: can't add: %02X\n", code); } } @@ -239,6 +244,6 @@ static inline void del_key_bit(uint8_t code) if ((code>>3) < REPORT_KEYS) { keyboard_report->keys[code>>3] &= ~(1<<(code&7)); } else { - debug("del_key_bit: can't del: "); phex(code); debug("\n"); + dprintf("del_key_bit: can't del: %02X\n", code); } }