refactor(app): replace zmk_keymap_layers_state with zmk_keymap_layers_state_t
Aligns with typedef _t convention. PR: #531
This commit is contained in:
parent
87e7c04b00
commit
0e71dbc860
2 changed files with 5 additions and 5 deletions
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
typedef uint32_t zmk_keymap_layers_state;
|
typedef uint32_t zmk_keymap_layers_state_t;
|
||||||
|
|
||||||
uint8_t zmk_keymap_layer_default();
|
uint8_t zmk_keymap_layer_default();
|
||||||
zmk_keymap_layers_state zmk_keymap_layer_state();
|
zmk_keymap_layers_state_t zmk_keymap_layer_state();
|
||||||
bool zmk_keymap_layer_active(uint8_t layer);
|
bool zmk_keymap_layer_active(uint8_t layer);
|
||||||
uint8_t zmk_keymap_highest_layer_active();
|
uint8_t zmk_keymap_highest_layer_active();
|
||||||
int zmk_keymap_layer_activate(uint8_t layer);
|
int zmk_keymap_layer_activate(uint8_t layer);
|
||||||
|
|
|
@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
#include <zmk/events/layer_state_changed.h>
|
#include <zmk/events/layer_state_changed.h>
|
||||||
#include <zmk/events/sensor_event.h>
|
#include <zmk/events/sensor_event.h>
|
||||||
|
|
||||||
static zmk_keymap_layers_state _zmk_keymap_layer_state = 0;
|
static zmk_keymap_layers_state_t _zmk_keymap_layer_state = 0;
|
||||||
static uint8_t _zmk_keymap_layer_default = 0;
|
static uint8_t _zmk_keymap_layer_default = 0;
|
||||||
|
|
||||||
#define DT_DRV_COMPAT zmk_keymap
|
#define DT_DRV_COMPAT zmk_keymap
|
||||||
|
@ -88,7 +88,7 @@ static inline int set_layer_state(uint8_t layer, bool state) {
|
||||||
|
|
||||||
uint8_t zmk_keymap_layer_default() { return _zmk_keymap_layer_default; }
|
uint8_t zmk_keymap_layer_default() { return _zmk_keymap_layer_default; }
|
||||||
|
|
||||||
zmk_keymap_layers_state zmk_keymap_layer_state() { return _zmk_keymap_layer_state; }
|
zmk_keymap_layers_state_t zmk_keymap_layer_state() { return _zmk_keymap_layer_state; }
|
||||||
|
|
||||||
bool zmk_keymap_layer_active(uint8_t layer) {
|
bool zmk_keymap_layer_active(uint8_t layer) {
|
||||||
return (_zmk_keymap_layer_state & (BIT(layer))) == (BIT(layer));
|
return (_zmk_keymap_layer_state & (BIT(layer))) == (BIT(layer));
|
||||||
|
@ -115,7 +115,7 @@ int zmk_keymap_layer_toggle(uint8_t layer) {
|
||||||
return zmk_keymap_layer_activate(layer);
|
return zmk_keymap_layer_activate(layer);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool is_active_layer(uint8_t layer, zmk_keymap_layers_state layer_state) {
|
bool is_active_layer(uint8_t layer, zmk_keymap_layers_state_t layer_state) {
|
||||||
return (layer_state & BIT(layer)) == BIT(layer) || layer == _zmk_keymap_layer_default;
|
return (layer_state & BIT(layer)) == BIT(layer) || layer == _zmk_keymap_layer_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue