Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default layer size 16-bit #15286

Merged
merged 13 commits into from
Jun 18, 2022
Prev Previous commit
Next Next commit
Update all old layer state code
  • Loading branch information
drashna committed Mar 16, 2022
commit a86a5f54d74f479539aefb33b984ce5f85ad3d16
2 changes: 1 addition & 1 deletion keyboards/biacco42/ergo42/keymaps/hdbx/keymap.c
Original file line number Diff line number Diff line change
@@ -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;
}

2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/edvorakjp/keymap.c
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ 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)) {
case L_EDVORAKJP_LOWER:
2 changes: 1 addition & 1 deletion keyboards/ergodox_ez/keymaps/pvinis/keymap.c
Original file line number Diff line number Diff line change
@@ -245,7 +245,7 @@ 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();
2 changes: 1 addition & 1 deletion keyboards/ergodox_ez/keymaps/rishka/keymap.c
Original file line number Diff line number Diff line change
@@ -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();
2 changes: 1 addition & 1 deletion keyboards/handwired/promethium/keymaps/priyadi/keymap.c
Original file line number Diff line number Diff line change
@@ -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))) {
2 changes: 1 addition & 1 deletion keyboards/helix/pico/keymaps/mtei/keymap.c
Original file line number Diff line number Diff line change
@@ -268,7 +268,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;
2 changes: 1 addition & 1 deletion keyboards/helix/rev2/keymaps/edvorakjp/keymap.c
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
// 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)) {
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
case L_EDVORAKJP_LOWER:
2 changes: 1 addition & 1 deletion keyboards/helix/rev2/keymaps/five_rows/keymap.c
Original file line number Diff line number Diff line change
@@ -354,7 +354,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

int current_default_layer;

uint32_t default_layer_state_set_user(uint32_t state) {
layer_state_t default_layer_state_set_user(layer_state_t state) {
current_default_layer = biton32(state);
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
return state;
}
2 changes: 1 addition & 1 deletion keyboards/helix/rev3_5rows/keymaps/five_rows/keymap.c
Original file line number Diff line number Diff line change
@@ -362,7 +362,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

int current_default_layer;

uint32_t default_layer_state_set_user(uint32_t state) {
layer_state_t default_layer_state_set_user(layer_state_t state) {
current_default_layer = biton32(state);
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
return state;
}
2 changes: 1 addition & 1 deletion keyboards/keebio/iris/keymaps/edvorakjp/keymap.c
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_init_keymap() {}

#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)) {
case L_EDVORAKJP_LOWER:
2 changes: 1 addition & 1 deletion keyboards/keebio/levinson/keymaps/issmirnov/rgb.h
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
void keyboard_post_init_rgb(void);

// If rgb enabled, set underglow for layer
uint32_t layer_state_set_rgb(uint32_t state);
layer_state_t layer_state_set_rgb(layer_state_t state);

// Enhance matrix scan code. Note: keep this light, since it runs every 100ms
void matrix_scan_rgb(void);
2 changes: 1 addition & 1 deletion keyboards/kprepublic/cospad/keymaps/detrus/keymap.c
Original file line number Diff line number Diff line change
@@ -289,7 +289,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}

// Makes the tri-layer
uint32_t default_layer_state_set_kb(uint32_t state) {
layer_state_t default_layer_state_set_kb(layer_state_t state) {
switch (biton32(state)) {
case _QWERTY_LAYER:
state = update_tri_layer_state(state, _RAISE_LAYER, _QWERTZ_LOWER_LAYER, _ALTER_LAYER);
2 changes: 1 addition & 1 deletion keyboards/lets_split/keymaps/bbaserdem/keymap.c
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
void matrix_init_keymap (void) {
}

uint32_t layer_state_set_keymap(uint32_t state) {
layer_state_t layer_state_set_keymap(layer_state_t state) {
return state;
}

Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
void matrix_init_keymap (void) {
}

uint32_t layer_state_set_keymap(uint32_t state) {
layer_state_t layer_state_set_keymap(layer_state_t state) {
return state;
}

Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
void matrix_init_keymap (void) {
}

uint32_t layer_state_set_keymap(uint32_t state) {
layer_state_t layer_state_set_keymap(layer_state_t state) {

return state;
}

4 changes: 2 additions & 2 deletions keyboards/mitosis/keymaps/datagrok/keymap.c
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ const size_t defaultlayers_n = sizeof(defaultlayers) / sizeof(defaultlayers[0]);
// New keycode KC_LAYO rotates between available default layers (for e.g.,
// selecting a base layout). Shift+KC_LAYO makes the current one persistent.
bool process_record_layout(uint16_t keycode, keyrecord_t *record) {
uint32_t default_layer;
uint8_t default_layer;
uint8_t i;
#if defined(AUDIO_ENABLE)
float saved_song[][2] = SONG(COIN_SOUND);
@@ -121,7 +121,7 @@ bool process_record_layout(uint16_t keycode, keyrecord_t *record) {
} else {
// rotate default layer.
// find the current default layer
default_layer = biton32(default_layer_state);
default_layer = get_highest_layer(default_layer_state);
// find next valid default layer
for (i = 1; i < defaultlayers_n; i++) {
if (defaultlayers[(default_layer + i) % defaultlayers_n]) {
2 changes: 1 addition & 1 deletion keyboards/pearl/keymaps/cijanzen/keymap.c
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/**
* Status LED layer indicators courtesy of jetpacktuxedo's firmware
*/
uint32_t layer_state_set_kb(uint32_t state)
layer_state_t layer_state_set_kb(layer_state_t state)
{
if (state & (1<<1)) { // if we are on layer 1
PORTD |= (1 << PD0); // light num lock led
2 changes: 1 addition & 1 deletion keyboards/pearl/keymaps/jetpacktuxedo/keymap.c
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};

uint32_t layer_state_set_kb(uint32_t state) {
layer_state_t layer_state_set_kb(layer_state_t state) {
// if we are on layer 1
if (state & (1<<1)){
// light num lock led
2 changes: 1 addition & 1 deletion keyboards/pearl/keymaps/phil/keymap.c
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};

uint32_t layer_state_set_kb(uint32_t state) {
layer_state_t layer_state_set_kb(layer_state_t state) {
if (state & (1<<QWERTY)){
PORTD &= ~(1 << PD0);
} else {
2 changes: 1 addition & 1 deletion keyboards/pearl/keymaps/rask/keymap.c
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/**
* Status LED layer indicators courtesy of jetpacktuxedo's firmware
*/
uint32_t layer_state_set_kb(uint32_t state)
layer_state_t layer_state_set_kb(layer_state_t state)
{
// if we are on layer 1
if (state & (1<<1)){
2 changes: 1 addition & 1 deletion keyboards/percent/canoe/keymaps/dhertz/keymap.c
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ void keyboard_post_init_user(void) {
rgblight_sethsv_teal();
}

uint32_t layer_state_set_keymap(uint32_t state) {
layer_state_t layer_state_set_keymap(layer_state_t state) {
switch (biton32(state)) {
case 1:
rgblight_sethsv_noeeprom_magenta();
2 changes: 1 addition & 1 deletion keyboards/phoenix/phoenix.c
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ void manipulate_led(uint32_t led, bool on) {
}


layer_state_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);

uint8_t layer = get_highest_layer(state);
2 changes: 1 addition & 1 deletion users/333fred/333fred.c
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ void tap_dance_process_keycode(uint16_t keycode) {
}

__attribute__ ((weak))
void layer_state_set_rgb(uint32_t state) {}
void layer_state_set_rgb(layer_state_t state) {}

layer_state_t layer_state_set_user(layer_state_t state) {
layer_state_set_rgb(state);
2 changes: 1 addition & 1 deletion users/333fred/rgb.c
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
#include "quantum.h"
#include "333fred.h"

void layer_state_set_rgb(uint32_t state) {
void layer_state_set_rgb(layer_state_t state) {
switch (biton32(state)) {
case BASE:
// purple
2 changes: 1 addition & 1 deletion users/bbaserdem/bbaserdem.c
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ __attribute__ ((weak)) void matrix_scan_keymap(void) { }
__attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) {
__attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) { }
2 changes: 1 addition & 1 deletion users/billypython/billypython.c
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}

__attribute__((weak))
uint32_t layer_state_set_keymap(uint32_t state) {
layer_state_t layer_state_set_keymap(layer_state_t state) {
return state;
}

2 changes: 1 addition & 1 deletion users/billypython/billypython.h
Original file line number Diff line number Diff line change
@@ -31,4 +31,4 @@ enum layers_user {
};

bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
uint32_t layer_state_set_keymap(uint32_t state);
layer_state_t layer_state_set_keymap(layer_state_t state);
3 changes: 1 addition & 2 deletions users/dhertz/dhertz.c
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
__attribute__ ((weak))
@@ -98,4 +98,3 @@ layer_state_t layer_state_set_user (layer_state_t state) {
void led_set_user(uint8_t usb_led) {
led_set_keymap(usb_led);
}

2 changes: 1 addition & 1 deletion users/edvorakjp/edvorakjp.c
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return layer_state_set_keymap(state);
}

__attribute__((weak)) uint32_t layer_state_set_keymap(uint32_t state) { return state; }
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool process_record_user_result = process_record_keymap(keycode, record) && process_record_edvorakjp_swap_scln(keycode, record) && process_record_edvorakjp_config(keycode, record) && process_record_layer(keycode, record) && process_record_ime(keycode, record);
2 changes: 1 addition & 1 deletion users/edvorakjp/edvorakjp.h
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ enum tap_dance_code {
void matrix_init_user(void);
void matrix_init_keymap(void);
layer_state_t layer_state_set_user(layer_state_t state);
uint32_t layer_state_set_keymap(uint32_t state);
layer_state_t layer_state_set_keymap(layer_state_t state);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);

2 changes: 1 addition & 1 deletion users/ericgebhart/ericgebhart.c
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ __attribute__ ((weak))
void matrix_scan_keymap(void) {}

__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}

6 changes: 3 additions & 3 deletions users/kuchosauronad0/kuchosauronad0.c
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ void matrix_scan_user(void){
}

__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}

@@ -133,12 +133,12 @@ layer_state_t layer_state_set_user(layer_state_t state) {


__attribute__ ((weak))
uint32_t default_layer_state_set_keymap (uint32_t state) {
layer_state_t default_layer_state_set_keymap (layer_state_t state) {
return state;
}

// Runs state check and changes underglow color and animation
uint32_t default_layer_state_set_user(uint32_t state) {
layer_state_t default_layer_state_set_user(layer_state_t state) {
state = default_layer_state_set_keymap(state);
#if 0
#ifdef RGBLIGHT_ENABLE
4 changes: 2 additions & 2 deletions users/kuchosauronad0/kuchosauronad0.h
Original file line number Diff line number Diff line change
@@ -65,8 +65,8 @@ void shutdown_keymap(void);
void suspend_power_down_keymap(void);
void suspend_wakeup_init_keymap(void);
void matrix_scan_keymap(void);
uint32_t layer_state_set_keymap (uint32_t state);
uint32_t default_layer_state_set_keymap (uint32_t state);
layer_state_t layer_state_set_keymap (layer_state_t state);
layer_state_t default_layer_state_set_keymap (layer_state_t state);
void led_set_keymap(uint8_t usb_led);
void eeconfig_init_keymap(void);

4 changes: 2 additions & 2 deletions users/kuchosauronad0/template.c
Original file line number Diff line number Diff line change
@@ -63,11 +63,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {


__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}

uint32_t layer_state_set_user (uint32_t state) {
layer_state_t layer_state_set_user (layer_state_t state) {
return layer_state_set_keymap (state);
}

2 changes: 1 addition & 1 deletion users/pvinis/pvinis.c
Original file line number Diff line number Diff line change
@@ -95,4 +95,4 @@ void keyboard_post_init_user(void) {
// Default functions.
__attribute__((weak)) void keyboard_post_init_user_keymap(void) {}

__attribute__((weak)) uint32_t layer_state_set_user_keymap(uint32_t state) { return state; }
__attribute__((weak)) layer_state_t layer_state_set_user_keymap(layer_state_t state) { return state; }
2 changes: 1 addition & 1 deletion users/pvinis/pvinis.h
Original file line number Diff line number Diff line change
@@ -169,4 +169,4 @@ enum {

// Extra stuff that might be needed.
void keyboard_post_init_user_keymap(void);
uint32_t layer_state_set_user_keymap(uint32_t state);
layer_state_t layer_state_set_user_keymap(layer_state_t state);
2 changes: 1 addition & 1 deletion users/romus/romus.c
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ __attribute__ ((weak)) void matrix_scan_keymap(void) { }
__attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
__attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) {
__attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) { }
4 changes: 2 additions & 2 deletions users/sigma/sigma.c
Original file line number Diff line number Diff line change
@@ -49,12 +49,12 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {


__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}

__attribute__ ((weak))
uint32_t default_layer_state_set_keymap (uint32_t state) {
layer_state_t default_layer_state_set_keymap (layer_state_t state) {
return state;
}

2 changes: 1 addition & 1 deletion users/talljoe/talljoe.c
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ void matrix_init_user(void) {
}
}

uint32_t default_layer_state_set_kb(uint32_t state) {
layer_state_t default_layer_state_set_kb(layer_state_t state) {
// persist changes to default layers
eeconfig_update_default_layer(state);
return state;
Loading