diff options
Diffstat (limited to 'keyboards/ergodox_ez')
22 files changed, 73 insertions, 94 deletions
diff --git a/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c b/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c index a5b107baae..91798ab188 100755 --- a/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c +++ b/keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c @@ -190,7 +190,7 @@ static bool is_macro1_recording = false; // The current set of active layers (as a bitmask). // There is a global 'layer_state' variable but it is set after the call // to layer_state_set_user(). -static uint32_t current_layer_state = 0; +static layer_state_t current_layer_state = 0; layer_state_t layer_state_set_user(layer_state_t state); // Method called at the end of the tap dance on the TAP_MACRO key. That key is diff --git a/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c b/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c index 5c08d30727..67c50eb129 100644 --- a/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c +++ b/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c @@ -200,7 +200,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); @@ -262,4 +262,3 @@ void matrix_scan_user(void) { // } // return true; //} - diff --git a/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c index 229ece0d74..eff7f111b4 100644 --- a/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c +++ b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c @@ -98,7 +98,7 @@ static bool is_macro1_recording = false; // The current set of active layers (as a bitmask). // There is a global 'layer_state' variable but it is set after the call // to layer_state_set_user(). -static uint32_t current_layer_state = 0; +static layer_state_t current_layer_state = 0; layer_state_t layer_state_set_user(layer_state_t state); // Method called at the end of the tap dance on the TAP_MACRO key. That key is diff --git a/keyboards/ergodox_ez/keymaps/default_osx/keymap.c b/keyboards/ergodox_ez/keymaps/default_osx/keymap.c index 73b1077b83..3ab66078fe 100644 --- a/keyboards/ergodox_ez/keymaps/default_osx/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default_osx/keymap.c @@ -141,7 +141,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c index fab2977356..ff9ae77bdd 100644 --- a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c +++ b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c @@ -725,7 +725,7 @@ void led_set_user(uint8_t usb_led) { void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_2_off(); diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c index fd022681b0..ed407def79 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c @@ -1,6 +1,6 @@ layer_state_t layer_state_set_user(layer_state_t state) { - uint8_t layer = biton32(state); + uint8_t layer = get_highest_layer(state); switch (layer) { case DVORAK: diff --git a/keyboards/ergodox_ez/keymaps/heartrobotninja/keymap.c b/keyboards/ergodox_ez/keymaps/heartrobotninja/keymap.c index b6edc17532..91884c8e76 100644 --- a/keyboards/ergodox_ez/keymaps/heartrobotninja/keymap.c +++ b/keyboards/ergodox_ez/keymaps/heartrobotninja/keymap.c @@ -370,7 +370,7 @@ LEADER_EXTERNS(); void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); if (keyboard_report->mods & MOD_BIT(KC_LSFT) || ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && @@ -677,4 +677,4 @@ void matrix_init_user(void) wait_ms(1000); rgblight_effect_knight(50); -}
\ No newline at end of file +} diff --git a/keyboards/ergodox_ez/keymaps/kou/keymap.c b/keyboards/ergodox_ez/keymaps/kou/keymap.c index c8d0a6b5dd..01427c2d2d 100644 --- a/keyboards/ergodox_ez/keymaps/kou/keymap.c +++ b/keyboards/ergodox_ez/keymaps/kou/keymap.c @@ -284,7 +284,7 @@ void matrix_init_user(void) { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/lukaus/keymap.c b/keyboards/ergodox_ez/keymaps/lukaus/keymap.c index 5d797beb18..542e123db3 100644 --- a/keyboards/ergodox_ez/keymaps/lukaus/keymap.c +++ b/keyboards/ergodox_ez/keymaps/lukaus/keymap.c @@ -813,7 +813,7 @@ case RU_7: layer_state_t layer_state_set_user(layer_state_t state) { - uint8_t layer = biton32(state); + uint8_t layer = get_highest_layer(state); // ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/matrixman/keymap.c b/keyboards/ergodox_ez/keymaps/matrixman/keymap.c index 10b6567cdb..bb6ba5ae34 100644 --- a/keyboards/ergodox_ez/keymaps/matrixman/keymap.c +++ b/keyboards/ergodox_ez/keymaps/matrixman/keymap.c @@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c b/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c index e31391a674..a3c2176951 100644 --- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c +++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c @@ -218,7 +218,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; layer_state_t layer_state_set_user(layer_state_t state) { - uint8_t layer = biton32(state); + uint8_t layer = get_highest_layer(state); ergodox_board_led_off(); ergodox_right_led_1_off(); ergodox_right_led_2_off(); @@ -431,4 +431,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - diff --git a/keyboards/ergodox_ez/keymaps/nfriend/keymap.c b/keyboards/ergodox_ez/keymaps/nfriend/keymap.c index 1d12093bab..ba578dd1c5 100644 --- a/keyboards/ergodox_ez/keymaps/nfriend/keymap.c +++ b/keyboards/ergodox_ez/keymaps/nfriend/keymap.c @@ -1057,7 +1057,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } layer_state_t layer_state_set_user(layer_state_t state) { - uint8_t layer = biton32(state); + uint8_t layer = get_highest_layer(state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/profet_80/keymap.c b/keyboards/ergodox_ez/keymaps/profet_80/keymap.c index 85455fa9d9..6f602e828e 100644 --- a/keyboards/ergodox_ez/keymaps/profet_80/keymap.c +++ b/keyboards/ergodox_ez/keymaps/profet_80/keymap.c @@ -157,7 +157,7 @@ void matrix_init_user(void) { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/pvinis/keymap.c b/keyboards/ergodox_ez/keymaps/pvinis/keymap.c index 024cefd270..c69621ab98 100644 --- a/keyboards/ergodox_ez/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox_ez/keymaps/pvinis/keymap.c @@ -245,11 +245,11 @@ void keyboard_post_init_user_keymap(void) { } // light up leds based on the layer -uint32_t layer_state_set_user_keymap(uint32_t state) { +layer_state_t layer_state_set_user_keymap(layer_state_t state) { ergodox_right_led_1_off(); ergodox_right_led_2_off(); ergodox_right_led_3_off(); - switch (biton32(state)) { + switch (get_highest_layer(state)) { case LR_SYSCTL: ergodox_right_led_3_on(); // blue break; @@ -306,7 +306,7 @@ uint32_t layer_state_set_user_keymap(uint32_t state) { // SYSCTL on first tap, MOUSE ON second tap // void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) { -// uint8_t layer = biton32(layer_state); +// uint8_t layer = get_highest_layer(layer_state); // switch(state->count) { // case 1: diff --git a/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c b/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c index 3e607edb39..595f3b4ee1 100644 --- a/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c +++ b/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c @@ -228,7 +228,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { ergodox_right_led_1_off(); ergodox_right_led_2_off(); ergodox_right_led_3_off(); - switch (biton32(state)) { + switch (get_highest_layer(state)) { case SYMB: ergodox_right_led_1_on(); if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); } @@ -268,4 +268,3 @@ layer_state_t layer_state_set_user(layer_state_t state) { } return state; } - diff --git a/keyboards/ergodox_ez/keymaps/rishka/keymap.c b/keyboards/ergodox_ez/keymaps/rishka/keymap.c index 102803e512..0d6ac9fe95 100644 --- a/keyboards/ergodox_ez/keymaps/rishka/keymap.c +++ b/keyboards/ergodox_ez/keymaps/rishka/keymap.c @@ -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(); diff --git a/keyboards/ergodox_ez/keymaps/skug/keymap.c b/keyboards/ergodox_ez/keymaps/skug/keymap.c index 1446ea7466..04aa6a99fd 100644 --- a/keyboards/ergodox_ez/keymaps/skug/keymap.c +++ b/keyboards/ergodox_ez/keymaps/skug/keymap.c @@ -228,7 +228,7 @@ void matrix_init_user(void) { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/smurmann/keymap.c b/keyboards/ergodox_ez/keymaps/smurmann/keymap.c index 42ac13775f..c8ddc23a8b 100644 --- a/keyboards/ergodox_ez/keymaps/smurmann/keymap.c +++ b/keyboards/ergodox_ez/keymaps/smurmann/keymap.c @@ -139,7 +139,7 @@ void matrix_init_user(void) { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); if(layer == 1) { @@ -157,7 +157,7 @@ void matrix_scan_user(void) { } if(keyboard_report->mods & MOD_BIT(KC_LSFT)) - { + { ergodox_right_led_1_set (LED_BRIGHTNESS_HI); ergodox_right_led_1_on (); } else { @@ -182,7 +182,7 @@ void matrix_scan_user(void) { } if(keyboard_report->mods & MOD_BIT(KC_LCTRL)) - { + { ergodox_right_led_3_set (LED_BRIGHTNESS_HI); ergodox_right_led_3_on (); } else { @@ -195,7 +195,7 @@ void matrix_scan_user(void) { }; 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; }else { diff --git a/keyboards/ergodox_ez/keymaps/steno/keymap.c b/keyboards/ergodox_ez/keymaps/steno/keymap.c index 080d3f6cef..96218bbe99 100644 --- a/keyboards/ergodox_ez/keymaps/steno/keymap.c +++ b/keyboards/ergodox_ez/keymaps/steno/keymap.c @@ -228,7 +228,7 @@ void matrix_init_user(void) { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/testing/keymap.c b/keyboards/ergodox_ez/keymaps/testing/keymap.c index 5c1fc4af28..3aee63ddf1 100644 --- a/keyboards/ergodox_ez/keymaps/testing/keymap.c +++ b/keyboards/ergodox_ez/keymaps/testing/keymap.c @@ -62,7 +62,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_state_t layer_state_set_user(layer_state_t state) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/keymaps/vim/keymap.c b/keyboards/ergodox_ez/keymaps/vim/keymap.c index 948f2b4794..c1c037ef23 100644 --- a/keyboards/ergodox_ez/keymaps/vim/keymap.c +++ b/keyboards/ergodox_ez/keymaps/vim/keymap.c @@ -330,7 +330,7 @@ void matrix_init_user(void) { }; void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); diff --git a/keyboards/ergodox_ez/util/compile_keymap.py b/keyboards/ergodox_ez/util/compile_keymap.py index b447ecaf5c..310512c920 100755 --- a/keyboards/ergodox_ez/util/compile_keymap.py +++ b/keyboards/ergodox_ez/util/compile_keymap.py @@ -27,29 +27,34 @@ PY2 = sys.version_info.major == 2 if PY2: chr = unichr - KEYBOARD_LAYOUTS = { # These map positions in the parsed layout to # positions in the KEYMAP MATRIX 'ergodox_ez': [ - [ 0, 1, 2, 3, 4, 5, 6], [38, 39, 40, 41, 42, 43, 44], - [ 7, 8, 9, 10, 11, 12, 13], [45, 46, 47, 48, 49, 50, 51], - [14, 15, 16, 17, 18, 19 ], [ 52, 53, 54, 55, 56, 57], - [20, 21, 22, 23, 24, 25, 26], [58, 59, 60, 61, 62, 63, 64], - [27, 28, 29, 30, 31 ], [ 65, 66, 67, 68, 69], - [ 32, 33], [70, 71 ], - [ 34], [72 ], - [ 35, 36, 37], [73, 74, 75 ], + [0, 1, 2, 3, 4, 5, 6], + [38, 39, 40, 41, 42, 43, 44], + [7, 8, 9, 10, 11, 12, 13], + [45, 46, 47, 48, 49, 50, 51], + [14, 15, 16, 17, 18, 19], + [52, 53, 54, 55, 56, 57], + [20, 21, 22, 23, 24, 25, 26], + [58, 59, 60, 61, 62, 63, 64], + [27, 28, 29, 30, 31], + [65, 66, 67, 68, 69], + [32, 33], + [70, 71], + [34], + [72], + [35, 36, 37], + [73, 74, 75], ] } -ROW_INDENTS = { - 'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0] -} +ROW_INDENTS = {'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]} BLANK_LAYOUTS = [ -# Compact Layout -""" + # Compact Layout + """ .------------------------------------.------------------------------------. | | | | | | | | | | | | | | | !-----+----+----+----+----+----------!-----+----+----+----+----+----+-----! @@ -70,8 +75,8 @@ BLANK_LAYOUTS = [ '-----------------' '-----------------' """, -# Wide Layout -""" + # Wide Layout + """ .---------------------------------------------. .---------------------------------------------. | | | | | | | | ! | | | | | | | !-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------! @@ -93,26 +98,22 @@ BLANK_LAYOUTS = [ """, ] - DEFAULT_CONFIG = { - "keymaps_includes": [ - "keymap_common.h", - ], + "keymaps_includes": ["keymap_common.h",], 'filler': "-+.'!:x", 'separator': "|", 'default_key_prefix': ["KC_"], } - SECTIONS = [ 'layout_config', 'layers', ] - # Markdown Parsing -ONELINE_COMMENT_RE = re.compile(r""" +ONELINE_COMMENT_RE = re.compile( + r""" ^ # comment must be at the start of the line \s* # arbitrary whitespace // # start of the comment @@ -121,22 +122,26 @@ ONELINE_COMMENT_RE = re.compile(r""" """, re.MULTILINE | re.VERBOSE ) -INLINE_COMMENT_RE = re.compile(r""" +INLINE_COMMENT_RE = re.compile( + r""" ([\,\"\[\]\{\}\d]) # anythig that might end a expression \s+ # comment must be preceded by whitespace // # start of the comment \s # and succeded by whitespace (?:[^\"\]\}\{\[]*) # the comment (except things which might be json) $ # until the end of line -""", re.MULTILINE | re.VERBOSE) +""", re.MULTILINE | re.VERBOSE +) -TRAILING_COMMA_RE = re.compile(r""" +TRAILING_COMMA_RE = re.compile( + r""" , # the comma (?:\s*) # arbitrary whitespace $ # only works if the trailing comma is followed by newline (\s*) # arbitrary whitespace ([\]\}]) # end of an array or object -""", re.MULTILINE | re.VERBOSE) +""", re.MULTILINE | re.VERBOSE +) def loads(raw_data): @@ -178,9 +183,7 @@ def parse_config(path): def end_section(): if section['start_line'] >= 0: if section['name'] == 'layout_config': - config.update(loads("\n".join( - section['code_lines'] - ))) + config.update(loads("\n".join(section['code_lines']))) elif section['sub_name'].startswith('layer'): layer_name = section['sub_name'] config['layer_lines'][layer_name] = section['code_lines'] @@ -215,6 +218,7 @@ def parse_config(path): assert 'layout' in config return config + # header file parsing IF0_RE = re.compile(r""" @@ -224,7 +228,6 @@ IF0_RE = re.compile(r""" #endif """, re.MULTILINE | re.DOTALL | re.VERBOSE) - COMMENT_RE = re.compile(r""" /\* .*? @@ -244,6 +247,7 @@ def regex_partial(re_str_fmt, flags): def partial(*args, **kwargs): re_str = re_str_fmt.format(*args, **kwargs) return re.compile(re_str, flags) + return partial @@ -256,7 +260,6 @@ KEYDEF_REP = regex_partial(r""" ) # capture group end """, re.MULTILINE | re.DOTALL | re.VERBOSE) - ENUM_RE = re.compile(r""" ( enum @@ -268,7 +271,6 @@ ENUM_RE = re.compile(r""" ) # capture group end """, re.MULTILINE | re.DOTALL | re.VERBOSE) - ENUM_KEY_REP = regex_partial(r""" ( {} # the prefixes @@ -309,14 +311,13 @@ def parse_valid_keys(config, out_path): include_path = os.path.join(dirpath, include) if os.path.exists(include_path): header_data = read_header_file(include_path) - valid_keycodes.update( - parse_keydefs(config, header_data) - ) + valid_keycodes.update(parse_keydefs(config, header_data)) return valid_keycodes # Keymap Parsing + def iter_raw_codes(layer_lines, filler, separator): filler_re = re.compile("[" + filler + " ]") for line in layer_lines: @@ -346,28 +347,21 @@ LAYER_CHANGE_RE = re.compile(r""" (DF|TG|MO)\(\d+\) """, re.VERBOSE) - MACRO_RE = re.compile(r""" M\(\w+\) """, re.VERBOSE) - UNICODE_RE = re.compile(r""" U[0-9A-F]{4} """, re.VERBOSE) - NON_CODE = re.compile(r""" ^[^A-Z0-9_]$ """, re.VERBOSE) def parse_uni_code(raw_code): - macro_id = "UC_" + ( - unicodedata.name(raw_code) - .replace(" ", "_") - .replace("-", "_") - ) + macro_id = "UC_" + (unicodedata.name(raw_code).replace(" ", "_").replace("-", "_")) code = "M({})".format(macro_id) uc_hex = "{:04X}".format(ord(raw_code)) return code, macro_id, uc_hex @@ -407,19 +401,13 @@ def parse_code(raw_code, key_prefixes, valid_keycodes): def parse_keymap(config, key_indexes, layer_lines, valid_keycodes): keymap = {} - raw_codes = list(iter_raw_codes( - layer_lines, config['filler'], config['separator'] - )) + raw_codes = list(iter_raw_codes(layer_lines, config['filler'], config['separator'])) indexed_codes = iter_indexed_codes(raw_codes, key_indexes) key_prefixes = config['key_prefixes'] for raw_code, key_index, row_index in indexed_codes: - code, macro_id, uc_hex = parse_code( - raw_code, key_prefixes, valid_keycodes - ) + code, macro_id, uc_hex = parse_code(raw_code, key_prefixes, valid_keycodes) # TODO: line numbers for invalid codes - err_msg = "Could not parse key '{}' on row {}".format( - raw_code, row_index - ) + err_msg = "Could not parse key '{}' on row {}".format(raw_code, row_index) assert code is not None, err_msg # print(repr(raw_code), repr(code), macro_id, uc_hex) if macro_id: @@ -432,17 +420,14 @@ def parse_keymap(config, key_indexes, layer_lines, valid_keycodes): def parse_keymaps(config, valid_keycodes): keymaps = collections.OrderedDict() - key_indexes = config.get( - 'key_indexes', KEYBOARD_LAYOUTS[config['layout']] - ) + key_indexes = config.get('key_indexes', KEYBOARD_LAYOUTS[config['layout']]) # TODO: maybe validate key_indexes for layer_name, layer_lines, in config['layer_lines'].items(): - keymaps[layer_name] = parse_keymap( - config, key_indexes, layer_lines, valid_keycodes - ) + keymaps[layer_name] = parse_keymap(config, key_indexes, layer_lines, valid_keycodes) return keymaps + # keymap.c output USERCODE = """ @@ -453,7 +438,7 @@ void matrix_init_user(void) { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - uint8_t layer = biton32(layer_state); + uint8_t layer = get_highest_layer(layer_state); ergodox_board_led_off(); ergodox_right_led_1_off(); @@ -572,7 +557,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {{ }}; """ - UNICODE_MACRO_TEMPLATE = """ case {macro_id}: unicode_action_function(0x{hi:02x}, 0x{lo:02x}); @@ -584,9 +568,7 @@ def unicode_macro_cases(config): for macro_id, uc_hex in config['unicode_macros'].items(): hi = int(uc_hex, 16) >> 8 lo = int(uc_hex, 16) & 0xFF - yield UNICODE_MACRO_TEMPLATE.format( - macro_id=macro_id, hi=hi, lo=lo - ) + yield UNICODE_MACRO_TEMPLATE.format(macro_id=macro_id, hi=hi, lo=lo) def iter_keymap_lines(keymap, row_indents=None): |