Browse Source

refactor(app): replace zmk_key with zmk_key_t

Aligns with typedef _t convention.

PR: #531
xmkb
innovaker 4 years ago committed by Pete Johanson
parent
commit
87179698b4
  1. 8
      app/include/zmk/hid.h
  2. 4
      app/include/zmk/keys.h
  3. 2
      app/src/ble.c
  4. 8
      app/src/hid.c

8
app/include/zmk/hid.h

@ -170,12 +170,12 @@ int zmk_hid_register_mod(zmk_mod modifier);
int zmk_hid_unregister_mod(zmk_mod modifier); int zmk_hid_unregister_mod(zmk_mod modifier);
int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers); int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers);
int zmk_hid_implicit_modifiers_release(); int zmk_hid_implicit_modifiers_release();
int zmk_hid_keyboard_press(zmk_key key); int zmk_hid_keyboard_press(zmk_key_t key);
int zmk_hid_keyboard_release(zmk_key key); int zmk_hid_keyboard_release(zmk_key_t key);
void zmk_hid_keyboard_clear(); void zmk_hid_keyboard_clear();
int zmk_hid_consumer_press(zmk_key key); int zmk_hid_consumer_press(zmk_key_t key);
int zmk_hid_consumer_release(zmk_key key); int zmk_hid_consumer_release(zmk_key_t key);
void zmk_hid_consumer_clear(); void zmk_hid_consumer_clear();
struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(); struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report();

4
app/include/zmk/keys.h

@ -9,13 +9,13 @@
#include <zephyr.h> #include <zephyr.h>
#include <dt-bindings/zmk/keys.h> #include <dt-bindings/zmk/keys.h>
typedef uint32_t zmk_key; typedef uint32_t zmk_key_t;
typedef uint8_t zmk_mod; typedef uint8_t zmk_mod;
typedef uint8_t zmk_mod_flags; typedef uint8_t zmk_mod_flags;
struct zmk_key_event { struct zmk_key_event {
uint32_t column; uint32_t column;
uint32_t row; uint32_t row;
zmk_key key; zmk_key_t key;
bool pressed; bool pressed;
}; };

2
app/src/ble.c

@ -596,7 +596,7 @@ int zmk_ble_unpair_all() {
}; };
bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) { bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) {
zmk_key key = key_event->key; zmk_key_t key = key_event->key;
if (!auth_passkey_entry_conn) { if (!auth_passkey_entry_conn) {
return true; return true;

8
app/src/hid.c

@ -77,7 +77,7 @@ int zmk_hid_implicit_modifiers_release() {
return 0; return 0;
} }
int zmk_hid_keyboard_press(zmk_key code) { int zmk_hid_keyboard_press(zmk_key_t code) {
if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) { if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) {
return zmk_hid_register_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL); return zmk_hid_register_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL);
} }
@ -85,7 +85,7 @@ int zmk_hid_keyboard_press(zmk_key code) {
return 0; return 0;
}; };
int zmk_hid_keyboard_release(zmk_key code) { int zmk_hid_keyboard_release(zmk_key_t code) {
if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) { if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) {
return zmk_hid_unregister_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL); return zmk_hid_unregister_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL);
} }
@ -95,12 +95,12 @@ int zmk_hid_keyboard_release(zmk_key code) {
void zmk_hid_keyboard_clear() { memset(&keyboard_report.body, 0, sizeof(keyboard_report.body)); } void zmk_hid_keyboard_clear() { memset(&keyboard_report.body, 0, sizeof(keyboard_report.body)); }
int zmk_hid_consumer_press(zmk_key code) { int zmk_hid_consumer_press(zmk_key_t code) {
TOGGLE_CONSUMER(0U, code); TOGGLE_CONSUMER(0U, code);
return 0; return 0;
}; };
int zmk_hid_consumer_release(zmk_key code) { int zmk_hid_consumer_release(zmk_key_t code) {
TOGGLE_CONSUMER(code, 0U); TOGGLE_CONSUMER(code, 0U);
return 0; return 0;
}; };

Loading…
Cancel
Save