[Keyboard] Update default keymaps to use layer_state_t
(#7444)
* Update default keymaps to use `layer_state_t` * Convert binon32 as get_highest_layer in default keymaps
This commit is contained in:
parent
f0a9c10b6d
commit
6cf574396a
@ -133,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ void led_set_user(uint8_t usb_led) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
switch (biton32(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case 1:
|
case 1:
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
break;
|
break;
|
||||||
|
@ -85,7 +85,7 @@ void led_set_user(uint8_t usb_led) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,4 +163,3 @@ void matrix_init_user(void) {
|
|||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
|
return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +194,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
|
return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||||||
ergodox_right_led_2_off();
|
ergodox_right_led_2_off();
|
||||||
ergodox_right_led_3_off();
|
ergodox_right_led_3_off();
|
||||||
|
|
||||||
uint8_t layer = biton32(state);
|
uint8_t layer = get_highest_layer(state);
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case 0:
|
case 0:
|
||||||
#ifdef RGBLIGHT_COLOR_LAYER_0
|
#ifdef RGBLIGHT_COLOR_LAYER_0
|
||||||
|
@ -13,9 +13,9 @@ const uint16_t PROGMEM fn_actions[] = {
|
|||||||
[1] = TT(1)
|
[1] = TT(1)
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
|
||||||
uint8_t layer = biton32(state);
|
uint8_t layer = get_highest_layer(state);
|
||||||
|
|
||||||
ergodox_led_all_off();
|
ergodox_led_all_off();
|
||||||
ergodox_board_led_1_off();
|
ergodox_board_led_1_off();
|
||||||
|
@ -155,7 +155,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,4 +267,3 @@ void matrix_init_user(void) {
|
|||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ layer_state_t layer_state_set_user(layer_state_t state)
|
|||||||
{
|
{
|
||||||
turn_off_leds();
|
turn_off_leds();
|
||||||
|
|
||||||
switch (biton32(state))
|
switch (get_highest_layer(state))
|
||||||
{
|
{
|
||||||
case NORMAL_LAYER:
|
case NORMAL_LAYER:
|
||||||
break;
|
break;
|
||||||
|
@ -50,8 +50,8 @@ KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9,
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Layer based ilumination, just binary */
|
/* Layer based ilumination, just binary */
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
switch (biton32(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case _FNONE:
|
case _FNONE:
|
||||||
palSetPad(GPIOA, 0); //OFF Color A
|
palSetPad(GPIOA, 0); //OFF Color A
|
||||||
palClearPad(GPIOA, 1); //ON Color B
|
palClearPad(GPIOA, 1); //ON Color B
|
||||||
|
@ -74,7 +74,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,9 +78,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
#ifdef JOTANCK_LEDS
|
#ifdef JOTANCK_LEDS
|
||||||
switch (biton32(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case _LOWER:
|
case _LOWER:
|
||||||
writePinHigh(JOTANCK_LED1);
|
writePinHigh(JOTANCK_LED1);
|
||||||
writePinLow(JOTANCK_LED2);
|
writePinLow(JOTANCK_LED2);
|
||||||
|
@ -132,9 +132,9 @@ void led_set_user(uint8_t usb_led) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function for layer indicator LED
|
//function for layer indicator LED
|
||||||
uint32_t layer_state_set_user(uint32_t state)
|
layer_state_t layer_state_set_user(layer_state_t state)
|
||||||
{
|
{
|
||||||
if (biton32(state) == 2) {
|
if (get_highest_layer(state) == 2) {
|
||||||
writePinHigh(C6);
|
writePinHigh(C6);
|
||||||
} else {
|
} else {
|
||||||
writePinLow(C6);
|
writePinLow(C6);
|
||||||
|
@ -986,7 +986,7 @@ void process_doublespace(bool pressed, bool *isactive, bool *otheractive, bool *
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t layer_state_set_kb(uint32_t state)
|
layer_state_t layer_state_set_user(layer_state_t state)
|
||||||
{
|
{
|
||||||
// turn on punc layer if both fun & num are on
|
// turn on punc layer if both fun & num are on
|
||||||
if ((state & ((1UL<<_NUM) | (1UL<<_FUN))) == ((1UL<<_NUM) | (1UL<<_FUN))) {
|
if ((state & ((1UL<<_NUM) | (1UL<<_FUN))) == ((1UL<<_NUM) | (1UL<<_FUN))) {
|
||||||
|
@ -99,6 +99,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
float tone_qwerty[][2] = TONE_QWERTY;
|
float tone_qwerty[][2] = TONE_QWERTY;
|
||||||
float tone_numpad[][2] = TONE_NUMPAD;
|
float tone_numpad[][2] = TONE_NUMPAD;
|
||||||
|
|
||||||
uint32_t default_layer_state_set_kb(uint32_t state) {
|
layer_state_t default_layer_state_set_kb(layer_state_t state) {
|
||||||
if (state == 1UL<<_QWERTY) {
|
if (state == 1UL<<_QWERTY) {
|
||||||
PLAY_SONG(tone_qwerty);
|
PLAY_SONG(tone_qwerty);
|
||||||
} else if (state == 1UL<<_NUMPAD) {
|
} else if (state == 1UL<<_NUMPAD) {
|
||||||
|
@ -75,9 +75,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state)
|
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)
|
switch(layer)
|
||||||
{
|
{
|
||||||
case DF:
|
case DF:
|
||||||
|
@ -99,6 +99,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,9 @@ if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
switch (biton32(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case _LOWER:
|
case _LOWER:
|
||||||
rgblight_sethsv_noeeprom(HSV_GREEN);
|
rgblight_sethsv_noeeprom(HSV_GREEN);
|
||||||
break;
|
break;
|
||||||
|
@ -133,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +115,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ void rgb_matrix_indicators_user(void) {
|
|||||||
}
|
}
|
||||||
#else /* no RGB matrix support */
|
#else /* no RGB matrix support */
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
if (state & (1<<NUM)) {
|
if (state & (1<<NUM)) {
|
||||||
set_numpad_colours(1, &set_led_to);
|
set_numpad_colours(1, &set_led_to);
|
||||||
} else {
|
} else {
|
||||||
|
@ -171,7 +171,7 @@ enum layers {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ void eeconfig_init_user(void) { // EEPROM is getting reset!
|
|||||||
eeconfig_update_user(led_config.raw);
|
eeconfig_update_user(led_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,9 +83,9 @@ void led_set_user(uint8_t usb_led) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function for layer indicator LED
|
//function for layer indicator LED
|
||||||
uint32_t layer_state_set_user(uint32_t state)
|
layer_state_t layer_state_set_user(layer_state_t state)
|
||||||
{
|
{
|
||||||
if (biton32(state) == 1) {
|
if (get_highest_layer(state) == 1) {
|
||||||
writePinHigh(B3);
|
writePinHigh(B3);
|
||||||
} else {
|
} else {
|
||||||
writePinLow(B3);
|
writePinLow(B3);
|
||||||
|
@ -61,7 +61,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ void keyboard_post_init_user(void) {
|
|||||||
rgblight_sethsv_noeeprom_white();
|
rgblight_sethsv_noeeprom_white();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
switch (biton32(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case _LAYER1:
|
case _LAYER1:
|
||||||
rgblight_sethsv_noeeprom_cyan();
|
rgblight_sethsv_noeeprom_cyan();
|
||||||
break;
|
break;
|
||||||
|
@ -59,10 +59,10 @@ void keyboard_post_init_user(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
// This code switches underglow color by active layer, if the user has enabled the feature
|
// This code switches underglow color by active layer, if the user has enabled the feature
|
||||||
if(user_config.layer_rgb) {
|
if(user_config.layer_rgb) {
|
||||||
switch (biton32(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case _BL:
|
case _BL:
|
||||||
rgblight_sethsv_noeeprom(0,10,255);
|
rgblight_sethsv_noeeprom(0,10,255);
|
||||||
rgblight_mode_noeeprom(1);
|
rgblight_mode_noeeprom(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user