refactor(app): replace zmk_mod_flags with zmk_mod_flags_t
Aligns with typedef _t convention. PR: #531
This commit is contained in:
parent
05b0d185a8
commit
87e7c04b00
6 changed files with 10 additions and 10 deletions
|
@ -27,7 +27,7 @@ static inline struct keycode_state_changed *
|
||||||
keycode_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) {
|
keycode_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) {
|
||||||
uint16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
|
uint16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
|
||||||
uint16_t id = HID_USAGE_ID(encoded);
|
uint16_t id = HID_USAGE_ID(encoded);
|
||||||
zmk_mod_flags implicit_mods = SELECT_MODS(encoded);
|
zmk_mod_flags_t implicit_mods = SELECT_MODS(encoded);
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
page = HID_USAGE_KEY;
|
page = HID_USAGE_KEY;
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
struct modifiers_state_changed {
|
struct modifiers_state_changed {
|
||||||
struct zmk_event_header header;
|
struct zmk_event_header header;
|
||||||
zmk_mod_flags modifiers;
|
zmk_mod_flags_t modifiers;
|
||||||
bool state;
|
bool state;
|
||||||
};
|
};
|
||||||
|
|
||||||
ZMK_EVENT_DECLARE(modifiers_state_changed);
|
ZMK_EVENT_DECLARE(modifiers_state_changed);
|
||||||
|
|
||||||
inline struct modifiers_state_changed *create_modifiers_state_changed(zmk_mod_flags modifiers,
|
inline struct modifiers_state_changed *create_modifiers_state_changed(zmk_mod_flags_t modifiers,
|
||||||
bool state) {
|
bool state) {
|
||||||
struct modifiers_state_changed *ev = new_modifiers_state_changed();
|
struct modifiers_state_changed *ev = new_modifiers_state_changed();
|
||||||
ev->modifiers = modifiers;
|
ev->modifiers = modifiers;
|
||||||
|
|
|
@ -147,7 +147,7 @@ static const uint8_t zmk_hid_report_desc[] = {
|
||||||
// } __packed;
|
// } __packed;
|
||||||
|
|
||||||
struct zmk_hid_keyboard_report_body {
|
struct zmk_hid_keyboard_report_body {
|
||||||
zmk_mod_flags modifiers;
|
zmk_mod_flags_t modifiers;
|
||||||
uint8_t _reserved;
|
uint8_t _reserved;
|
||||||
uint8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE];
|
uint8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
@ -168,7 +168,7 @@ struct zmk_hid_consumer_report {
|
||||||
|
|
||||||
int zmk_hid_register_mod(zmk_mod_t modifier);
|
int zmk_hid_register_mod(zmk_mod_t modifier);
|
||||||
int zmk_hid_unregister_mod(zmk_mod_t modifier);
|
int zmk_hid_unregister_mod(zmk_mod_t modifier);
|
||||||
int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers);
|
int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers);
|
||||||
int zmk_hid_implicit_modifiers_release();
|
int zmk_hid_implicit_modifiers_release();
|
||||||
int zmk_hid_keyboard_press(zmk_key_t key);
|
int zmk_hid_keyboard_press(zmk_key_t key);
|
||||||
int zmk_hid_keyboard_release(zmk_key_t key);
|
int zmk_hid_keyboard_release(zmk_key_t key);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
typedef uint32_t zmk_key_t;
|
typedef uint32_t zmk_key_t;
|
||||||
typedef uint8_t zmk_mod_t;
|
typedef uint8_t zmk_mod_t;
|
||||||
typedef uint8_t zmk_mod_flags;
|
typedef uint8_t zmk_mod_flags_t;
|
||||||
|
|
||||||
struct zmk_key_event {
|
struct zmk_key_event {
|
||||||
uint32_t column;
|
uint32_t column;
|
||||||
|
|
|
@ -18,7 +18,7 @@ static struct zmk_hid_consumer_report consumer_report = {.report_id = 2, .body =
|
||||||
// Keep track of how often a modifier was pressed.
|
// Keep track of how often a modifier was pressed.
|
||||||
// Only release the modifier if the count is 0.
|
// Only release the modifier if the count is 0.
|
||||||
static int explicit_modifier_counts[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
static int explicit_modifier_counts[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
static zmk_mod_flags explicit_modifiers = 0;
|
static zmk_mod_flags_t explicit_modifiers = 0;
|
||||||
|
|
||||||
#define SET_MODIFIERS(mods) \
|
#define SET_MODIFIERS(mods) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -67,7 +67,7 @@ int zmk_hid_unregister_mod(zmk_mod_t modifier) {
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers) {
|
int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers) {
|
||||||
SET_MODIFIERS(explicit_modifiers | implicit_modifiers);
|
SET_MODIFIERS(explicit_modifiers | implicit_modifiers);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
#include <zmk/endpoints.h>
|
#include <zmk/endpoints.h>
|
||||||
|
|
||||||
static int hid_listener_keycode_pressed(uint8_t usage_page, uint32_t keycode,
|
static int hid_listener_keycode_pressed(uint8_t usage_page, uint32_t keycode,
|
||||||
zmk_mod_flags implicit_modifiers) {
|
zmk_mod_flags_t implicit_modifiers) {
|
||||||
int err;
|
int err;
|
||||||
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
|
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
|
||||||
implicit_modifiers);
|
implicit_modifiers);
|
||||||
|
@ -42,7 +42,7 @@ static int hid_listener_keycode_pressed(uint8_t usage_page, uint32_t keycode,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hid_listener_keycode_released(uint8_t usage_page, uint32_t keycode,
|
static int hid_listener_keycode_released(uint8_t usage_page, uint32_t keycode,
|
||||||
zmk_mod_flags implicit_modifiers) {
|
zmk_mod_flags_t implicit_modifiers) {
|
||||||
int err;
|
int err;
|
||||||
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
|
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
|
||||||
implicit_modifiers);
|
implicit_modifiers);
|
||||||
|
|
Loading…
Reference in a new issue