Make default layer size 16-bit (#15286)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
This commit is contained in:
parent
cfcd647b2e
commit
0da6562c4d
|
@ -240,7 +240,7 @@ void suspend_wakeup_init_user(void) {
|
|||
|
||||
```c
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _RAISE:
|
||||
rgblight_setrgb (0x00, 0x00, 0xFF);
|
||||
break;
|
||||
|
@ -267,7 +267,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
|
||||
### `layer_state_set_*` 函数文档
|
||||
|
||||
* 键盘/各子版本:`uint32_t layer_state_set_kb(uint32_t state)`
|
||||
* 键盘/各子版本:`layer_state_t layer_state_set_kb(layer_state_t state)`
|
||||
* 布局: `layer_state_t layer_state_set_user(layer_state_t state)`
|
||||
|
||||
|
||||
|
@ -325,7 +325,7 @@ void keyboard_post_init_user(void) {
|
|||
|
||||
```c
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _RAISE:
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
|
||||
break;
|
||||
|
@ -474,4 +474,3 @@ cancel_deferred_exec(my_token);
|
|||
```c
|
||||
#define MAX_DEFERRED_EXECUTORS 16
|
||||
```
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ void matrix_scan_user(void) {
|
|||
}
|
||||
}
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _TAPLAND:
|
||||
rgblight_setrgb(0, 16, 0); //green
|
||||
break;
|
||||
|
|
|
@ -105,7 +105,7 @@ void matrix_scan_user(void) {
|
|||
#ifdef RGBLIGHT_ENABLE
|
||||
|
||||
static uint8_t old_layer = 255;
|
||||
uint8_t new_layer = biton32(layer_state);
|
||||
uint8_t new_layer = get_highest_layer(layer_state);
|
||||
|
||||
// Color of the Icons.
|
||||
if (old_layer != new_layer) {
|
||||
|
|
|
@ -128,10 +128,10 @@ void tap_dance_choose_layer_reset (qk_tap_dance_state_t *state, void *user_data)
|
|||
layer_off(_RAISE);
|
||||
break;
|
||||
case 3:
|
||||
if (biton32(default_layer_state) == _DVORAK) {
|
||||
if (get_highest_layer(default_layer_state) == _DVORAK) {
|
||||
set_single_persistent_default_layer(_QWERTY);
|
||||
}
|
||||
else if (biton32(default_layer_state) == _QWERTY) {
|
||||
else if (get_highest_layer(default_layer_state) == _QWERTY) {
|
||||
set_single_persistent_default_layer(_DVORAK);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -180,7 +180,7 @@ void keyboard_post_init_user(void) {
|
|||
#ifdef RGB_MATRIX_ENABLE
|
||||
void rgb_matrix_indicators_user(void) {
|
||||
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
switch (layer) {
|
||||
case _CLOSE:
|
||||
// rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy.
|
||||
|
|
|
@ -118,7 +118,7 @@ void keyboard_post_init_user(void) {
|
|||
#ifdef RGB_MATRIX_ENABLE
|
||||
void rgb_matrix_indicators_user(void) {
|
||||
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
switch (layer) {
|
||||
case _CLOSE:
|
||||
// rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy.
|
||||
|
|
|
@ -134,7 +134,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
// RGB Underglow使用時のレイヤー毎のカラー切り替え
|
||||
uint32_t layer_state_set_keymap (uint32_t state) {
|
||||
layer_state_t layer_state_set_keymap (layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ void matrix_init_user(void) {
|
|||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _RAISE:
|
||||
rgblight_setrgb_chartreuse(); // RAISE:シャルトリューズ
|
||||
break;
|
||||
|
|
|
@ -89,7 +89,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer;
|
||||
layer = biton32(layer_state);
|
||||
layer = get_highest_layer(layer_state);
|
||||
|
||||
if (current_layer_global != layer) {
|
||||
current_layer_global = layer;
|
||||
|
@ -132,7 +132,7 @@ void tap_helper(keyrecord_t *record, uint16_t orig_mod, uint16_t macro_mod, uint
|
|||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
uint8_t layer;
|
||||
layer = biton32(layer_state);
|
||||
layer = get_highest_layer(layer_state);
|
||||
if (layer == PROG2) {
|
||||
if (keycode >= KC_A && keycode <= KC_EXSEL && \
|
||||
!( // do not send LSFT + these keycodes, they are needed for emulating the US layout
|
||||
|
|
|
@ -77,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_scan_user(void)
|
||||
{
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
switch (layer) {
|
||||
case KM_BLOWRAK:
|
||||
ph_caps_led_on();
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
uint8_t layer = 0;
|
||||
|
||||
uint32_t layer_state_set_kb(uint32_t state) {
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
state = layer_state_set_user(state);
|
||||
layer = biton32(state);
|
||||
layer = get_highest_layer(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|||
uint16_t mapped_code = 0;
|
||||
if (index == 0) {
|
||||
if (clockwise) {
|
||||
switch(layer){
|
||||
switch (layer) {
|
||||
case 0:
|
||||
default:
|
||||
mapped_code = KC_VOLU;
|
||||
|
@ -29,7 +29,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
switch(layer){
|
||||
switch (layer) {
|
||||
case 0:
|
||||
default:
|
||||
mapped_code = KC_VOLD;
|
||||
|
@ -44,7 +44,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|||
}
|
||||
uint16_t held_keycode_timer = timer_read();
|
||||
register_code(mapped_code);
|
||||
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){ /* no-op */ }
|
||||
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY) { /* no-op */
|
||||
}
|
||||
unregister_code(mapped_code);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -240,7 +240,7 @@ void read_host_led_state(void) {
|
|||
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
state = layer_state_set_user(state);
|
||||
layer = biton32(state);
|
||||
layer = get_highest_layer(state);
|
||||
oled_request_wakeup();
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _BASE:
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
|
@ -62,7 +62,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
bool oled_task_user(void) {
|
||||
// Host Keyboard Layer Status
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _BASE:
|
||||
oled_write_P(PSTR("Default\n"), false);
|
||||
break;
|
||||
|
|
|
@ -199,7 +199,7 @@ void matrix_scan_user(void) {
|
|||
|
||||
if (!rgblight_config.enable || rgblight_config.mode != 1) { return; }
|
||||
|
||||
uint32_t layer = layer_state;
|
||||
layer_state_t layer = layer_state;
|
||||
uint8_t val = rgblight_config.val;
|
||||
|
||||
if (layer & (1<<_FL)) {
|
||||
|
|
|
@ -84,7 +84,7 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
|||
|
||||
const char *read_logo(void);
|
||||
bool oled_task_user(void){
|
||||
switch (biton32(layer_state)){
|
||||
switch (get_highest_layer(layer_state)){
|
||||
case _DVORAK:
|
||||
oled_write_ln_P(PSTR("DVRK"), false);
|
||||
break;
|
||||
|
|
|
@ -54,9 +54,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// clang-format on
|
||||
|
||||
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state) {
|
||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case L_EDVORAKJP_LOWER:
|
||||
rgblight_sethsv_noeeprom_red();
|
||||
break;
|
||||
|
|
|
@ -9,7 +9,7 @@ void render_layer_state(void) {
|
|||
char layer_name[17];
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case L_EDVORAKJP_BASE:
|
||||
oled_write_ln_P(PSTR("Default"), false);
|
||||
break;
|
||||
|
|
|
@ -84,7 +84,7 @@ const char *read_keylogs(void);
|
|||
char matrix_line_str[24];
|
||||
|
||||
const char *read_layer_state(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
strcpy(matrix_line_str, "Layer: ");
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ report_mouse_t currentReport = {};
|
|||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
//uint8_t layer;
|
||||
//layer = biton32(layer_state); // get the current layer //Or don't, I didn't use it.
|
||||
//layer = get_highest_layer(layer_state); // get the current layer //Or don't, I didn't use it.
|
||||
bool returnVal = true; //this is to determine if more key processing is needed.
|
||||
|
||||
//custom layer handling for tri_layer,
|
||||
|
@ -437,7 +437,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
};
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
//uint8_t layer = biton32(layer_state);
|
||||
//uint8_t layer = get_highest_layer(layer_state);
|
||||
for (uint8_t i = 0; i<LONGPRESS_COUNT; i++){
|
||||
if ((timer_elapsed(special_timers[i]) >= CUSTOM_LONGPRESS) && (!special_key_states[i]) && special_key_pressed[i]){
|
||||
switch (i + SAFE_RANGE){
|
||||
|
|
|
@ -129,7 +129,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_laye
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
switch (layer) {
|
||||
case _LOWER:
|
||||
|
|
|
@ -175,7 +175,7 @@ void matrix_scan_user(void) {
|
|||
#ifdef RGBLIGHT_ENABLE
|
||||
|
||||
static uint8_t old_layer = 1;
|
||||
uint8_t new_layer = biton32(layer_state);
|
||||
uint8_t new_layer = get_highest_layer(layer_state);
|
||||
|
||||
if (old_layer != new_layer) {
|
||||
switch (new_layer) {
|
||||
|
|
|
@ -11,7 +11,7 @@ static int16_t fnTimer = 0;
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
switch (biton32(state))
|
||||
switch (get_highest_layer(state))
|
||||
{
|
||||
case QWERTY:
|
||||
rgblight_mode(9);
|
||||
|
|
|
@ -73,7 +73,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
static uint32_t last_state = 0;
|
||||
|
||||
if(last_state != state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _CMD:
|
||||
user_led_on();
|
||||
break;
|
||||
|
@ -85,5 +85,3 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ void rgb_matrix_indicators_user(void)
|
|||
uint8_t this_led = host_keyboard_leds();
|
||||
|
||||
if (!g_suspend_state && rgb_matrix_config.enable) {
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _NAV:
|
||||
if (this_led & (1 << USB_LED_NUM_LOCK)) {
|
||||
rgb_matrix_set_color(13, 0xFF, 0x00, 0x00);
|
||||
|
|
|
@ -62,7 +62,7 @@ void rgb_matrix_indicators_user(void)
|
|||
uint8_t this_led = host_keyboard_leds();
|
||||
|
||||
if (!g_suspend_state && rgb_matrix_config.enable) {
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _LAYER1:
|
||||
rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break;
|
||||
|
||||
|
@ -78,7 +78,7 @@ void rgb_matrix_indicators_user(void)
|
|||
rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _LAYER3:
|
||||
if (this_led & (1 << USB_LED_NUM_LOCK)) {
|
||||
rgb_matrix_set_color(13, 0xFF, 0x00, 0x00);
|
||||
|
|
|
@ -37,7 +37,7 @@ void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) {
|
|||
void rgb_matrix_indicators_user(void)
|
||||
{
|
||||
if (!g_suspend_state) {
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _QWERTY:
|
||||
rgb_matrix_layer_helper(0x00, 0x0F, 0xFF); break;
|
||||
|
||||
|
@ -46,7 +46,7 @@ void rgb_matrix_indicators_user(void)
|
|||
}
|
||||
}
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _FNM:
|
||||
rgb_matrix_set_color(0, 0x00, 0xFF, 0x00);
|
||||
rgb_matrix_set_color(1, 0x00, 0x00, 0x00);
|
||||
|
|
|
@ -238,5 +238,5 @@ void rgb_matrix_indicators_user(void) {
|
|||
}
|
||||
|
||||
// Show Selected Layer
|
||||
rgb_matrix_set_color(layers_leds_map[biton32(layer_state)], MAIN_COLOR[0], MAIN_COLOR[1], MAIN_COLOR[2]);
|
||||
rgb_matrix_set_color(layers_leds_map[get_highest_layer(layer_state)], MAIN_COLOR[0], MAIN_COLOR[1], MAIN_COLOR[2]);
|
||||
}
|
|
@ -174,7 +174,7 @@ void rgb_matrix_indicators_user(void) {
|
|||
}
|
||||
}
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _FN:
|
||||
/* Dynamic Macro LED indicator */
|
||||
if (isRecording) {
|
||||
|
|
|
@ -91,7 +91,7 @@ void rgb_matrix_indicators_user(void)
|
|||
uint8_t this_led = host_keyboard_leds();
|
||||
|
||||
if (!g_suspend_state && rgb_matrix_config.enable) {
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _NAV:
|
||||
if (IS_LED_ON(this_led, USB_LED_NUM_LOCK)) {
|
||||
rgb_matrix_set_color(17, 0xFF, 0x00, 0x00);
|
||||
|
|
|
@ -190,7 +190,7 @@ static bool is_macro1_recording = false;
|
|||
// The current set of active layers (as a bitmask).
|
||||
// There is a global 'layer_state' variable but it is set after the call
|
||||
// to layer_state_set_user().
|
||||
static uint32_t current_layer_state = 0;
|
||||
static layer_state_t current_layer_state = 0;
|
||||
layer_state_t layer_state_set_user(layer_state_t state);
|
||||
|
||||
// Method called at the end of the tap dance on the TAP_MACRO key. That key is
|
||||
|
|
|
@ -200,7 +200,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
@ -262,4 +262,3 @@ void matrix_scan_user(void) {
|
|||
// }
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ static bool is_macro1_recording = false;
|
|||
// The current set of active layers (as a bitmask).
|
||||
// There is a global 'layer_state' variable but it is set after the call
|
||||
// to layer_state_set_user().
|
||||
static uint32_t current_layer_state = 0;
|
||||
static layer_state_t current_layer_state = 0;
|
||||
layer_state_t layer_state_set_user(layer_state_t state);
|
||||
|
||||
// Method called at the end of the tap dance on the TAP_MACRO key. That key is
|
||||
|
|
|
@ -141,7 +141,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -725,7 +725,7 @@ void led_set_user(uint8_t usb_led) {
|
|||
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_2_off();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
uint8_t layer = biton32(state);
|
||||
uint8_t layer = get_highest_layer(state);
|
||||
|
||||
switch (layer) {
|
||||
case DVORAK:
|
||||
|
|
|
@ -370,7 +370,7 @@ LEADER_EXTERNS();
|
|||
void matrix_scan_user(void)
|
||||
{
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
|
||||
((get_oneshot_mods() & MOD_BIT(KC_LSFT)) &&
|
||||
|
|
|
@ -284,7 +284,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -813,7 +813,7 @@ case RU_7:
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
|
||||
uint8_t layer = biton32(state);
|
||||
uint8_t layer = get_highest_layer(state);
|
||||
|
||||
// ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -218,7 +218,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
uint8_t layer = biton32(state);
|
||||
uint8_t layer = get_highest_layer(state);
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
|
@ -431,4 +431,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1057,7 +1057,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
uint8_t layer = biton32(state);
|
||||
uint8_t layer = get_highest_layer(state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -157,7 +157,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -245,11 +245,11 @@ void keyboard_post_init_user_keymap(void) {
|
|||
}
|
||||
|
||||
// light up leds based on the layer
|
||||
uint32_t layer_state_set_user_keymap(uint32_t state) {
|
||||
layer_state_t layer_state_set_user_keymap(layer_state_t state) {
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case LR_SYSCTL:
|
||||
ergodox_right_led_3_on(); // blue
|
||||
break;
|
||||
|
@ -306,7 +306,7 @@ uint32_t layer_state_set_user_keymap(uint32_t state) {
|
|||
|
||||
// SYSCTL on first tap, MOUSE ON second tap
|
||||
// void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
// uint8_t layer = biton32(layer_state);
|
||||
// uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
// switch(state->count) {
|
||||
// case 1:
|
||||
|
|
|
@ -228,7 +228,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case SYMB:
|
||||
ergodox_right_led_1_on();
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); }
|
||||
|
@ -268,4 +268,3 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void keyboard_post_init_user(void) {
|
|||
};
|
||||
|
||||
// Runs whenever there is a layer state change.
|
||||
uint32_t layer_state_set_user(layer_state_t state) {
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
|
|
|
@ -228,7 +228,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -139,7 +139,7 @@ void matrix_init_user(void) {
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
if(layer == 1)
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -62,7 +62,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -330,7 +330,7 @@ void matrix_init_user(void) {
|
|||
};
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -27,29 +27,34 @@ PY2 = sys.version_info.major == 2
|
|||
if PY2:
|
||||
chr = unichr
|
||||
|
||||
|
||||
KEYBOARD_LAYOUTS = {
|
||||
# These map positions in the parsed layout to
|
||||
# positions in the KEYMAP MATRIX
|
||||
'ergodox_ez': [
|
||||
[ 0, 1, 2, 3, 4, 5, 6], [38, 39, 40, 41, 42, 43, 44],
|
||||
[ 7, 8, 9, 10, 11, 12, 13], [45, 46, 47, 48, 49, 50, 51],
|
||||
[14, 15, 16, 17, 18, 19 ], [ 52, 53, 54, 55, 56, 57],
|
||||
[20, 21, 22, 23, 24, 25, 26], [58, 59, 60, 61, 62, 63, 64],
|
||||
[27, 28, 29, 30, 31 ], [ 65, 66, 67, 68, 69],
|
||||
[ 32, 33], [70, 71 ],
|
||||
[ 34], [72 ],
|
||||
[ 35, 36, 37], [73, 74, 75 ],
|
||||
[0, 1, 2, 3, 4, 5, 6],
|
||||
[38, 39, 40, 41, 42, 43, 44],
|
||||
[7, 8, 9, 10, 11, 12, 13],
|
||||
[45, 46, 47, 48, 49, 50, 51],
|
||||
[14, 15, 16, 17, 18, 19],
|
||||
[52, 53, 54, 55, 56, 57],
|
||||
[20, 21, 22, 23, 24, 25, 26],
|
||||
[58, 59, 60, 61, 62, 63, 64],
|
||||
[27, 28, 29, 30, 31],
|
||||
[65, 66, 67, 68, 69],
|
||||
[32, 33],
|
||||
[70, 71],
|
||||
[34],
|
||||
[72],
|
||||
[35, 36, 37],
|
||||
[73, 74, 75],
|
||||
]
|
||||
}
|
||||
|
||||
ROW_INDENTS = {
|
||||
'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]
|
||||
}
|
||||
ROW_INDENTS = {'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]}
|
||||
|
||||
BLANK_LAYOUTS = [
|
||||
# Compact Layout
|
||||
"""
|
||||
# Compact Layout
|
||||
"""
|
||||
.------------------------------------.------------------------------------.
|
||||
| | | | | | | | | | | | | | |
|
||||
!-----+----+----+----+----+----------!-----+----+----+----+----+----+-----!
|
||||
|
@ -70,8 +75,8 @@ BLANK_LAYOUTS = [
|
|||
'-----------------' '-----------------'
|
||||
""",
|
||||
|
||||
# Wide Layout
|
||||
"""
|
||||
# Wide Layout
|
||||
"""
|
||||
.---------------------------------------------. .---------------------------------------------.
|
||||
| | | | | | | | ! | | | | | | |
|
||||
!-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
|
||||
|
@ -93,26 +98,22 @@ BLANK_LAYOUTS = [
|
|||
""",
|
||||
]
|
||||
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
"keymaps_includes": [
|
||||
"keymap_common.h",
|
||||
],
|
||||
"keymaps_includes": ["keymap_common.h",],
|
||||
'filler': "-+.'!:x",
|
||||
'separator': "|",
|
||||
'default_key_prefix': ["KC_"],
|
||||
}
|
||||
|
||||
|
||||
SECTIONS = [
|
||||
'layout_config',
|
||||
'layers',
|
||||
]
|
||||
|
||||
|
||||
# Markdown Parsing
|
||||
|
||||
ONELINE_COMMENT_RE = re.compile(r"""
|
||||
ONELINE_COMMENT_RE = re.compile(
|
||||
r"""
|
||||
^ # comment must be at the start of the line
|
||||
\s* # arbitrary whitespace
|
||||
// # start of the comment
|
||||
|
@ -121,22 +122,26 @@ ONELINE_COMMENT_RE = re.compile(r"""
|
|||
""", re.MULTILINE | re.VERBOSE
|
||||
)
|
||||
|
||||
INLINE_COMMENT_RE = re.compile(r"""
|
||||
INLINE_COMMENT_RE = re.compile(
|
||||
r"""
|
||||
([\,\"\[\]\{\}\d]) # anythig that might end a expression
|
||||
\s+ # comment must be preceded by whitespace
|
||||
// # start of the comment
|
||||
\s # and succeded by whitespace
|
||||
(?:[^\"\]\}\{\[]*) # the comment (except things which might be json)
|
||||
$ # until the end of line
|
||||
""", re.MULTILINE | re.VERBOSE)
|
||||
""", re.MULTILINE | re.VERBOSE
|
||||
)
|
||||
|
||||
TRAILING_COMMA_RE = re.compile(r"""
|
||||
TRAILING_COMMA_RE = re.compile(
|
||||
r"""
|
||||
, # the comma
|
||||
(?:\s*) # arbitrary whitespace
|
||||
$ # only works if the trailing comma is followed by newline
|
||||
(\s*) # arbitrary whitespace
|
||||
([\]\}]) # end of an array or object
|
||||
""", re.MULTILINE | re.VERBOSE)
|
||||
""", re.MULTILINE | re.VERBOSE
|
||||
)
|
||||
|
||||
|
||||
def loads(raw_data):
|
||||
|
@ -178,9 +183,7 @@ def parse_config(path):
|
|||
def end_section():
|
||||
if section['start_line'] >= 0:
|
||||
if section['name'] == 'layout_config':
|
||||
config.update(loads("\n".join(
|
||||
section['code_lines']
|
||||
)))
|
||||
config.update(loads("\n".join(section['code_lines'])))
|
||||
elif section['sub_name'].startswith('layer'):
|
||||
layer_name = section['sub_name']
|
||||
config['layer_lines'][layer_name] = section['code_lines']
|
||||
|
@ -215,6 +218,7 @@ def parse_config(path):
|
|||
assert 'layout' in config
|
||||
return config
|
||||
|
||||
|
||||
# header file parsing
|
||||
|
||||
IF0_RE = re.compile(r"""
|
||||
|
@ -224,7 +228,6 @@ IF0_RE = re.compile(r"""
|
|||
#endif
|
||||
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
|
||||
|
||||
|
||||
COMMENT_RE = re.compile(r"""
|
||||
/\*
|
||||
.*?
|
||||
|
@ -244,6 +247,7 @@ def regex_partial(re_str_fmt, flags):
|
|||
def partial(*args, **kwargs):
|
||||
re_str = re_str_fmt.format(*args, **kwargs)
|
||||
return re.compile(re_str, flags)
|
||||
|
||||
return partial
|
||||
|
||||
|
||||
|
@ -256,7 +260,6 @@ KEYDEF_REP = regex_partial(r"""
|
|||
) # capture group end
|
||||
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
|
||||
|
||||
|
||||
ENUM_RE = re.compile(r"""
|
||||
(
|
||||
enum
|
||||
|
@ -268,7 +271,6 @@ ENUM_RE = re.compile(r"""
|
|||
) # capture group end
|
||||
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
|
||||
|
||||
|
||||
ENUM_KEY_REP = regex_partial(r"""
|
||||
(
|
||||
{} # the prefixes
|
||||
|
@ -309,14 +311,13 @@ def parse_valid_keys(config, out_path):
|
|||
include_path = os.path.join(dirpath, include)
|
||||
if os.path.exists(include_path):
|
||||
header_data = read_header_file(include_path)
|
||||
valid_keycodes.update(
|
||||
parse_keydefs(config, header_data)
|
||||
)
|
||||
valid_keycodes.update(parse_keydefs(config, header_data))
|
||||
return valid_keycodes
|
||||
|
||||
|
||||
# Keymap Parsing
|
||||
|
||||
|
||||
def iter_raw_codes(layer_lines, filler, separator):
|
||||
filler_re = re.compile("[" + filler + " ]")
|
||||
for line in layer_lines:
|
||||
|
@ -346,28 +347,21 @@ LAYER_CHANGE_RE = re.compile(r"""
|
|||
(DF|TG|MO)\(\d+\)
|
||||
""", re.VERBOSE)
|
||||
|
||||
|
||||
MACRO_RE = re.compile(r"""
|
||||
M\(\w+\)
|
||||
""", re.VERBOSE)
|
||||
|
||||
|
||||
UNICODE_RE = re.compile(r"""
|
||||
U[0-9A-F]{4}
|
||||
""", re.VERBOSE)
|
||||
|
||||
|
||||
NON_CODE = re.compile(r"""
|
||||
^[^A-Z0-9_]$
|
||||
""", re.VERBOSE)
|
||||
|
||||
|
||||
def parse_uni_code(raw_code):
|
||||
macro_id = "UC_" + (
|
||||
unicodedata.name(raw_code)
|
||||
.replace(" ", "_")
|
||||
.replace("-", "_")
|
||||
)
|
||||
macro_id = "UC_" + (unicodedata.name(raw_code).replace(" ", "_").replace("-", "_"))
|
||||
code = "M({})".format(macro_id)
|
||||
uc_hex = "{:04X}".format(ord(raw_code))
|
||||
return code, macro_id, uc_hex
|
||||
|
@ -407,19 +401,13 @@ def parse_code(raw_code, key_prefixes, valid_keycodes):
|
|||
|
||||
def parse_keymap(config, key_indexes, layer_lines, valid_keycodes):
|
||||
keymap = {}
|
||||
raw_codes = list(iter_raw_codes(
|
||||
layer_lines, config['filler'], config['separator']
|
||||
))
|
||||
raw_codes = list(iter_raw_codes(layer_lines, config['filler'], config['separator']))
|
||||
indexed_codes = iter_indexed_codes(raw_codes, key_indexes)
|
||||
key_prefixes = config['key_prefixes']
|
||||
for raw_code, key_index, row_index in indexed_codes:
|
||||
code, macro_id, uc_hex = parse_code(
|
||||
raw_code, key_prefixes, valid_keycodes
|
||||
)
|
||||
code, macro_id, uc_hex = parse_code(raw_code, key_prefixes, valid_keycodes)
|
||||
# TODO: line numbers for invalid codes
|
||||
err_msg = "Could not parse key '{}' on row {}".format(
|
||||
raw_code, row_index
|
||||
)
|
||||
err_msg = "Could not parse key '{}' on row {}".format(raw_code, row_index)
|
||||
assert code is not None, err_msg
|
||||
# print(repr(raw_code), repr(code), macro_id, uc_hex)
|
||||
if macro_id:
|
||||
|
@ -432,17 +420,14 @@ def parse_keymap(config, key_indexes, layer_lines, valid_keycodes):
|
|||
|
||||
def parse_keymaps(config, valid_keycodes):
|
||||
keymaps = collections.OrderedDict()
|
||||
key_indexes = config.get(
|
||||
'key_indexes', KEYBOARD_LAYOUTS[config['layout']]
|
||||
)
|
||||
key_indexes = config.get('key_indexes', KEYBOARD_LAYOUTS[config['layout']])
|
||||
# TODO: maybe validate key_indexes
|
||||
|
||||
for layer_name, layer_lines, in config['layer_lines'].items():
|
||||
keymaps[layer_name] = parse_keymap(
|
||||
config, key_indexes, layer_lines, valid_keycodes
|
||||
)
|
||||
keymaps[layer_name] = parse_keymap(config, key_indexes, layer_lines, valid_keycodes)
|
||||
return keymaps
|
||||
|
||||
|
||||
# keymap.c output
|
||||
|
||||
USERCODE = """
|
||||
|
@ -453,7 +438,7 @@ void matrix_init_user(void) {
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
@ -572,7 +557,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {{
|
|||
}};
|
||||
"""
|
||||
|
||||
|
||||
UNICODE_MACRO_TEMPLATE = """
|
||||
case {macro_id}:
|
||||
unicode_action_function(0x{hi:02x}, 0x{lo:02x});
|
||||
|
@ -584,9 +568,7 @@ def unicode_macro_cases(config):
|
|||
for macro_id, uc_hex in config['unicode_macros'].items():
|
||||
hi = int(uc_hex, 16) >> 8
|
||||
lo = int(uc_hex, 16) & 0xFF
|
||||
yield UNICODE_MACRO_TEMPLATE.format(
|
||||
macro_id=macro_id, hi=hi, lo=lo
|
||||
)
|
||||
yield UNICODE_MACRO_TEMPLATE.format(macro_id=macro_id, hi=hi, lo=lo)
|
||||
|
||||
|
||||
def iter_keymap_lines(keymap, row_indents=None):
|
||||
|
|
|
@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
uint8_t layer = biton32(state);
|
||||
uint8_t layer = get_highest_layer(state);
|
||||
switch (layer) {
|
||||
case BASE:
|
||||
rgblight_sethsv(HSV_ERGOSLAB_ORANGE);
|
||||
|
|
|
@ -102,7 +102,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||
edit = false;
|
||||
}
|
||||
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _ADJUST:
|
||||
temp_config.mode = rgblight_get_mode();
|
||||
rgblight_mode_noeeprom(1);
|
||||
|
|
|
@ -121,7 +121,7 @@ layer_state_t layer_state_set_user(layer_state_t state)
|
|||
edit = false;
|
||||
}
|
||||
|
||||
switch (biton32(state))
|
||||
switch (get_highest_layer(state))
|
||||
{
|
||||
case _ADJUST:
|
||||
mode = rgblight_get_mode();
|
||||
|
|
|
@ -146,8 +146,8 @@ void matrix_init_user(void) {
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
//uint8_t layer = biton32(layer_state);
|
||||
biton32(layer_state);
|
||||
//uint8_t layer = get_highest_layer(layer_state);
|
||||
get_highest_layer(layer_state);
|
||||
};
|
||||
|
||||
|
||||
|
@ -171,4 +171,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint32_t layer = layer_state;
|
||||
layer_state_t layer = layer_state;
|
||||
|
||||
if (layer & (1<<1)) {
|
||||
gh60_fn_led_on();
|
||||
|
|
|
@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
void matrix_scan_user(void) {
|
||||
|
||||
//Layer LED indicators
|
||||
uint32_t layer = layer_state;
|
||||
layer_state_t layer = layer_state;
|
||||
|
||||
if (layer & (1<<1)) {
|
||||
gh60_wasd_leds_on();
|
||||
|
|
|
@ -97,7 +97,7 @@ void matrix_scan_user(void) {
|
|||
|
||||
// Layer LED indicators
|
||||
// ESC led on when in function layer, WASD cluster leds enabled when on arrow cluster
|
||||
uint32_t layer = layer_state;
|
||||
layer_state_t layer = layer_state;
|
||||
if (layer & (1<<1)) {
|
||||
gh60_wasd_leds_on();
|
||||
} else {
|
||||
|
|
|
@ -177,7 +177,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
if (old_layer != layer) {
|
||||
switch (layer) {
|
||||
|
|
|
@ -131,7 +131,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
};
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
switch (layer) {
|
||||
case _QWERTY:
|
||||
|
|
|
@ -158,7 +158,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
switch (layer) {
|
||||
case _QWERTY:
|
||||
|
|
|
@ -151,7 +151,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
switch (layer) {
|
||||
case _QWERTY:
|
||||
|
|
|
@ -241,7 +241,7 @@ void matrix_scan_user(void) {
|
|||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _BL:
|
||||
custom_backlight_level(0);
|
||||
break;
|
||||
|
|
|
@ -209,7 +209,7 @@ void press_underscore(void) {
|
|||
uint8_t old_layer=_BASE;
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
frenchdev_led_1_off();
|
||||
frenchdev_led_2_off();
|
||||
|
|
|
@ -89,7 +89,7 @@ void matrix_init_user(void) {
|
|||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
if (layer) {
|
||||
PORTC |= _BV(PC7);
|
||||
} else {
|
||||
|
|
|
@ -87,7 +87,7 @@ void led_set_user(uint8_t usb_led) {
|
|||
//function for layer indicator LED
|
||||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
if (biton32(state) == 1) {
|
||||
if (get_highest_layer(state) == 1) {
|
||||
writePinHigh(C6);
|
||||
} else {
|
||||
writePinLow(C6);
|
||||
|
|
|
@ -529,7 +529,7 @@ void led_reset(void) {
|
|||
}
|
||||
|
||||
void led_set_default_layer_indicator(void) {
|
||||
uint8_t default_layer = biton32(default_layer_state);
|
||||
uint8_t default_layer = get_highest_layer(default_layer_state);
|
||||
if (default_layer == _QWERTY) {
|
||||
rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY);
|
||||
rgbsps_set(LED_IND_ALT, COLOR_BLANK);
|
||||
|
@ -553,7 +553,7 @@ void led_set_layer_indicator(void) {
|
|||
rgbsps_set(LED_IND_GREEK, COLOR_BLANK);
|
||||
rgbsps_set(LED_IND_EMOJI, COLOR_BLANK);
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
if (oldlayer == layer) {
|
||||
return;
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
|
||||
rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
|
||||
layer = biton32(layer_state);
|
||||
layer = get_highest_layer(layer_state);
|
||||
|
||||
#ifdef DOUBLESPACE_LAYER_ENABLE
|
||||
// double-space: send space immediately if any other key depressed before space is released
|
||||
|
|
|
@ -532,7 +532,7 @@ void led_reset(void) {
|
|||
}
|
||||
|
||||
void led_set_default_layer_indicator(void) {
|
||||
uint8_t default_layer = biton32(default_layer_state);
|
||||
uint8_t default_layer = get_highest_layer(default_layer_state);
|
||||
if (default_layer == _QWERTY) {
|
||||
rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY);
|
||||
rgbsps_set(LED_IND_ALT, COLOR_BLANK);
|
||||
|
@ -556,7 +556,7 @@ void led_set_layer_indicator(void) {
|
|||
rgbsps_set(LED_IND_GREEK, COLOR_BLANK);
|
||||
rgbsps_set(LED_IND_EMOJI, COLOR_BLANK);
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
if (oldlayer == layer) {
|
||||
return;
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ void process_doublespace(bool pressed, bool *isactive, bool *otheractive, bool *
|
|||
}
|
||||
#endif
|
||||
|
||||
uint32_t layer_state_set_kb(uint32_t state)
|
||||
layer_state_t layer_state_set_kb(layer_state_t state)
|
||||
{
|
||||
// turn on punc layer if both fun & num are on
|
||||
if ((state & ((1UL<<_NUM) | (1UL<<_FUN))) == ((1UL<<_NUM) | (1UL<<_FUN))) {
|
||||
|
@ -1017,7 +1017,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
|
||||
rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
|
||||
layer = biton32(layer_state);
|
||||
layer = get_highest_layer(layer_state);
|
||||
|
||||
#ifdef DOUBLESPACE_LAYER_ENABLE
|
||||
// double-space: send space immediately if any other key depressed before space is released
|
||||
|
|
|
@ -219,7 +219,7 @@ void LayerLEDSet(uint8_t layr) {
|
|||
uint8_t old_layer = _QW;
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
if (old_layer != layer) {
|
||||
LayerLEDSet(layer);
|
||||
|
|
|
@ -9,7 +9,7 @@ void keyboard_pre_init_user(void)
|
|||
layer_state_t layer_state_set_user(layer_state_t state)
|
||||
{
|
||||
// Switch layer LED accordingly
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case 0:
|
||||
writePinHigh(B0);
|
||||
break;
|
||||
|
|
|
@ -242,7 +242,7 @@ float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
|||
|
||||
static int current_default_layer;
|
||||
|
||||
uint32_t default_layer_state_set_kb(uint32_t state) {
|
||||
layer_state_t default_layer_state_set_kb(layer_state_t state) {
|
||||
// 1<<_QWERTY - 1 == 1 - 1 == _QWERTY (=0)
|
||||
// 1<<_COLEMAK - 1 == 2 - 1 == _COLEMAK (=1)
|
||||
current_default_layer = state - 1;
|
||||
|
|
|
@ -86,7 +86,7 @@ static void render_layer_status(void) {
|
|||
break;
|
||||
default:
|
||||
oled_write_P(PSTR("Undef-"), false);
|
||||
snprintf(buf,sizeof(buf), "%ld", layer_state);
|
||||
snprintf(buf,sizeof(buf), "%u", layer_state);
|
||||
oled_write(buf, false);
|
||||
}
|
||||
oled_write_P(PSTR("\n"), false);
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
// keymaps definitions are moved to keymap_Xrows.c.
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state) {
|
||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case L_EDVORAKJP_LOWER:
|
||||
rgblight_sethsv_noeeprom_red();
|
||||
break;
|
||||
|
|
|
@ -19,7 +19,7 @@ void render_layer_state(void) {
|
|||
char layer_name[17];
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case L_EDVORAKJP_BASE:
|
||||
oled_write_ln_P(PSTR("Default"), false);
|
||||
break;
|
||||
|
|
|
@ -379,8 +379,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
int current_default_layer;
|
||||
|
||||
uint32_t default_layer_state_set_user(uint32_t state) {
|
||||
current_default_layer = biton32(state);
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
current_default_layer = get_highest_layer(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,8 +379,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
int current_default_layer;
|
||||
|
||||
uint32_t default_layer_state_set_user(uint32_t state) {
|
||||
current_default_layer = biton32(state);
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
current_default_layer = get_highest_layer(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ void matrix_scan_user(void) {
|
|||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _BL:
|
||||
custom_backlight_level(0);
|
||||
rgblight_sethsv_noeeprom(180,100,255);
|
||||
|
|
|
@ -163,7 +163,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
|
|
|
@ -170,7 +170,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -189,7 +189,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -167,7 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -335,7 +335,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_on();
|
||||
ergodox_led_all_on();
|
||||
|
|
|
@ -492,7 +492,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -223,7 +223,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -659,7 +659,7 @@ void matrix_setup(void) {
|
|||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
// uint8_t layer = biton32(layer_state);
|
||||
// uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
// ergodox_board_led_off();
|
||||
// ergodox_right_led_1_off();
|
||||
|
|
|
@ -221,7 +221,7 @@ void matrix_init_user(void){
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -179,7 +179,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -309,7 +309,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -137,7 +137,7 @@ void matrix_init_user(void) {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -239,7 +239,7 @@ void matrix_scan_user(void) {
|
|||
//Turn on layer indicator or page depending on mode
|
||||
switch(led_mode_global) {
|
||||
case MODE_FLASH: //flash preset page leds then single indicator
|
||||
page = biton32(layer_state) > max_pages ? 7 : biton32(layer_state);
|
||||
page = get_highest_layer(layer_state) > max_pages ? 7 : get_highest_layer(layer_state);
|
||||
msg=(page << 8) | DISPLAY_PAGE;
|
||||
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
|
||||
chThdSleepMilliseconds(500);
|
||||
|
@ -254,7 +254,7 @@ void matrix_scan_user(void) {
|
|||
break;
|
||||
|
||||
case MODE_PAGE: //display pre-defined led page
|
||||
page = biton32(layer_state) > max_pages ? 7 : biton32(layer_state);
|
||||
page = get_highest_layer(layer_state) > max_pages ? 7 : get_highest_layer(layer_state);
|
||||
msg=(page << 8) | DISPLAY_PAGE;
|
||||
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
|
||||
break;
|
||||
|
|
|
@ -224,7 +224,7 @@ void matrix_scan_user(void) {
|
|||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _BL:
|
||||
custom_backlight_level(0);
|
||||
rgblight_sethsv_noeeprom(180,100,255);
|
||||
|
|
|
@ -253,7 +253,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
}
|
||||
}
|
||||
if (index == 1) { /* Second encoder, Left side */
|
||||
switch(biton32(layer_state)) {
|
||||
switch(get_highest_layer(layer_state)) {
|
||||
case _LOWER:
|
||||
if (clockwise) {
|
||||
rgblight_decrease_hue();
|
||||
|
|
|
@ -255,7 +255,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
}
|
||||
}
|
||||
if (index == 1) { /* Second encoder, Left side */
|
||||
switch(biton32(layer_state)) {
|
||||
switch(get_highest_layer(layer_state)) {
|
||||
case _LOWER:
|
||||
if (clockwise) {
|
||||
rgblight_decrease_hue();
|
||||
|
|
|
@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
#ifdef OLED_ENABLE
|
||||
bool oled_task_user(void) {
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case BASE:
|
||||
oled_write_P(PSTR("Default\n"), false);
|
||||
break;
|
||||
|
|
|
@ -175,7 +175,7 @@ void matrix_scan_user(void) {
|
|||
#ifdef OLED_ENABLE
|
||||
bool oled_task_user(void) {
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case BASE:
|
||||
oled_write_P(PSTR("Default\n"), false);
|
||||
break;
|
||||
|
|
|
@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
#ifdef OLED_ENABLE
|
||||
bool oled_task_user(void) {
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case BASE:
|
||||
oled_write_P(PSTR("Default\n"), false);
|
||||
break;
|
||||
|
|
|
@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
#ifdef OLED_ENABLE
|
||||
bool oled_task_user(void) {
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case BASE:
|
||||
oled_write_P(PSTR("Default\n"), false);
|
||||
break;
|
||||
|
|
|
@ -38,7 +38,7 @@ void eeconfig_init_user(void) {
|
|||
#define DE_UDIA_CAP UC(0x00DC)
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case NM_MODE:
|
||||
rgblight_setrgb (0x00, 0x66, 0x00);
|
||||
break;
|
||||
|
@ -187,4 +187,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case WINDOWS_LAYER:
|
||||
rgblight_setrgb_blue();
|
||||
break;
|
||||
|
|
|
@ -293,7 +293,7 @@ void rgbflag(uint8_t r, uint8_t g, uint8_t b) {
|
|||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
// if(rgblight_get_mode() == 1) {
|
||||
switch (biton32(state)) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _QWERTY:
|
||||
if(!workmode){
|
||||
rgblight_mode(9);
|
||||
|
|
|
@ -187,7 +187,7 @@ void rgbflag(uint8_t r, uint8_t g, uint8_t b, uint8_t rr, uint8_t gg, uint8_t bb
|
|||
|
||||
void set_state_leds(void) {
|
||||
if (rgblight_get_mode() == 1) {
|
||||
switch (biton32(layer_state)) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _RAISE:
|
||||
rgbflag(C_BLU, C_GRN);
|
||||
break;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue