Skip to content

Commit

Permalink
refactor(app): replace zmk_mod with zmk_mod_t
Browse files Browse the repository at this point in the history
Aligns with typedef _t convention.

PR: zmkfirmware#531
  • Loading branch information
innovaker authored and petejohanson committed Dec 28, 2020
1 parent 8717969 commit 05b0d18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/include/zmk/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ struct zmk_hid_consumer_report {
struct zmk_hid_consumer_report_body body;
} __packed;

int zmk_hid_register_mod(zmk_mod modifier);
int zmk_hid_unregister_mod(zmk_mod modifier);
int zmk_hid_register_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_release();
int zmk_hid_keyboard_press(zmk_key_t key);
Expand Down
2 changes: 1 addition & 1 deletion app/include/zmk/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <dt-bindings/zmk/keys.h>

typedef uint32_t zmk_key_t;
typedef uint8_t zmk_mod;
typedef uint8_t zmk_mod_t;
typedef uint8_t zmk_mod_flags;

struct zmk_key_event {
Expand Down
4 changes: 2 additions & 2 deletions app/src/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ static zmk_mod_flags explicit_modifiers = 0;
LOG_DBG("Modifiers set to 0x%02X", keyboard_report.body.modifiers); \
}

int zmk_hid_register_mod(zmk_mod modifier) {
int zmk_hid_register_mod(zmk_mod_t modifier) {
explicit_modifier_counts[modifier]++;
LOG_DBG("Modifier %d count %d", modifier, explicit_modifier_counts[modifier]);
WRITE_BIT(explicit_modifiers, modifier, true);
SET_MODIFIERS(explicit_modifiers);
return 0;
}

int zmk_hid_unregister_mod(zmk_mod modifier) {
int zmk_hid_unregister_mod(zmk_mod_t modifier) {
if (explicit_modifier_counts[modifier] <= 0) {
LOG_ERR("Tried to unregister modifier %d too often", modifier);
return -EINVAL;
Expand Down

0 comments on commit 05b0d18

Please sign in to comment.