Skip to content

Instantly share code, notes, and snippets.

@mcrosson
Last active Dec 15, 2020
Embed
What would you like to do?
In file included from ../../src/behaviors/behavior_rgb_underglow.c:13:
../../src/behaviors/behavior_rgb_underglow.c: In function 'on_keymap_binding_pressed':
../../include/dt-bindings/zmk/rgb.h:20:29: error: expected ':' or '...' before numeric constant
20 | #define RGB_TOG RGB_TOG_CMD 0
| ^
../../src/behaviors/behavior_rgb_underglow.c:24:10: note: in expansion of macro 'RGB_TOG'
24 | case RGB_TOG:
| ^~~~~~~
compilation terminated due to -Wfatal-errors
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
switch (binding->param1) {
case BT_CLR_CMD:
return zmk_ble_clear_bonds();
case BT_NXT_CMD:
return zmk_ble_prof_next();
case BT_PRV_CMD:
return zmk_ble_prof_prev();
case BT_SEL_CMD:
return zmk_ble_prof_select(binding->param2);
default:
LOG_ERR("Unknown BT command: %d", binding->param1);
}
return -ENOTSUP;
}
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
switch (binding->param1) {
case RGB_TOG:
return zmk_rgb_underglow_toggle();
case RGB_HUI:
return zmk_rgb_underglow_change_hue(1);
case RGB_HUD:
return zmk_rgb_underglow_change_hue(-1);
case RGB_SAI:
return zmk_rgb_underglow_change_sat(1);
case RGB_SAD:
return zmk_rgb_underglow_change_sat(-1);
case RGB_BRI:
return zmk_rgb_underglow_change_brt(1);
case RGB_BRD:
return zmk_rgb_underglow_change_brt(-1);
case RGB_SPI:
return zmk_rgb_underglow_change_spd(1);
case RGB_SPD:
return zmk_rgb_underglow_change_spd(-1);
case RGB_EFF:
return zmk_rgb_underglow_cycle_effect(1);
case RGB_EFR:
return zmk_rgb_underglow_cycle_effect(-1);
}
return -ENOTSUP;
}
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
behaviors {
bt: behavior_bluetooth {
compatible = "zmk,behavior-bluetooth";
label = "BLUETOOTH";
#binding-cells = <2>;
};
};
};
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#define BT_CLR_CMD 0
#define BT_NXT_CMD 1
#define BT_PRV_CMD 2
#define BT_SEL_CMD 3
// #define BT_FULL_RESET_CMD 4
/*
Note: Some future commands will include additional parameters, so we
defines these aliases up front.
*/
#define BT_CLR BT_CLR_CMD 0
#define BT_NXT BT_NXT_CMD 0
#define BT_PRV BT_PRV_CMD 0
#define BT_SEL BT_SEL_CMD
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#define RGB_TOG_CMD 0
#define RGB_HUI_CMD 1
#define RGB_HUD_CMD 2
#define RGB_SAI_CMD 3
#define RGB_SAD_CMD 4
#define RGB_BRI_CMD 5
#define RGB_BRD_CMD 6
#define RGB_SPI_CMD 7
#define RGB_SPD_CMD 8
#define RGB_EFF_CMD 9
#define RGB_EFR_CMD 10
#define SET_HSV_CMD 11
#define RGB_TOG RGB_TOG_CMD 0
#define RGB_HUI RGB_HUI_CMD 0
#define RGB_HUD RGB_HUD_CMD 0
#define RGB_SAI RGB_SAI_CMD 0
#define RGB_SAD RGB_SAD_CMD 0
#define RGB_BRI RGB_BRI_CMD 0
#define RGB_BRD RGB_BRD_CMD 0
#define RGB_SPI RGB_SPI_CMD 0
#define RGB_SPD RGB_SPD_CMD 0
#define RGB_EFF RGB_EFF_CMD 0
#define RGB_EFR RGB_EFR_CMD 0
#define SET_HSV SET_HSV_CMD 0
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
behaviors {
rgb_ug: behavior_rgb_underglow {
compatible = "zmk,behavior-rgb-underglow";
label = "RGB_UNDERGLOW";
#binding-cells = <2>;
};
};
};
# Copyright (c) 2020, Peter Johanson
# SPDX-License-Identifier: MIT
description: Bluetooth Behavior
compatible: "zmk,behavior-bluetooth"
include: two_param.yaml
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: RGB Underglow Action
compatible: "zmk,behavior-rgb-underglow"
include: two_param.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment