Make default layer size 16-bit (#15286)

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
This commit is contained in:
Drashna Jaelre 2022-06-18 14:37:51 -07:00 committed by GitHub
parent cfcd647b2e
commit 0da6562c4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
293 changed files with 1249 additions and 1309 deletions

View file

@ -240,7 +240,7 @@ void suspend_wakeup_init_user(void) {
```c ```c
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _RAISE: case _RAISE:
rgblight_setrgb (0x00, 0x00, 0xFF); rgblight_setrgb (0x00, 0x00, 0xFF);
break; break;
@ -267,7 +267,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
### `layer_state_set_*` 函数文档 ### `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)` * 布局: `layer_state_t layer_state_set_user(layer_state_t state)`
@ -325,7 +325,7 @@ void keyboard_post_init_user(void) {
```c ```c
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _RAISE: case _RAISE:
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); } if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
break; break;
@ -474,4 +474,3 @@ cancel_deferred_exec(my_token);
```c ```c
#define MAX_DEFERRED_EXECUTORS 16 #define MAX_DEFERRED_EXECUTORS 16
``` ```

View file

@ -196,7 +196,7 @@ void matrix_scan_user(void) {
} }
} }
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _TAPLAND: case _TAPLAND:
rgblight_setrgb(0, 16, 0); //green rgblight_setrgb(0, 16, 0); //green
break; break;

View file

