Browse Source

feat(endpoints): simplify behavior constants

xmkb
Joel Spadin 4 years ago
parent
commit
440d09fd45
  1. 10
      app/include/dt-bindings/zmk/outputs.h
  2. 6
      app/src/behaviors/behavior_outputs.c

10
app/include/dt-bindings/zmk/outputs.h

@ -4,10 +4,6 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
#define OUTPUT_TOGGLE_CMD 0 #define OUT_TOG 0
#define OUTPUT_USB_CMD 1 #define OUT_USB 1
#define OUTPUT_BLE_CMD 2 #define OUT_BLE 2
#define OUT_TOG OUTPUT_TOGGLE_CMD
#define OUT_USB OUTPUT_USB_CMD
#define OUT_BLE OUTPUT_BLE_CMD

6
app/src/behaviors/behavior_outputs.c

@ -21,11 +21,11 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) { struct zmk_behavior_binding_event event) {
switch (binding->param1) { switch (binding->param1) {
case OUTPUT_TOGGLE_CMD: case OUT_TOG:
return zmk_endpoints_toggle(); return zmk_endpoints_toggle();
case OUTPUT_USB_CMD: case OUT_USB:
return zmk_endpoints_select(ZMK_ENDPOINT_USB); return zmk_endpoints_select(ZMK_ENDPOINT_USB);
case OUTPUT_BLE_CMD: case OUT_BLE:
return zmk_endpoints_select(ZMK_ENDPOINT_BLE); return zmk_endpoints_select(ZMK_ENDPOINT_BLE);
default: default:
LOG_ERR("Unknown output command: %d", binding->param1); LOG_ERR("Unknown output command: %d", binding->param1);

Loading…
Cancel
Save