2020-09-10 13:57:44 +10:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
|
2020-05-11 07:13:24 +10:00
|
|
|
#pragma once
|
2020-05-02 13:37:37 +10:00
|
|
|
|
2020-12-21 01:49:42 +11:00
|
|
|
#include <zmk/events/position_state_changed.h>
|
|
|
|
|
2020-12-20 04:37:12 +11:00
|
|
|
typedef uint32_t zmk_keymap_layers_state_t;
|
2020-12-10 01:35:57 +11:00
|
|
|
|
2020-12-03 03:41:57 +11:00
|
|
|
uint8_t zmk_keymap_layer_default();
|
2020-12-20 04:37:12 +11:00
|
|
|
zmk_keymap_layers_state_t zmk_keymap_layer_state();
|
2020-12-03 03:41:57 +11:00
|
|
|
bool zmk_keymap_layer_active(uint8_t layer);
|
|
|
|
uint8_t zmk_keymap_highest_layer_active();
|
|
|
|
int zmk_keymap_layer_activate(uint8_t layer);
|
|
|
|
int zmk_keymap_layer_deactivate(uint8_t layer);
|
|
|
|
int zmk_keymap_layer_toggle(uint8_t layer);
|
2020-12-30 03:57:49 +11:00
|
|
|
int zmk_keymap_layer_to(uint8_t layer);
|
2020-12-29 16:19:25 +11:00
|
|
|
const char *zmk_keymap_layer_label(uint8_t layer);
|
2020-05-02 13:37:37 +10:00
|
|
|
|
2022-01-02 15:55:30 +11:00
|
|
|
int zmk_keymap_position_state_changed(uint8_t source, uint32_t position, bool pressed,
|
|
|
|
int64_t timestamp);
|
2020-12-13 06:31:42 +11:00
|
|
|
|
2020-12-13 06:32:20 +11:00
|
|
|
#define ZMK_KEYMAP_EXTRACT_BINDING(idx, drv_inst) \
|
2020-12-13 06:31:42 +11:00
|
|
|
{ \
|
|
|
|
.behavior_dev = DT_LABEL(DT_PHANDLE_BY_IDX(drv_inst, bindings, idx)), \
|
|
|
|
.param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param1), (0), \
|
|
|
|
(DT_PHA_BY_IDX(drv_inst, bindings, idx, param1))), \
|
|
|
|
.param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param2), (0), \
|
|
|
|
(DT_PHA_BY_IDX(drv_inst, bindings, idx, param2))), \
|
|
|
|
}
|