|
|
|
@ -13,6 +13,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@@ -13,6 +13,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|
|
|
|
#include <zmk/events/keycode-state-changed.h> |
|
|
|
|
#include <zmk/events/modifiers-state-changed.h> |
|
|
|
|
#include <zmk/hid.h> |
|
|
|
|
#include <dt-bindings/zmk/hid_usage_pages.h> |
|
|
|
|
#include <zmk/endpoints.h> |
|
|
|
|
|
|
|
|
|
static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode, |
|
|
|
@ -21,14 +22,14 @@ static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode,
@@ -21,14 +22,14 @@ static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode,
|
|
|
|
|
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, |
|
|
|
|
implicit_modifiers); |
|
|
|
|
switch (usage_page) { |
|
|
|
|
case USAGE_KEYPAD: |
|
|
|
|
case HID_USAGE_KEY: |
|
|
|
|
err = zmk_hid_keypad_press(keycode); |
|
|
|
|
if (err) { |
|
|
|
|
LOG_ERR("Unable to press keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case USAGE_CONSUMER: |
|
|
|
|
case HID_USAGE_CONSUMER: |
|
|
|
|
err = zmk_hid_consumer_press(keycode); |
|
|
|
|
if (err) { |
|
|
|
|
LOG_ERR("Unable to press keycode"); |
|
|
|
@ -46,14 +47,14 @@ static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode,
@@ -46,14 +47,14 @@ static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode,
|
|
|
|
|
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, |
|
|
|
|
implicit_modifiers); |
|
|
|
|
switch (usage_page) { |
|
|
|
|
case USAGE_KEYPAD: |
|
|
|
|
case HID_USAGE_KEY: |
|
|
|
|
err = zmk_hid_keypad_release(keycode); |
|
|
|
|
if (err) { |
|
|
|
|
LOG_ERR("Unable to release keycode"); |
|
|
|
|
return err; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case USAGE_CONSUMER: |
|
|
|
|
case HID_USAGE_CONSUMER: |
|
|
|
|
err = zmk_hid_consumer_release(keycode); |
|
|
|
|
if (err) { |
|
|
|
|
LOG_ERR("Unable to release keycode"); |
|
|
|
|