@ -105,7 +105,7 @@ void matrix_scan_user(void) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
static uint8_t old_layer = 255; 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. // Color of the Icons.
if (old_layer != new_layer) { if (old_layer != new_layer) {

View file

@ -128,10 +128,10 @@ void tap_dance_choose_layer_reset (qk_tap_dance_state_t *state, void *user_data)
layer_off(_RAISE); layer_off(_RAISE);
break; break;
case 3: case 3:
if (biton32(default_layer_state) == _DVORAK) { if (get_highest_layer(default_layer_state) == _DVORAK) {
set_single_persistent_default_layer(_QWERTY); 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); set_single_persistent_default_layer(_DVORAK);
} }
break; break;

View file

@ -180,7 +180,7 @@ void keyboard_post_init_user(void) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
void rgb_matrix_indicators_user(void) { void rgb_matrix_indicators_user(void) {
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled. 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) { switch (layer) {
case _CLOSE: case _CLOSE:
// rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy. // rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy.

View file

@ -118,7 +118,7 @@ void keyboard_post_init_user(void) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
void rgb_matrix_indicators_user(void) { void rgb_matrix_indicators_user(void) {
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled. 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) { switch (layer) {
case _CLOSE: case _CLOSE:
// rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy. // rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy.

View file

@ -134,7 +134,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
// RGB Underglow使用時のレイヤー毎のカラー切り替え // RGB Underglow使用時のレイヤー毎のカラー切り替え
uint32_t layer_state_set_keymap (uint32_t state) { layer_state_t layer_state_set_keymap (layer_state_t state) {
return state; return state;
} }
@ -148,7 +148,7 @@ void matrix_init_user(void) {
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _RAISE: case _RAISE:
rgblight_setrgb_chartreuse(); // RAISE:シャルトリューズ rgblight_setrgb_chartreuse(); // RAISE:シャルトリューズ
break; break;

View file

@ -89,7 +89,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer; uint8_t layer;
layer = biton32(layer_state); layer = get_highest_layer(layer_state);
if (current_layer_global != layer) { if (current_layer_global != layer) {
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) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
uint8_t layer; uint8_t layer;
layer = biton32(layer_state); layer = get_highest_layer(layer_state);
if (layer == PROG2) { if (layer == PROG2) {
if (keycode >= KC_A && keycode <= KC_EXSEL && \ if (keycode >= KC_A && keycode <= KC_EXSEL && \
!( // do not send LSFT + these keycodes, they are needed for emulating the US layout !( // do not send LSFT + these keycodes, they are needed for emulating the US layout

View file

@ -77,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_scan_user(void) void matrix_scan_user(void)
{ {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
switch (layer) { switch (layer) {
case KM_BLOWRAK: case KM_BLOWRAK:
ph_caps_led_on(); ph_caps_led_on();

View file

@ -5,47 +5,48 @@
uint8_t layer = 0; 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); state = layer_state_set_user(state);
layer = biton32(state); layer = get_highest_layer(state);
return state; return state;
} }
bool encoder_update_kb(uint8_t index, bool clockwise) { bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) return false; if (!encoder_update_user(index, clockwise)) return false;
uint16_t mapped_code = 0; uint16_t mapped_code = 0;
if (index == 0) { if (index == 0) {
if (clockwise) { if (clockwise) {
switch(layer){ switch (layer) {
case 0: case 0:
default: default:
mapped_code = KC_VOLU; mapped_code = KC_VOLU;
break; break;
case 1: case 1:
mapped_code = KC_MEDIA_NEXT_TRACK; mapped_code = KC_MEDIA_NEXT_TRACK;
break; break;
case 2: case 2:
mapped_code = KC_PGDN; mapped_code = KC_PGDN;
break; break;
}
} else {
switch (layer) {
case 0:
default:
mapped_code = KC_VOLD;
break;
case 1:
mapped_code = KC_MEDIA_PREV_TRACK;
break;
case 2:
mapped_code = KC_PGUP;
break;
}
} }
} else { uint16_t held_keycode_timer = timer_read();
switch(layer){ register_code(mapped_code);
case 0: while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY) { /* no-op */
default:
mapped_code = KC_VOLD;
break;
case 1:
mapped_code = KC_MEDIA_PREV_TRACK;
break;
case 2:
mapped_code = KC_PGUP;
break;
} }
unregister_code(mapped_code);
} }
uint16_t held_keycode_timer = timer_read(); return true;
register_code(mapped_code);
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){ /* no-op */ }
unregister_code(mapped_code);
}
return true;
} }

View file

@ -240,7 +240,7 @@ void read_host_led_state(void) {
layer_state_t layer_state_set_kb(layer_state_t state) { layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state); state = layer_state_set_user(state);
layer = biton32(state); layer = get_highest_layer(state);
oled_request_wakeup(); oled_request_wakeup();
return state; return state;
} }

View file

@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
bool encoder_update_user(uint8_t index, bool clockwise) { bool encoder_update_user(uint8_t index, bool clockwise) {
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _BASE: case _BASE:
if (clockwise) { if (clockwise) {
tap_code(KC_VOLU); tap_code(KC_VOLU);
@ -62,7 +62,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
bool oled_task_user(void) { bool oled_task_user(void) {
// Host Keyboard Layer Status // Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _BASE: case _BASE:
oled_write_P(PSTR("Default\n"), false); oled_write_P(PSTR("Default\n"), false);
break; break;

View file

@ -199,7 +199,7 @@ void matrix_scan_user(void) {
if (!rgblight_config.enable || rgblight_config.mode != 1) { return; } 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; uint8_t val = rgblight_config.val;
if (layer & (1<<_FL)) { if (layer & (1<<_FL)) {

View file

@ -84,7 +84,7 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
const char *read_logo(void); const char *read_logo(void);
bool oled_task_user(void){ bool oled_task_user(void){
switch (biton32(layer_state)){ switch (get_highest_layer(layer_state)){
case _DVORAK: case _DVORAK:
oled_write_ln_P(PSTR("DVRK"), false); oled_write_ln_P(PSTR("DVRK"), false);
break; break;

View file

@ -54,9 +54,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// clang-format on // clang-format on
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT #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); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
switch (biton32(state)) { switch (get_highest_layer(state)) {
case L_EDVORAKJP_LOWER: case L_EDVORAKJP_LOWER:
rgblight_sethsv_noeeprom_red(); rgblight_sethsv_noeeprom_red();
break; break;

View file

@ -9,7 +9,7 @@ void render_layer_state(void) {
char layer_name[17]; char layer_name[17];
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case L_EDVORAKJP_BASE: case L_EDVORAKJP_BASE:
oled_write_ln_P(PSTR("Default"), false); oled_write_ln_P(PSTR("Default"), false);
break; break;

View file

@ -84,7 +84,7 @@ const char *read_keylogs(void);
char matrix_line_str[24]; char matrix_line_str[24];
const char *read_layer_state(void) { 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: "); strcpy(matrix_line_str, "Layer: ");

View file

@ -109,7 +109,7 @@ report_mouse_t currentReport = {};
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
//uint8_t layer; //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. bool returnVal = true; //this is to determine if more key processing is needed.
//custom layer handling for tri_layer, //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) { 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++){ 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]){ if ((timer_elapsed(special_timers[i]) >= CUSTOM_LONGPRESS) && (!special_key_states[i]) && special_key_pressed[i]){
switch (i + SAFE_RANGE){ switch (i + SAFE_RANGE){

View file

@ -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. // Runs constantly in the background, in a loop.
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
switch (layer) { switch (layer) {
case _LOWER: case _LOWER:

View file

@ -4,12 +4,12 @@
// thanks to atlacat, hailbreno, itsaferbie and weeheavy... // thanks to atlacat, hailbreno, itsaferbie and weeheavy...
// and special thanks to AGausmann and drashna for the layer-activated RGB underglow // and special thanks to AGausmann and drashna for the layer-activated RGB underglow
// https://www.reddit.com/r/olkb/comments/6t1vdu/update_layeractivated_rgb_underglow/ // https://www.reddit.com/r/olkb/comments/6t1vdu/update_layeractivated_rgb_underglow/
// https://github.com/AGausmann/qmk_firmware/blob/agausmann-v3.x/keyboards/nyquist/keymaps/agausmann/keymap.c // https://github.com/AGausmann/qmk_firmware/blob/agausmann-v3.x/keyboards/nyquist/keymaps/agausmann/keymap.c
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
/* /*
* Each layer gets a name for readability. * Each layer gets a name for readability.
* The underscores don't mean anything - you can * The underscores don't mean anything - you can
* have a layer called STUFF or any other name. * have a layer called STUFF or any other name.
@ -23,8 +23,8 @@
#define NL 2 // Numpad Layer #define NL 2 // Numpad Layer
#define RL 3 // RGB Layer #define RL 3 // RGB Layer
/* /*
* Let's give an easier name to the RGB modes * Let's give an easier name to the RGB modes
* and assign the ones we want to the different layer * and assign the ones we want to the different layer
* these will then be used by the function below * these will then be used by the function below
* *
@ -49,10 +49,10 @@
// //
#define RGB_RL_MODE rgblight_mode_noeeprom(22) //rgb mode for RL layer #define RGB_RL_MODE rgblight_mode_noeeprom(22) //rgb mode for RL layer
#define RGB_RL_LIGHT rgblight_sethsv_noeeprom_red() //rgb light for RL layer #define RGB_RL_LIGHT rgblight_sethsv_noeeprom_red() //rgb light for RL layer
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap BL: Base Layer (Default Layer) /* Keymap BL: Base Layer (Default Layer)
* *
* ,-----------------------------------------------------------. * ,-----------------------------------------------------------.
@ -140,7 +140,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, RGB_STA, RGB_BRE, RGB_RAI, RGB_SWI, _______, _______, RGB_SNA, RGB_KNI, RGB_GRA, RGB_XMS, _______, _______, _______, _______, RGB_STA, RGB_BRE, RGB_RAI, RGB_SWI, _______, _______, RGB_SNA, RGB_KNI, RGB_GRA, RGB_XMS, _______, _______, _______,
_______, BL_DEC, BL_TOGG, BL_INC, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_DEC, BL_TOGG, BL_INC, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, MO(FL), _______, _______, _______, TO(BL), _______), _______, _______, _______, _______, MO(FL), _______, _______, _______, TO(BL), _______),
}; };
@ -175,25 +175,25 @@ void matrix_scan_user(void) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
static uint8_t old_layer = 1; 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) { if (old_layer != new_layer) {
switch (new_layer) { switch (new_layer) {
case BL: case BL:
RGB_BL_MODE; RGB_BL_MODE;
RGB_BL_LIGHT; RGB_BL_LIGHT;
break; break;
case FL: case FL:
RGB_FL_MODE; RGB_FL_MODE;
RGB_FL_LIGHT; RGB_FL_LIGHT;
break; break;
case NL: case NL:
RGB_NL_MODE; RGB_NL_MODE;
RGB_NL_LIGHT; RGB_NL_LIGHT;
break; break;
case RL: case RL:
RGB_RL_MODE; RGB_RL_MODE;
RGB_RL_LIGHT; RGB_RL_LIGHT;
break; break;
} }

View file

@ -11,7 +11,7 @@ static int16_t fnTimer = 0;
layer_state_t layer_state_set_user(layer_state_t state) layer_state_t layer_state_set_user(layer_state_t state)
{ {
switch (biton32(state)) switch (get_highest_layer(state))
{ {
case QWERTY: case QWERTY:
rgblight_mode(9); rgblight_mode(9);

View file

@ -73,7 +73,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
static uint32_t last_state = 0; static uint32_t last_state = 0;
if(last_state != state) { if(last_state != state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _CMD: case _CMD:
user_led_on(); user_led_on();
break; break;
@ -85,5 +85,3 @@ layer_state_t layer_state_set_user(layer_state_t state) {
} }
return state; return state;
} }

View file

@ -96,7 +96,7 @@ void rgb_matrix_indicators_user(void)
uint8_t this_led = host_keyboard_leds(); uint8_t this_led = host_keyboard_leds();
if (!g_suspend_state && rgb_matrix_config.enable) { if (!g_suspend_state && rgb_matrix_config.enable) {
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _NAV: case _NAV:
if (this_led & (1 << USB_LED_NUM_LOCK)) { if (this_led & (1 << USB_LED_NUM_LOCK)) {
rgb_matrix_set_color(13, 0xFF, 0x00, 0x00); rgb_matrix_set_color(13, 0xFF, 0x00, 0x00);

View file

@ -62,7 +62,7 @@ void rgb_matrix_indicators_user(void)
uint8_t this_led = host_keyboard_leds(); uint8_t this_led = host_keyboard_leds();
if (!g_suspend_state && rgb_matrix_config.enable) { if (!g_suspend_state && rgb_matrix_config.enable) {
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _LAYER1: case _LAYER1:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break; 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); rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF);
} }
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _LAYER3: case _LAYER3:
if (this_led & (1 << USB_LED_NUM_LOCK)) { if (this_led & (1 << USB_LED_NUM_LOCK)) {
rgb_matrix_set_color(13, 0xFF, 0x00, 0x00); rgb_matrix_set_color(13, 0xFF, 0x00, 0x00);

View file

@ -37,7 +37,7 @@ void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) {
void rgb_matrix_indicators_user(void) void rgb_matrix_indicators_user(void)
{ {
if (!g_suspend_state) { if (!g_suspend_state) {
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _QWERTY: case _QWERTY:
rgb_matrix_layer_helper(0x00, 0x0F, 0xFF); break; 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: case _FNM:
rgb_matrix_set_color(0, 0x00, 0xFF, 0x00); rgb_matrix_set_color(0, 0x00, 0xFF, 0x00);
rgb_matrix_set_color(1, 0x00, 0x00, 0x00); rgb_matrix_set_color(1, 0x00, 0x00, 0x00);

View file

@ -238,5 +238,5 @@ void rgb_matrix_indicators_user(void) {
} }
// Show Selected Layer // 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]);
} }

View file

@ -1,20 +1,20 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
/**************** SOME GLOBALS *********************/ /**************** SOME GLOBALS *********************/
bool onMac = false; bool onMac = false;
bool isLeader = false; bool isLeader = false;
bool isBlinking = false; bool isBlinking = false;
bool isRecording = false; bool isRecording = false;
bool isPlaying = false; bool isPlaying = false;
const float led_dim_ratio = 0.50; const float led_dim_ratio = 0.50;
static uint16_t blink_cycle_timer, static uint16_t blink_cycle_timer,
blink_fade_in_timer, blink_fade_in_timer,
blink_fade_out_timer, blink_fade_out_timer,
macro_one_play_timer, macro_one_play_timer,
macro_two_play_timer, macro_two_play_timer,
macro_play_blink_timer = 2000; macro_play_blink_timer = 2000;
static uint8_t fade_in_step_counter, static uint8_t fade_in_step_counter,
fade_out_step_counter, fade_out_step_counter,
blink_hsv_value; blink_hsv_value;
@ -26,13 +26,13 @@ Function to set color with hsv arguments
- "val_ratio" is used to adjust brightness ratio - "val_ratio" is used to adjust brightness ratio
*/ */
void rgb_matrix_set_color_hsv(uint8_t led, uint16_t hue, uint16_t sat, uint16_t val, float val_ratio) { void rgb_matrix_set_color_hsv(uint8_t led, uint16_t hue, uint16_t sat, uint16_t val, float val_ratio) {
const uint8_t h = hue <= 255 ? hue : rgb_matrix_config.hsv.h; const uint8_t h = hue <= 255 ? hue : rgb_matrix_config.hsv.h;
const uint8_t s = sat <= 255 ? sat : rgb_matrix_config.hsv.s; const uint8_t s = sat <= 255 ? sat : rgb_matrix_config.hsv.s;
const uint8_t v = val <= 255 ? val * val_ratio : rgb_matrix_config.hsv.v * val_ratio; const uint8_t v = val <= 255 ? val * val_ratio : rgb_matrix_config.hsv.v * val_ratio;
HSV hsv_in = {h, s, v}; HSV hsv_in = {h, s, v};
RGB rgb_out = hsv_to_rgb(hsv_in); RGB rgb_out = hsv_to_rgb(hsv_in);
rgb_matrix_set_color(led, rgb_out.r, rgb_out.g, rgb_out.b); rgb_matrix_set_color(led, rgb_out.r, rgb_out.g, rgb_out.b);
} }
void reset_blink_cycle(void) { void reset_blink_cycle(void) {
blink_cycle_timer = timer_read(); blink_cycle_timer = timer_read();
@ -110,31 +110,31 @@ const layers_leds_map[] = {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAIN] = LAYOUT_65_ansi( [_MAIN] = LAYOUT_65_ansi(
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
KC_LEAD, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, KC_LEAD, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
), ),
[_MAC] = LAYOUT_65_ansi( [_MAC] = LAYOUT_65_ansi(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_LALT, KC_LGUI, KC_TRNS, KC_TRNS, MO(_FN), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS KC_TRNS, KC_LALT, KC_LGUI, KC_TRNS, KC_TRNS, MO(_FN), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
), ),
[_FN] = LAYOUT_65_ansi( [_FN] = LAYOUT_65_ansi(
DYN_REC_STOP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, DYN_REC_STOP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
KC_TRNS, KC_MUTE, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_SAD, RGB_SAI, DYN_MACRO_PLAY2, DYN_REC_START2, KC_TRNS, KC_MUTE, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_SAD, RGB_SAI, DYN_MACRO_PLAY2, DYN_REC_START2,
KC_TRNS, KC_BRID, KC_VOLD, KC_BRIU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_HUD, RGB_HUI, DYN_MACRO_PLAY1, DYN_REC_START1, KC_TRNS, KC_BRID, KC_VOLD, KC_BRIU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_HUD, RGB_HUI, DYN_MACRO_PLAY1, DYN_REC_START1,
KC_TRNS, TO(_MAIN), TO(_MAC), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_SPD, RGB_SPI, KC_TRNS, RGB_VAI, KC_NO, KC_TRNS, TO(_MAIN), TO(_MAC), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_SPD, RGB_SPI, KC_TRNS, RGB_VAI, KC_NO,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, RGB_VAD, RGB_MOD KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, RGB_VAD, RGB_MOD
), ),
}; };
//**************** MATRIX SCANS *********************// //**************** MATRIX SCANS *********************//
void rgb_matrix_indicators_user(void) { void rgb_matrix_indicators_user(void) {
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
@ -144,7 +144,7 @@ void rgb_matrix_indicators_user(void) {
/* CapsLock LED indicator */ /* CapsLock LED indicator */
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color_hsv(30, 999, 0, led_constant_val, 0.75); // WHITE rgb_matrix_set_color_hsv(30, 999, 0, led_constant_val, 0.75); // WHITE
} }
/* Current layer LED indicator */ /* Current layer LED indicator */
rgb_matrix_set_color_hsv(layers_leds_map[get_highest_layer(layer_state)], 999, 0, led_constant_val, led_dim_ratio); // WHITE rgb_matrix_set_color_hsv(layers_leds_map[get_highest_layer(layer_state)], 999, 0, led_constant_val, led_dim_ratio); // WHITE
@ -155,7 +155,7 @@ void rgb_matrix_indicators_user(void) {
rgb_matrix_set_color_hsv(30, 999, 999, 999, 1); // CONFIG rgb_matrix_set_color_hsv(30, 999, 999, 999, 1); // CONFIG
} else { } else {
rgb_matrix_set_color_hsv(14, 999, 999, 999, led_dim_ratio); // CONFIG rgb_matrix_set_color_hsv(14, 999, 999, 999, led_dim_ratio); // CONFIG
} }
/* Blinking LED indicator when recording Dynamic Macro */ /* Blinking LED indicator when recording Dynamic Macro */
if (isRecording && isBlinking) { if (isRecording && isBlinking) {
@ -174,7 +174,7 @@ void rgb_matrix_indicators_user(void) {
} }
} }
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _FN: case _FN:
/* Dynamic Macro LED indicator */ /* Dynamic Macro LED indicator */
if (isRecording) { if (isRecording) {
@ -188,12 +188,12 @@ void rgb_matrix_indicators_user(void) {
/* Layer LED indicators */ /* Layer LED indicators */
rgb_matrix_set_color_hsv(45, 999, 0, led_constant_val, led_dim_ratio); /* WHITE Layer _MAIN */ rgb_matrix_set_color_hsv(45, 999, 0, led_constant_val, led_dim_ratio); /* WHITE Layer _MAIN */
rgb_matrix_set_color_hsv(46, 999, 0, led_constant_val, led_dim_ratio); /* WHITE Layer _MAC */ rgb_matrix_set_color_hsv(46, 999, 0, led_constant_val, led_dim_ratio); /* WHITE Layer _MAC */
break; break;
} }
#endif /* RGB_MATRIX */ #endif /* RGB_MATRIX */
} }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool pressed = record->event.pressed; bool pressed = record->event.pressed;
if (pressed) { if (pressed) {
@ -202,12 +202,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
onMac = true; onMac = true;
break; break;
case TO(_MAIN): case TO(_MAIN):
onMac = false; onMac = false;
break; break;
} }
} }
return true; return true;
} }
//**************** LEADER *********************// //**************** LEADER *********************//
@ -244,7 +244,7 @@ const uint8_t french_accent_index[3] = {
[_ACUTE] = 2 [_ACUTE] = 2
}; };
/* /*
This represent unicode decimal values This represent unicode decimal values
Each index will be mapped to numpad keycode to out put the correct sequence Each index will be mapped to numpad keycode to out put the correct sequence
All codes in this array should be of size 3 All codes in this array should be of size 3
@ -272,8 +272,8 @@ const uint8_t french_decimal_unicodes[5][3][2] = { /*[Letter][Accent][Case]*/
} }
},{ },{
{ {
140, // î 140, // î
206 // Î 206 // Î
} }
},{ },{
{ {
@ -306,7 +306,7 @@ This is designed and work on an English language keyboard setting on both Window
=> accept french_letter and french_accent enum's as argument => accept french_letter and french_accent enum's as argument
*/ */
void send_french_accent(uint8_t letter, uint8_t accent) { void send_french_accent(uint8_t letter, uint8_t accent) {
bool isCaps; bool isCaps;
uint8_t decimal_unicode_in; uint8_t decimal_unicode_in;
uint8_t decimal_unicode_size = 3; uint8_t decimal_unicode_size = 3;
@ -330,7 +330,7 @@ void send_french_accent(uint8_t letter, uint8_t accent) {
}; };
/* /*
Function to tap the correct keycodes in sequence for the Function to tap the correct keycodes in sequence for the
"Windows Alt Code" requested, aka Decimal Unicodes "Windows Alt Code" requested, aka Decimal Unicodes
*/ */
void tap_win_alt_code(void) { void tap_win_alt_code(void) {
@ -341,7 +341,7 @@ void send_french_accent(uint8_t letter, uint8_t accent) {
tap_code(numpad_key_map[decimal_unicode_out[i]]); tap_code(numpad_key_map[decimal_unicode_out[i]]);
} }
} }
isCaps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? true : false; isCaps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK) ? true : false;
if (onMac) { if (onMac) {
@ -372,7 +372,7 @@ void send_french_accent(uint8_t letter, uint8_t accent) {
/*Couple functions used to output the same macro on two different sequences*/ /*Couple functions used to output the same macro on two different sequences*/
/* (|) */ /* (|) */
void ldrkey_send_paranthesis_wrap_ini(void) { void ldrkey_send_paranthesis_wrap_ini(void) {
SEND_STRING("()" SS_TAP(X_LEFT)); SEND_STRING("()" SS_TAP(X_LEFT));
} }
@ -382,7 +382,7 @@ void ldrkey_send_paranthesis_wrap_word(void) {
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) "(" SS_LALT(SS_TAP(X_RIGHT)) ")") : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) "(" SS_LCTL(SS_TAP(X_RIGHT)) ")"); onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) "(" SS_LALT(SS_TAP(X_RIGHT)) ")") : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) "(" SS_LCTL(SS_TAP(X_RIGHT)) ")");
} }
/* (selection) */ /* (selection) */
void ldrkey_send_paranthesis_wrap_selection(void) { void ldrkey_send_paranthesis_wrap_selection(void) {
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_X)) "()" SS_TAP(X_LEFT) SS_LGUI(SS_TAP(X_V)) SS_TAP(X_RIGHT)) : SEND_STRING(SS_LCTL(SS_TAP(X_X)) "()" SS_TAP(X_LEFT) SS_LCTL(SS_TAP(X_V)) SS_TAP(X_RIGHT)); onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_X)) "()" SS_TAP(X_LEFT) SS_LGUI(SS_TAP(X_V)) SS_TAP(X_RIGHT)) : SEND_STRING(SS_LCTL(SS_TAP(X_X)) "()" SS_TAP(X_LEFT) SS_LCTL(SS_TAP(X_V)) SS_TAP(X_RIGHT));
} }
@ -419,9 +419,9 @@ void ldrkey_send_curlybrace_wrap_selection(void) {
LEADER_EXTERNS(); LEADER_EXTERNS();
void matrix_scan_user(void) void matrix_scan_user(void)
{ {
LEADER_DICTIONARY() LEADER_DICTIONARY()
{ {
leading = false; leading = false;
leader_end(); leader_end();
@ -476,49 +476,49 @@ void matrix_scan_user(void)
tap_code(KC_CAPS); tap_code(KC_CAPS);
} }
/* ± => LdrKey > = > - */ /* ± => LdrKey > = > - */
SEQ_TWO_KEYS(KC_EQL, KC_MINS) { SEQ_TWO_KEYS(KC_EQL, KC_MINS) {
onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_EQL)))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P1) SS_UP(X_LALT)); onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_EQL)))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P1) SS_UP(X_LALT));
} }
/* ≤ => LdrKey > - > = */ /* ≤ => LdrKey > - > = */
SEQ_TWO_KEYS(KC_MINS, KC_EQL) { SEQ_TWO_KEYS(KC_MINS, KC_EQL) {
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_COMM))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P3) SS_UP(X_LALT)); onMac ? SEND_STRING(SS_LALT(SS_TAP(X_COMM))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P3) SS_UP(X_LALT));
} }
/* ≥ => LdrKey > = > = */ /* ≥ => LdrKey > = > = */
SEQ_TWO_KEYS(KC_EQL, KC_EQL) { SEQ_TWO_KEYS(KC_EQL, KC_EQL) {
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_DOT))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P2) SS_UP(X_LALT)); onMac ? SEND_STRING(SS_LALT(SS_TAP(X_DOT))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P2) SS_UP(X_LALT));
} }
/* <= => LdrKey > , > , */ /* <= => LdrKey > , > , */
SEQ_TWO_KEYS(KC_COMM, KC_COMM) { SEQ_TWO_KEYS(KC_COMM, KC_COMM) {
SEND_STRING(SS_LSFT(SS_TAP(X_COMM)) SS_TAP(X_SPC) SS_TAP(X_EQL) SS_TAP(X_LEFT) SS_TAP(X_BSPC) SS_TAP(X_RIGHT)); SEND_STRING(SS_LSFT(SS_TAP(X_COMM)) SS_TAP(X_SPC) SS_TAP(X_EQL) SS_TAP(X_LEFT) SS_TAP(X_BSPC) SS_TAP(X_RIGHT));
} }
/* => => LdrKey > . > . */ /* => => LdrKey > . > . */
SEQ_TWO_KEYS(KC_DOT, KC_DOT) { SEQ_TWO_KEYS(KC_DOT, KC_DOT) {
SEND_STRING("=>"); SEND_STRING("=>");
} }
/* ", " => LdrKey > " " */ /* ", " => LdrKey > " " */
SEQ_ONE_KEY(KC_SPC) { SEQ_ONE_KEY(KC_SPC) {
SEND_STRING(", "); SEND_STRING(", ");
} }
/* ". " => LdrKey > " " > " " */ /* ". " => LdrKey > " " > " " */
SEQ_TWO_KEYS(KC_SPC, KC_SPC) { SEQ_TWO_KEYS(KC_SPC, KC_SPC) {
SEND_STRING(". "); SEND_STRING(". ");
} }
/* Backward delete current word (on cursor) */ /* Backward delete current word (on cursor) */
SEQ_TWO_KEYS(KC_BSPC, KC_BSPC) { SEQ_TWO_KEYS(KC_BSPC, KC_BSPC) {
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_RIGHT)) SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_TAP(X_RIGHT)) SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)); onMac ? SEND_STRING(SS_LALT(SS_TAP(X_RIGHT)) SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_TAP(X_RIGHT)) SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC));
} }
/* Previous word delete */ /* Previous word delete */
SEQ_ONE_KEY(KC_BSPC) { SEQ_ONE_KEY(KC_BSPC) {
onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)); onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC));
} }
/* Forward delete current word (on cursor) */ /* Forward delete current word (on cursor) */
SEQ_TWO_KEYS(KC_DEL, KC_DEL) { SEQ_TWO_KEYS(KC_DEL, KC_DEL) {
onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)) : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)); onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)) : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL));
} }
/* Next word delete */ /* Next word delete */
SEQ_ONE_KEY(KC_DEL) { SEQ_ONE_KEY(KC_DEL) {
onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)): SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)); onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)): SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL));
} }
/* ` => LdrKey > Escape */ /* ` => LdrKey > Escape */
SEQ_ONE_KEY(KC_GESC) { SEQ_ONE_KEY(KC_GESC) {
@ -548,7 +548,7 @@ void matrix_scan_user(void)
SEQ_ONE_KEY(KC_Q) { SEQ_ONE_KEY(KC_Q) {
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_Q))) : SEND_STRING(SS_LALT(SS_TAP(X_F4))); onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_Q))) : SEND_STRING(SS_LALT(SS_TAP(X_F4)));
} }
/* " => LdrKey > ' */ /* " => LdrKey > ' */
SEQ_ONE_KEY(KC_QUOT) { SEQ_ONE_KEY(KC_QUOT) {
SEND_STRING("\""); SEND_STRING("\"");
} }
@ -657,48 +657,48 @@ void matrix_scan_user(void)
ldrkey_send_curlybrace_wrap_selection(); ldrkey_send_curlybrace_wrap_selection();
} }
/* Select everything on this line before cursor => LdrKey > Left */ /* Select everything on this line before cursor => LdrKey > Left */
SEQ_ONE_KEY(KC_LEFT) { SEQ_ONE_KEY(KC_LEFT) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_LEFT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_HOME))); onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_LEFT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_HOME)));
} }
/* Select everything on this line after cursor => LdrKey > Right */ /* Select everything on this line after cursor => LdrKey > Right */
SEQ_ONE_KEY(KC_RIGHT) { SEQ_ONE_KEY(KC_RIGHT) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_END))); onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_END)));
} }
/* Select everything on this line before cursor and bring on previous line => LdrKey > Left > Left */ /* Select everything on this line before cursor and bring on previous line => LdrKey > Left > Left */
SEQ_TWO_KEYS(KC_LEFT, KC_LEFT) { SEQ_TWO_KEYS(KC_LEFT, KC_LEFT) {
onMac ? SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_TAP(X_END))); onMac ? SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_TAP(X_END)));
} }
/* Select everything on this line => LdrKey > Right > Left */ /* Select everything on this line => LdrKey > Right > Left */
SEQ_TWO_KEYS(KC_RIGHT, KC_LEFT) { SEQ_TWO_KEYS(KC_RIGHT, KC_LEFT) {
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_RIGHT) SS_LSFT(SS_LGUI(SS_TAP(X_LEFT))))) : SEND_STRING(SS_TAP(X_END) SS_LSFT(SS_TAP(X_HOME))); onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_RIGHT) SS_LSFT(SS_LGUI(SS_TAP(X_LEFT))))) : SEND_STRING(SS_TAP(X_END) SS_LSFT(SS_TAP(X_HOME)));
} }
/* Select 1x Page Up on the page before the cursor => LdrKey > Up */ /* Select 1x Page Up on the page before the cursor => LdrKey > Up */
SEQ_ONE_KEY(KC_UP) { SEQ_ONE_KEY(KC_UP) {
SEND_STRING(SS_LSFT(SS_TAP(X_PGUP))); SEND_STRING(SS_LSFT(SS_TAP(X_PGUP)));
} }
/* Select 1x Page Down on the page after the cursor => LdrKey > Down */ /* Select 1x Page Down on the page after the cursor => LdrKey > Down */
SEQ_ONE_KEY(KC_DOWN) { SEQ_ONE_KEY(KC_DOWN) {
SEND_STRING(SS_LSFT(SS_TAP(X_PGDN))); SEND_STRING(SS_LSFT(SS_TAP(X_PGDN)));
} }
/* Select everything on the page before the cursor => LdrKey > Up > Up */ /* Select everything on the page before the cursor => LdrKey > Up > Up */
SEQ_TWO_KEYS(KC_UP, KC_UP) { SEQ_TWO_KEYS(KC_UP, KC_UP) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_UP)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_HOME)))); onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_UP)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_HOME))));
} }
/* Select everything on the page after the cursor => LdrKey > Down > Down */ /* Select everything on the page after the cursor => LdrKey > Down > Down */
SEQ_TWO_KEYS(KC_DOWN, KC_DOWN) { SEQ_TWO_KEYS(KC_DOWN, KC_DOWN) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_DOWN)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_END)))); onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_DOWN)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_END))));
} }
/* HELPER => spit out the url of the layout description page on github */ /* HELPER => spit out the url of the layout description page on github */
SEQ_FIVE_KEYS(KC_GESC, KC_GESC, KC_GESC, KC_GESC, KC_GESC) { SEQ_FIVE_KEYS(KC_GESC, KC_GESC, KC_GESC, KC_GESC, KC_GESC) {
SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/keyboards/dztech/dz65rgb/keymaps/drootz"); SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/keyboards/dztech/dz65rgb/keymaps/drootz");
} }
/* google.ca => LdrKey > G > G */ /* google.ca => LdrKey > G > G */
SEQ_TWO_KEYS(KC_G, KC_G) { SEQ_TWO_KEYS(KC_G, KC_G) {
SEND_STRING("https://google.ca" SS_TAP(X_ENT)); SEND_STRING("https://google.ca" SS_TAP(X_ENT));
} }
/* @gmail => LdrKey > M > L > T */ /* @gmail => LdrKey > M > L > T */
SEQ_THREE_KEYS(KC_M, KC_L, KC_T) { SEQ_THREE_KEYS(KC_M, KC_L, KC_T) {
SEND_STRING("mailto." SS_TAP(X_D) SS_TAP(X_A) SS_TAP(X_N) SS_TAP(X_I) SS_TAP(X_E) SS_TAP(X_L) SS_TAP(X_R) SS_TAP(X_A) SS_TAP(X_C) SS_TAP(X_I) SS_TAP(X_N) SS_TAP(X_E) "@gmail.com"); SEND_STRING("mailto." SS_TAP(X_D) SS_TAP(X_A) SS_TAP(X_N) SS_TAP(X_I) SS_TAP(X_E) SS_TAP(X_L) SS_TAP(X_R) SS_TAP(X_A) SS_TAP(X_C) SS_TAP(X_I) SS_TAP(X_N) SS_TAP(X_E) "@gmail.com");
} }
/* Show Desktop => LdrKey > D */ /* Show Desktop => LdrKey > D */
SEQ_ONE_KEY(KC_D) { SEQ_ONE_KEY(KC_D) {

View file

@ -91,7 +91,7 @@ void rgb_matrix_indicators_user(void)
uint8_t this_led = host_keyboard_leds(); uint8_t this_led = host_keyboard_leds();
if (!g_suspend_state && rgb_matrix_config.enable) { if (!g_suspend_state && rgb_matrix_config.enable) {
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _NAV: case _NAV:
if (IS_LED_ON(this_led, USB_LED_NUM_LOCK)) { if (IS_LED_ON(this_led, USB_LED_NUM_LOCK)) {
rgb_matrix_set_color(17, 0xFF, 0x00, 0x00); rgb_matrix_set_color(17, 0xFF, 0x00, 0x00);

View file

@ -190,7 +190,7 @@ static bool is_macro1_recording = false;
// The current set of active layers (as a bitmask). // The current set of active layers (as a bitmask).
// There is a global 'layer_state' variable but it is set after the call // There is a global 'layer_state' variable but it is set after the call
// to layer_state_set_user(). // 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); 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 // Method called at the end of the tap dance on the TAP_MACRO key. That key is

View file

@ -200,7 +200,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();
@ -262,4 +262,3 @@ void matrix_scan_user(void) {
// } // }
// return true; // return true;
//} //}

View file

@ -98,7 +98,7 @@ static bool is_macro1_recording = false;
// The current set of active layers (as a bitmask). // The current set of active layers (as a bitmask).
// There is a global 'layer_state' variable but it is set after the call // There is a global 'layer_state' variable but it is set after the call
// to layer_state_set_user(). // 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); 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 // Method called at the end of the tap dance on the TAP_MACRO key. That key is

View file

@ -141,7 +141,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -725,7 +725,7 @@ void led_set_user(uint8_t usb_led) {
void matrix_scan_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_board_led_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();

View file

@ -1,6 +1,6 @@
layer_state_t layer_state_set_user(layer_state_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 DVORAK: case DVORAK:

View file

@ -370,7 +370,7 @@ LEADER_EXTERNS();
void matrix_scan_user(void) 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) || if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) &&
@ -677,4 +677,4 @@ void matrix_init_user(void)
wait_ms(1000); wait_ms(1000);
rgblight_effect_knight(50); rgblight_effect_knight(50);
} }

View file

@ -284,7 +284,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -813,7 +813,7 @@ case RU_7:
layer_state_t layer_state_set_user(layer_state_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_board_led_off(); // ergodox_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -218,7 +218,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
layer_state_t layer_state_set_user(layer_state_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_board_led_off(); ergodox_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();
@ -431,4 +431,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return true; return true;
} }

View file

@ -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) { 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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -157,7 +157,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -245,11 +245,11 @@ void keyboard_post_init_user_keymap(void) {
} }
// light up leds based on the layer // 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_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();
ergodox_right_led_3_off(); ergodox_right_led_3_off();
switch (biton32(state)) { switch (get_highest_layer(state)) {
case LR_SYSCTL: case LR_SYSCTL:
ergodox_right_led_3_on(); // blue ergodox_right_led_3_on(); // blue
break; break;
@ -306,7 +306,7 @@ uint32_t layer_state_set_user_keymap(uint32_t state) {
// SYSCTL on first tap, MOUSE ON second tap // SYSCTL on first tap, MOUSE ON second tap
// void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) { // 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) { // switch(state->count) {
// case 1: // case 1:

View file

@ -228,7 +228,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
ergodox_right_led_1_off(); ergodox_right_led_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();
ergodox_right_led_3_off(); ergodox_right_led_3_off();
switch (biton32(state)) { switch (get_highest_layer(state)) {
case SYMB: case SYMB:
ergodox_right_led_1_on(); ergodox_right_led_1_on();
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); } 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; return state;
} }

View file

@ -138,7 +138,7 @@ void keyboard_post_init_user(void) {
}; };
// Runs whenever there is a layer state change. // 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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();

View file

@ -228,7 +228,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -139,7 +139,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
if(layer == 1) if(layer == 1)
{ {
@ -157,7 +157,7 @@ void matrix_scan_user(void) {
} }
if(keyboard_report->mods & MOD_BIT(KC_LSFT)) if(keyboard_report->mods & MOD_BIT(KC_LSFT))
{ {
ergodox_right_led_1_set (LED_BRIGHTNESS_HI); ergodox_right_led_1_set (LED_BRIGHTNESS_HI);
ergodox_right_led_1_on (); ergodox_right_led_1_on ();
} else { } else {
@ -182,7 +182,7 @@ void matrix_scan_user(void) {
} }
if(keyboard_report->mods & MOD_BIT(KC_LCTRL)) if(keyboard_report->mods & MOD_BIT(KC_LCTRL))
{ {
ergodox_right_led_3_set (LED_BRIGHTNESS_HI); ergodox_right_led_3_set (LED_BRIGHTNESS_HI);
ergodox_right_led_3_on (); ergodox_right_led_3_on ();
} else { } else {
@ -195,7 +195,7 @@ void matrix_scan_user(void) {
}; };
void led_set_user(uint8_t usb_led){ void led_set_user(uint8_t usb_led){
if (usb_led & (1 << USB_LED_CAPS_LOCK)) if (usb_led & (1 << USB_LED_CAPS_LOCK))
{ {
capsOn = true; capsOn = true;
}else { }else {

View file

@ -228,7 +228,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -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) { 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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -330,7 +330,7 @@ void matrix_init_user(void) {
}; };
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -27,29 +27,34 @@ PY2 = sys.version_info.major == 2
if PY2: if PY2:
chr = unichr chr = unichr
KEYBOARD_LAYOUTS = { KEYBOARD_LAYOUTS = {
# These map positions in the parsed layout to # These map positions in the parsed layout to
# positions in the KEYMAP MATRIX # positions in the KEYMAP MATRIX
'ergodox_ez': [ 'ergodox_ez': [
[ 0, 1, 2, 3, 4, 5, 6], [38, 39, 40, 41, 42, 43, 44], [0, 1, 2, 3, 4, 5, 6],
[ 7, 8, 9, 10, 11, 12, 13], [45, 46, 47, 48, 49, 50, 51], [38, 39, 40, 41, 42, 43, 44],
[14, 15, 16, 17, 18, 19 ], [ 52, 53, 54, 55, 56, 57], [7, 8, 9, 10, 11, 12, 13],
[20, 21, 22, 23, 24, 25, 26], [58, 59, 60, 61, 62, 63, 64], [45, 46, 47, 48, 49, 50, 51],
[27, 28, 29, 30, 31 ], [ 65, 66, 67, 68, 69], [14, 15, 16, 17, 18, 19],
[ 32, 33], [70, 71 ], [52, 53, 54, 55, 56, 57],
[ 34], [72 ], [20, 21, 22, 23, 24, 25, 26],
[ 35, 36, 37], [73, 74, 75 ], [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 = { ROW_INDENTS = {'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]}
'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]
}
BLANK_LAYOUTS = [ BLANK_LAYOUTS = [
# Compact Layout # Compact Layout
""" """
.------------------------------------.------------------------------------. .------------------------------------.------------------------------------.
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
!-----+----+----+----+----+----------!-----+----+----+----+----+----+-----! !-----+----+----+----+----+----------!-----+----+----+----+----+----+-----!
@ -70,8 +75,8 @@ BLANK_LAYOUTS = [
'-----------------' '-----------------' '-----------------' '-----------------'
""", """,
# Wide Layout # Wide Layout
""" """
.---------------------------------------------. .---------------------------------------------. .---------------------------------------------. .---------------------------------------------.
| | | | | | | | ! | | | | | | | | | | | | | | | ! | | | | | | |
!-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------! !-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
@ -93,26 +98,22 @@ BLANK_LAYOUTS = [
""", """,
] ]
DEFAULT_CONFIG = { DEFAULT_CONFIG = {
"keymaps_includes": [ "keymaps_includes": ["keymap_common.h",],
"keymap_common.h",
],
'filler': "-+.'!:x", 'filler': "-+.'!:x",
'separator': "|", 'separator': "|",
'default_key_prefix': ["KC_"], 'default_key_prefix': ["KC_"],
} }
SECTIONS = [ SECTIONS = [
'layout_config', 'layout_config',
'layers', 'layers',
] ]
# Markdown Parsing # Markdown Parsing
ONELINE_COMMENT_RE = re.compile(r""" ONELINE_COMMENT_RE = re.compile(
r"""
^ # comment must be at the start of the line ^ # comment must be at the start of the line
\s* # arbitrary whitespace \s* # arbitrary whitespace
// # start of the comment // # start of the comment
@ -121,22 +122,26 @@ ONELINE_COMMENT_RE = re.compile(r"""
""", re.MULTILINE | re.VERBOSE """, re.MULTILINE | re.VERBOSE
) )
INLINE_COMMENT_RE = re.compile(r""" INLINE_COMMENT_RE = re.compile(
r"""
([\,\"\[\]\{\}\d]) # anythig that might end a expression ([\,\"\[\]\{\}\d]) # anythig that might end a expression
\s+ # comment must be preceded by whitespace \s+ # comment must be preceded by whitespace
// # start of the comment // # start of the comment
\s # and succeded by whitespace \s # and succeded by whitespace
(?:[^\"\]\}\{\[]*) # the comment (except things which might be json) (?:[^\"\]\}\{\[]*) # the comment (except things which might be json)
$ # until the end of line $ # 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 , # the comma
(?:\s*) # arbitrary whitespace (?:\s*) # arbitrary whitespace
$ # only works if the trailing comma is followed by newline $ # only works if the trailing comma is followed by newline
(\s*) # arbitrary whitespace (\s*) # arbitrary whitespace
([\]\}]) # end of an array or object ([\]\}]) # end of an array or object
""", re.MULTILINE | re.VERBOSE) """, re.MULTILINE | re.VERBOSE
)
def loads(raw_data): def loads(raw_data):
@ -178,9 +183,7 @@ def parse_config(path):
def end_section(): def end_section():
if section['start_line'] >= 0: if section['start_line'] >= 0:
if section['name'] == 'layout_config': if section['name'] == 'layout_config':
config.update(loads("\n".join( config.update(loads("\n".join(section['code_lines'])))
section['code_lines']
)))
elif section['sub_name'].startswith('layer'): elif section['sub_name'].startswith('layer'):
layer_name = section['sub_name'] layer_name = section['sub_name']
config['layer_lines'][layer_name] = section['code_lines'] config['layer_lines'][layer_name] = section['code_lines']
@ -215,6 +218,7 @@ def parse_config(path):
assert 'layout' in config assert 'layout' in config
return config return config
# header file parsing # header file parsing
IF0_RE = re.compile(r""" IF0_RE = re.compile(r"""
@ -224,7 +228,6 @@ IF0_RE = re.compile(r"""
#endif #endif
""", re.MULTILINE | re.DOTALL | re.VERBOSE) """, re.MULTILINE | re.DOTALL | re.VERBOSE)
COMMENT_RE = re.compile(r""" COMMENT_RE = re.compile(r"""
/\* /\*
.*? .*?
@ -244,6 +247,7 @@ def regex_partial(re_str_fmt, flags):
def partial(*args, **kwargs): def partial(*args, **kwargs):
re_str = re_str_fmt.format(*args, **kwargs) re_str = re_str_fmt.format(*args, **kwargs)
return re.compile(re_str, flags) return re.compile(re_str, flags)
return partial return partial
@ -256,7 +260,6 @@ KEYDEF_REP = regex_partial(r"""
) # capture group end ) # capture group end
""", re.MULTILINE | re.DOTALL | re.VERBOSE) """, re.MULTILINE | re.DOTALL | re.VERBOSE)
ENUM_RE = re.compile(r""" ENUM_RE = re.compile(r"""
( (
enum enum
@ -268,7 +271,6 @@ ENUM_RE = re.compile(r"""
) # capture group end ) # capture group end
""", re.MULTILINE | re.DOTALL | re.VERBOSE) """, re.MULTILINE | re.DOTALL | re.VERBOSE)
ENUM_KEY_REP = regex_partial(r""" ENUM_KEY_REP = regex_partial(r"""
( (
{} # the prefixes {} # the prefixes
@ -309,14 +311,13 @@ def parse_valid_keys(config, out_path):
include_path = os.path.join(dirpath, include) include_path = os.path.join(dirpath, include)
if os.path.exists(include_path): if os.path.exists(include_path):
header_data = read_header_file(include_path) header_data = read_header_file(include_path)
valid_keycodes.update( valid_keycodes.update(parse_keydefs(config, header_data))
parse_keydefs(config, header_data)
)
return valid_keycodes return valid_keycodes
# Keymap Parsing # Keymap Parsing
def iter_raw_codes(layer_lines, filler, separator): def iter_raw_codes(layer_lines, filler, separator):
filler_re = re.compile("[" + filler + " ]") filler_re = re.compile("[" + filler + " ]")
for line in layer_lines: for line in layer_lines:
@ -346,28 +347,21 @@ LAYER_CHANGE_RE = re.compile(r"""
(DF|TG|MO)\(\d+\) (DF|TG|MO)\(\d+\)
""", re.VERBOSE) """, re.VERBOSE)
MACRO_RE = re.compile(r""" MACRO_RE = re.compile(r"""
M\(\w+\) M\(\w+\)
""", re.VERBOSE) """, re.VERBOSE)
UNICODE_RE = re.compile(r""" UNICODE_RE = re.compile(r"""
U[0-9A-F]{4} U[0-9A-F]{4}
""", re.VERBOSE) """, re.VERBOSE)
NON_CODE = re.compile(r""" NON_CODE = re.compile(r"""
^[^A-Z0-9_]$ ^[^A-Z0-9_]$
""", re.VERBOSE) """, re.VERBOSE)
def parse_uni_code(raw_code): def parse_uni_code(raw_code):
macro_id = "UC_" + ( macro_id = "UC_" + (unicodedata.name(raw_code).replace(" ", "_").replace("-", "_"))
unicodedata.name(raw_code)
.replace(" ", "_")
.replace("-", "_")
)
code = "M({})".format(macro_id) code = "M({})".format(macro_id)
uc_hex = "{:04X}".format(ord(raw_code)) uc_hex = "{:04X}".format(ord(raw_code))
return code, macro_id, uc_hex 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): def parse_keymap(config, key_indexes, layer_lines, valid_keycodes):
keymap = {} keymap = {}
raw_codes = list(iter_raw_codes( raw_codes = list(iter_raw_codes(layer_lines, config['filler'], config['separator']))
layer_lines, config['filler'], config['separator']
))
indexed_codes = iter_indexed_codes(raw_codes, key_indexes) indexed_codes = iter_indexed_codes(raw_codes, key_indexes)
key_prefixes = config['key_prefixes'] key_prefixes = config['key_prefixes']
for raw_code, key_index, row_index in indexed_codes: for raw_code, key_index, row_index in indexed_codes:
code, macro_id, uc_hex = parse_code( code, macro_id, uc_hex = parse_code(raw_code, key_prefixes, valid_keycodes)
raw_code, key_prefixes, valid_keycodes
)
# TODO: line numbers for invalid codes # TODO: line numbers for invalid codes
err_msg = "Could not parse key '{}' on row {}".format( err_msg = "Could not parse key '{}' on row {}".format(raw_code, row_index)
raw_code, row_index
)
assert code is not None, err_msg assert code is not None, err_msg
# print(repr(raw_code), repr(code), macro_id, uc_hex) # print(repr(raw_code), repr(code), macro_id, uc_hex)
if macro_id: if macro_id:
@ -432,17 +420,14 @@ def parse_keymap(config, key_indexes, layer_lines, valid_keycodes):
def parse_keymaps(config, valid_keycodes): def parse_keymaps(config, valid_keycodes):
keymaps = collections.OrderedDict() keymaps = collections.OrderedDict()
key_indexes = config.get( key_indexes = config.get('key_indexes', KEYBOARD_LAYOUTS[config['layout']])
'key_indexes', KEYBOARD_LAYOUTS[config['layout']]
)
# TODO: maybe validate key_indexes # TODO: maybe validate key_indexes
for layer_name, layer_lines, in config['layer_lines'].items(): for layer_name, layer_lines, in config['layer_lines'].items():
keymaps[layer_name] = parse_keymap( keymaps[layer_name] = parse_keymap(config, key_indexes, layer_lines, valid_keycodes)
config, key_indexes, layer_lines, valid_keycodes
)
return keymaps return keymaps
# keymap.c output # keymap.c output
USERCODE = """ USERCODE = """
@ -453,7 +438,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_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 = """ UNICODE_MACRO_TEMPLATE = """
case {macro_id}: case {macro_id}:
unicode_action_function(0x{hi:02x}, 0x{lo:02x}); 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(): for macro_id, uc_hex in config['unicode_macros'].items():
hi = int(uc_hex, 16) >> 8 hi = int(uc_hex, 16) >> 8
lo = int(uc_hex, 16) & 0xFF lo = int(uc_hex, 16) & 0xFF
yield UNICODE_MACRO_TEMPLATE.format( yield UNICODE_MACRO_TEMPLATE.format(macro_id=macro_id, hi=hi, lo=lo)
macro_id=macro_id, hi=hi, lo=lo
)
def iter_keymap_lines(keymap, row_indents=None): def iter_keymap_lines(keymap, row_indents=None):

View file

@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
layer_state_t layer_state_set_user(layer_state_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 BASE: case BASE:
rgblight_sethsv(HSV_ERGOSLAB_ORANGE); rgblight_sethsv(HSV_ERGOSLAB_ORANGE);

View file

@ -102,7 +102,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
edit = false; edit = false;
} }
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _ADJUST: case _ADJUST:
temp_config.mode = rgblight_get_mode(); temp_config.mode = rgblight_get_mode();
rgblight_mode_noeeprom(1); rgblight_mode_noeeprom(1);

View file

@ -121,7 +121,7 @@ layer_state_t layer_state_set_user(layer_state_t state)
edit = false; edit = false;
} }
switch (biton32(state)) switch (get_highest_layer(state))
{ {
case _ADJUST: case _ADJUST:
mode = rgblight_get_mode(); mode = rgblight_get_mode();

View file

@ -146,8 +146,8 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_user(void) { void matrix_scan_user(void) {
//uint8_t layer = biton32(layer_state); //uint8_t layer = get_highest_layer(layer_state);
biton32(layer_state); get_highest_layer(layer_state);
}; };
@ -171,4 +171,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return true; return true;
}; };

View file

@ -101,7 +101,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint32_t layer = layer_state; layer_state_t layer = layer_state;
if (layer & (1<<1)) { if (layer & (1<<1)) {
gh60_fn_led_on(); gh60_fn_led_on();
@ -120,4 +120,4 @@ void matrix_scan_user(void) {
} else { } else {
gh60_esc_led_off(); gh60_esc_led_off();
} }
}; };

View file

@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_scan_user(void) { void matrix_scan_user(void) {
//Layer LED indicators //Layer LED indicators
uint32_t layer = layer_state; layer_state_t layer = layer_state;
if (layer & (1<<1)) { if (layer & (1<<1)) {
gh60_wasd_leds_on(); gh60_wasd_leds_on();

View file

@ -97,7 +97,7 @@ void matrix_scan_user(void) {
// Layer LED indicators // Layer LED indicators
// ESC led on when in function layer, WASD cluster leds enabled when on arrow cluster // 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)) { if (layer & (1<<1)) {
gh60_wasd_leds_on(); gh60_wasd_leds_on();
} else { } else {

View file

@ -177,7 +177,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
if (old_layer != layer) { if (old_layer != layer) {
switch (layer) { switch (layer) {

View file

@ -131,7 +131,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
switch (layer) { switch (layer) {
case _QWERTY: case _QWERTY:

View file

@ -158,7 +158,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
switch (layer) { switch (layer) {
case _QWERTY: case _QWERTY:

View file

@ -151,7 +151,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
switch (layer) { switch (layer) {
case _QWERTY: case _QWERTY:

View file

@ -241,7 +241,7 @@ void matrix_scan_user(void) {
} }
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _BL: case _BL:
custom_backlight_level(0); custom_backlight_level(0);
break; break;

View file

@ -209,7 +209,7 @@ void press_underscore(void) {
uint8_t old_layer=_BASE; uint8_t old_layer=_BASE;
void matrix_scan_user(void) { 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_1_off();
frenchdev_led_2_off(); frenchdev_led_2_off();

View file

@ -89,7 +89,7 @@ void matrix_init_user(void) {
} }
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
if (layer) { if (layer) {
PORTC |= _BV(PC7); PORTC |= _BV(PC7);
} else { } else {

View file

@ -87,7 +87,7 @@ void led_set_user(uint8_t usb_led) {
//function for layer indicator LED //function for layer indicator LED
layer_state_t layer_state_set_user(layer_state_t state) layer_state_t layer_state_set_user(layer_state_t state)
{ {
if (biton32(state) == 1) { if (get_highest_layer(state) == 1) {
writePinHigh(C6); writePinHigh(C6);
} else { } else {
writePinLow(C6); writePinLow(C6);

View file

@ -529,7 +529,7 @@ void led_reset(void) {
} }
void led_set_default_layer_indicator(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) { if (default_layer == _QWERTY) {
rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY); rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY);
rgbsps_set(LED_IND_ALT, COLOR_BLANK); 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_GREEK, COLOR_BLANK);
rgbsps_set(LED_IND_EMOJI, 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) { if (oldlayer == layer) {
return; return;
} }
@ -1014,7 +1014,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
lshift = keyboard_report->mods & MOD_BIT(KC_LSFT); lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
rshift = keyboard_report->mods & MOD_BIT(KC_RSFT); rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
layer = biton32(layer_state); layer = get_highest_layer(layer_state);
#ifdef DOUBLESPACE_LAYER_ENABLE #ifdef DOUBLESPACE_LAYER_ENABLE
// double-space: send space immediately if any other key depressed before space is released // double-space: send space immediately if any other key depressed before space is released

View file

@ -532,7 +532,7 @@ void led_reset(void) {
} }
void led_set_default_layer_indicator(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) { if (default_layer == _QWERTY) {
rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY); rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY);
rgbsps_set(LED_IND_ALT, COLOR_BLANK); 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_GREEK, COLOR_BLANK);
rgbsps_set(LED_IND_EMOJI, 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) { if (oldlayer == layer) {
return; return;
} }
@ -989,7 +989,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_kb(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))) {
@ -1017,7 +1017,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
lshift = keyboard_report->mods & MOD_BIT(KC_LSFT); lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
rshift = keyboard_report->mods & MOD_BIT(KC_RSFT); rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
layer = biton32(layer_state); layer = get_highest_layer(layer_state);
#ifdef DOUBLESPACE_LAYER_ENABLE #ifdef DOUBLESPACE_LAYER_ENABLE
// double-space: send space immediately if any other key depressed before space is released // double-space: send space immediately if any other key depressed before space is released

View file

@ -219,7 +219,7 @@ void LayerLEDSet(uint8_t layr) {
uint8_t old_layer = _QW; uint8_t old_layer = _QW;
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
if (old_layer != layer) { if (old_layer != layer) {
LayerLEDSet(layer); LayerLEDSet(layer);

View file

@ -9,7 +9,7 @@ void keyboard_pre_init_user(void)
layer_state_t layer_state_set_user(layer_state_t state) layer_state_t layer_state_set_user(layer_state_t state)
{ {
// Switch layer LED accordingly // Switch layer LED accordingly
switch (biton32(state)) { switch (get_highest_layer(state)) {
case 0: case 0:
writePinHigh(B0); writePinHigh(B0);
break; break;

View file

@ -242,7 +242,7 @@ float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
static int current_default_layer; 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<<_QWERTY - 1 == 1 - 1 == _QWERTY (=0)
// 1<<_COLEMAK - 1 == 2 - 1 == _COLEMAK (=1) // 1<<_COLEMAK - 1 == 2 - 1 == _COLEMAK (=1)
current_default_layer = state - 1; current_default_layer = state - 1;

View file

@ -86,7 +86,7 @@ static void render_layer_status(void) {
break; break;
default: default:
oled_write_P(PSTR("Undef-"), false); 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(buf, false);
} }
oled_write_P(PSTR("\n"), false); oled_write_P(PSTR("\n"), false);

View file

@ -5,9 +5,9 @@
// keymaps definitions are moved to keymap_Xrows.c. // keymaps definitions are moved to keymap_Xrows.c.
#ifdef RGBLIGHT_ENABLE #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); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
switch (biton32(state)) { switch (get_highest_layer(state)) {
case L_EDVORAKJP_LOWER: case L_EDVORAKJP_LOWER:
rgblight_sethsv_noeeprom_red(); rgblight_sethsv_noeeprom_red();
break; break;

View file

@ -19,7 +19,7 @@ void render_layer_state(void) {
char layer_name[17]; char layer_name[17];
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case L_EDVORAKJP_BASE: case L_EDVORAKJP_BASE:
oled_write_ln_P(PSTR("Default"), false); oled_write_ln_P(PSTR("Default"), false);
break; break;

View file

@ -379,8 +379,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
int current_default_layer; 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); current_default_layer = get_highest_layer(state);
return state; return state;
} }

View file

@ -379,8 +379,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
int current_default_layer; 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); current_default_layer = get_highest_layer(state);
return state; return state;
} }

View file

@ -245,7 +245,7 @@ void matrix_scan_user(void) {
} }
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _BL: case _BL:
custom_backlight_level(0); custom_backlight_level(0);
rgblight_sethsv_noeeprom(180,100,255); rgblight_sethsv_noeeprom(180,100,255);

View file

@ -163,7 +163,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_user(void) { 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_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();

View file

@ -170,7 +170,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -189,7 +189,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -167,7 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -335,7 +335,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = get_highest_layer(layer_state);
ergodox_board_led_on(); ergodox_board_led_on();
ergodox_led_all_on(); ergodox_led_all_on();

View file

@ -492,7 +492,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -223,7 +223,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -659,7 +659,7 @@ void matrix_setup(void) {
} }
void matrix_scan_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_board_led_off();
// ergodox_right_led_1_off(); // ergodox_right_led_1_off();

View file

@ -221,7 +221,7 @@ void matrix_init_user(void){
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -179,7 +179,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -309,7 +309,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -137,7 +137,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_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_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();

View file

@ -239,7 +239,7 @@ void matrix_scan_user(void) {
//Turn on layer indicator or page depending on mode //Turn on layer indicator or page depending on mode
switch(led_mode_global) { switch(led_mode_global) {
case MODE_FLASH: //flash preset page leds then single indicator 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; msg=(page << 8) | DISPLAY_PAGE;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE); chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
chThdSleepMilliseconds(500); chThdSleepMilliseconds(500);
@ -254,7 +254,7 @@ void matrix_scan_user(void) {
break; break;
case MODE_PAGE: //display pre-defined led page 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; msg=(page << 8) | DISPLAY_PAGE;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE); chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
break; break;

View file

@ -224,7 +224,7 @@ void matrix_scan_user(void) {
} }
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _BL: case _BL:
custom_backlight_level(0); custom_backlight_level(0);
rgblight_sethsv_noeeprom(180,100,255); rgblight_sethsv_noeeprom(180,100,255);

View file

@ -253,7 +253,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
} }
if (index == 1) { /* Second encoder, Left side */ if (index == 1) { /* Second encoder, Left side */
switch(biton32(layer_state)) { switch(get_highest_layer(layer_state)) {
case _LOWER: case _LOWER:
if (clockwise) { if (clockwise) {
rgblight_decrease_hue(); rgblight_decrease_hue();

View file

@ -255,7 +255,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
} }
if (index == 1) { /* Second encoder, Left side */ if (index == 1) { /* Second encoder, Left side */
switch(biton32(layer_state)) { switch(get_highest_layer(layer_state)) {
case _LOWER: case _LOWER:
if (clockwise) { if (clockwise) {
rgblight_decrease_hue(); rgblight_decrease_hue();

View file

@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
bool oled_task_user(void) { bool oled_task_user(void) {
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case BASE: case BASE:
oled_write_P(PSTR("Default\n"), false); oled_write_P(PSTR("Default\n"), false);
break; break;

View file

@ -175,7 +175,7 @@ void matrix_scan_user(void) {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
bool oled_task_user(void) { bool oled_task_user(void) {
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case BASE: case BASE:
oled_write_P(PSTR("Default\n"), false); oled_write_P(PSTR("Default\n"), false);
break; break;

View file

@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
bool oled_task_user(void) { bool oled_task_user(void) {
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case BASE: case BASE:
oled_write_P(PSTR("Default\n"), false); oled_write_P(PSTR("Default\n"), false);
break; break;

View file

@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
bool oled_task_user(void) { bool oled_task_user(void) {
oled_write_P(PSTR("Layer: "), false); oled_write_P(PSTR("Layer: "), false);
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case BASE: case BASE:
oled_write_P(PSTR("Default\n"), false); oled_write_P(PSTR("Default\n"), false);
break; break;

View file

@ -38,7 +38,7 @@ void eeconfig_init_user(void) {
#define DE_UDIA_CAP UC(0x00DC) #define DE_UDIA_CAP UC(0x00DC)
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case NM_MODE: case NM_MODE:
rgblight_setrgb (0x00, 0x66, 0x00); rgblight_setrgb (0x00, 0x66, 0x00);
break; break;
@ -187,4 +187,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______ _______, _______, _______, _______, _______, _______, _______
), ),
}; };

View file

@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case WINDOWS_LAYER: case WINDOWS_LAYER:
rgblight_setrgb_blue(); rgblight_setrgb_blue();
break; break;

View file

@ -8,7 +8,7 @@
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -103,8 +103,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_EQL, S(KC_EQL), RALT(KC_2), RALT(KC_3), RALT(KC_4), RALT(KC_E), KC_RBRC, RALT(KC_7), RALT(KC_8), RALT(KC_9), RALT(KC_0), RALT(KC_MINS), KC_EQL, S(KC_EQL), RALT(KC_2), RALT(KC_3), RALT(KC_4), RALT(KC_E), KC_RBRC, RALT(KC_7), RALT(KC_8), RALT(KC_9), RALT(KC_0), RALT(KC_MINS),
KC_LSFT, KC_NUBS, RALT(KC_NUBS), S(KC_NUBS), DGRMCRO, XXXXXXX, XXXXXXX, RALT(KC_M), KC_RBRC, S(KC_RBRC), RALT(KC_RBRC), _______, KC_LSFT, KC_NUBS, RALT(KC_NUBS), S(KC_NUBS), DGRMCRO, XXXXXXX, XXXXXXX, RALT(KC_M), KC_RBRC, S(KC_RBRC), RALT(KC_RBRC), _______,
_______, _______, KC_RALT, _______,TO(_ADJUST), _______, _______, _______, _______, _______, _______, TO(_QWERTY) _______, _______, KC_RALT, _______,TO(_ADJUST), _______, _______, _______, _______, _______, _______, TO(_QWERTY)
), ),
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -257,10 +257,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
else { else {
workmode = false; workmode = false;
return false; return false;
} }
} }
} }
return true; return true;
} }
@ -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) { layer_state_t layer_state_set_user(layer_state_t state) {
// if(rgblight_get_mode() == 1) { // if(rgblight_get_mode() == 1) {
switch (biton32(state)) { switch (get_highest_layer(state)) {
case _QWERTY: case _QWERTY:
if(!workmode){ if(!workmode){
rgblight_mode(9); rgblight_mode(9);
@ -312,7 +312,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
tap_code(KC_NLCK); tap_code(KC_NLCK);
} }
rgbflag(0xFF, 0x00, 0x00); rgbflag(0xFF, 0x00, 0x00);
break; break;
case _ADJUST: case _ADJUST:
rgblight_mode(1); rgblight_mode(1);
@ -350,7 +350,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
rgblight_mode(1); rgblight_mode(1);
if(bnumlock) { if(bnumlock) {
tap_code(KC_NLCK); tap_code(KC_NLCK);
} }
rgbflag(0xFF, 0xFF, 0xFF); rgbflag(0xFF, 0xFF, 0xFF);
break; break;
} }
@ -363,8 +363,8 @@ layer_state_t layer_state_set_user(layer_state_t state) {
//Layer LED indicators //Layer LED indicators
uint32_t layer = layer_state; uint32_t layer = layer_state;
if (layer & (1<<2)) { if (layer & (1<<2)) {
if(!bnumlock) { if(!bnumlock) {
numlock_changed = true; numlock_changed = true;
@ -373,10 +373,10 @@ layer_state_t layer_state_set_user(layer_state_t state) {
bnumlock = true; bnumlock = true;
} }
} }
} }
*/ */
void led_set_user(uint8_t usb_led) { void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) { if (usb_led & (1 << USB_LED_NUM_LOCK)) {
@ -410,4 +410,4 @@ void led_set_user(uint8_t usb_led) {
} }
} }

View file

@ -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) { void set_state_leds(void) {
if (rgblight_get_mode() == 1) { if (rgblight_get_mode() == 1) {
switch (biton32(layer_state)) { switch (get_highest_layer(layer_state)) {
case _RAISE: case _RAISE:
rgbflag(C_BLU, C_GRN); rgbflag(C_BLU, C_GRN);
break; break;

Some files were not shown because too many files have changed in this diff Show more