Refactors for updated sources ; remove behavior_to config/data structs that are not used
This commit is contained in:
parent
a34ee6b191
commit
0af0f8e62f
3 changed files with 5 additions and 17 deletions
|
@ -11,7 +11,7 @@ typedef uint32_t zmk_keymap_layers_state_t;
|
|||
uint8_t zmk_keymap_layer_default();
|
||||
zmk_keymap_layers_state_t zmk_keymap_layer_state();
|
||||
bool zmk_keymap_layer_active(uint8_t layer);
|
||||
bool zmk_keymap_layer_active_with_state(uint8_t layer, zmk_keymap_layers_state state_to_test);
|
||||
bool zmk_keymap_layer_active_with_state(uint8_t layer, zmk_keymap_layers_state_t state_to_test);
|
||||
uint8_t zmk_keymap_highest_layer_active();
|
||||
int zmk_keymap_layer_activate(uint8_t layer);
|
||||
int zmk_keymap_layer_deactivate(uint8_t layer);
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
|
||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
struct behavior_to_config {};
|
||||
struct behavior_to_data {};
|
||||
|
||||
static int behavior_to_init(const struct device *dev) { return 0; };
|
||||
|
||||
static int to_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
|
@ -37,10 +34,6 @@ static const struct behavior_driver_api behavior_to_driver_api = {
|
|||
.binding_released = to_keymap_binding_released,
|
||||
};
|
||||
|
||||
static const struct behavior_to_config behavior_to_config = {};
|
||||
|
||||
static struct behavior_to_data behavior_to_data;
|
||||
|
||||
DEVICE_AND_API_INIT(behavior_to, DT_INST_LABEL(0), behavior_to_init, &behavior_to_data,
|
||||
&behavior_to_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
DEVICE_AND_API_INIT(behavior_to, DT_INST_LABEL(0), behavior_to_init, NULL,
|
||||
NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&behavior_to_driver_api);
|
||||
|
|
|
@ -88,7 +88,7 @@ static inline int set_layer_state(uint8_t layer, bool state) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
zmk_keymap_layers_state old_state = _zmk_keymap_layer_state;
|
||||
zmk_keymap_layers_state_t old_state = _zmk_keymap_layer_state;
|
||||
WRITE_BIT(_zmk_keymap_layer_state, layer, state);
|
||||
// Don't send state changes unless there was an actual change
|
||||
if (old_state != _zmk_keymap_layer_state) {
|
||||
|
@ -107,7 +107,7 @@ bool zmk_keymap_layer_active(uint8_t layer) {
|
|||
return zmk_keymap_layer_active_with_state(layer, _zmk_keymap_layer_state);
|
||||
};
|
||||
|
||||
bool zmk_keymap_layer_active_with_state(uint8_t layer, zmk_keymap_layers_state state_to_test) {
|
||||
bool zmk_keymap_layer_active_with_state(uint8_t layer, zmk_keymap_layers_state_t state_to_test) {
|
||||
// The default layer is assumed to be ALWAYS ACTIVE so we include an || here to ensure nobody
|
||||
// breaks up that assumption by accident
|
||||
return (state_to_test & (BIT(layer))) == (BIT(layer)) || layer == _zmk_keymap_layer_default;
|
||||
|
@ -134,10 +134,6 @@ int zmk_keymap_layer_toggle(uint8_t layer) {
|
|||
return zmk_keymap_layer_activate(layer);
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
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;
|
||||
=======
|
||||
int zmk_keymap_layer_to(uint8_t layer) {
|
||||
for (int i = MAX_LAYERS - 1; i >= 0; i--) {
|
||||
zmk_keymap_layer_deactivate(i);
|
||||
|
@ -146,7 +142,6 @@ int zmk_keymap_layer_to(uint8_t layer) {
|
|||
zmk_keymap_layer_activate(layer);
|
||||
|
||||
return 0;
|
||||
>>>>>>> Add TO() style key code ; toggles the specified layer ON and all others OFF
|
||||
}
|
||||
|
||||
int zmk_keymap_apply_position_state(int layer, uint32_t position, bool pressed, int64_t timestamp) {
|
||||
|
|
Loading…
Add table
Reference in a new issue