diff options
| author | Drashna Jaelre <drashna@live.com> | 2026-01-24 16:43:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-25 08:43:55 +0800 |
| commit | 38815db760f24268561f7fd138f1094d546b4f13 (patch) | |
| tree | cbe4434d7f96bb68ddeacbc957bc101ebebec301 | |
| parent | 863b30851949cf1f045328820d27bdc83d942190 (diff) | |
Fixup tominabox1 le chiffre default keymap (#25966)
* Fixup tominabox1 le chiffre default keymap
* Apply suggestions from code review
Co-authored-by: Jack Sangdahl <jack@pngu.org>
---------
Co-authored-by: Jack Sangdahl <jack@pngu.org>
4 files changed, 36 insertions, 175 deletions
diff --git a/keyboards/tominabox1/le_chiffre/keymaps/default/config.h b/keyboards/tominabox1/le_chiffre/keymaps/default/config.h deleted file mode 100644 index 8f0df1847a..0000000000 --- a/keyboards/tominabox1/le_chiffre/keymaps/default/config.h +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | /* Copyright 2020 tominabox1 | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 18 | #define COMBO_TERM 30 | ||
diff --git a/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c b/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c deleted file mode 100644 index 756eb06506..0000000000 --- a/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c +++ /dev/null | |||
| @@ -1,155 +0,0 @@ | |||
| 1 | /* Copyright 2020 tominabox1 | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include QMK_KEYBOARD_H | ||
| 17 | |||
| 18 | enum layers { | ||
| 19 | _BASE, | ||
| 20 | _NUM_SYM, | ||
| 21 | _NAV | ||
| 22 | }; | ||
| 23 | |||
| 24 | #define KC_NUM_SPC LT(_NUM_SYM, KC_SPC) | ||
| 25 | #define KC_GA LGUI_T(KC_A) | ||
| 26 | #define KC_AS LALT_T(KC_S) | ||
| 27 | #define KC_CD LCTL_T(KC_D) | ||
| 28 | #define KC_SF LSFT_T(KC_F) | ||
| 29 | #define KC_SJ RSFT_T(KC_J) | ||
| 30 | #define KC_CK RCTL_T(KC_K) | ||
| 31 | #define KC_AL RALT_T(KC_L) | ||
| 32 | #define KC_GSCLN RGUI_T(KC_SCLN) | ||
| 33 | |||
| 34 | // clang-format off | ||
| 35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 36 | [_BASE] = LAYOUT( | ||
| 37 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MPLY, KC_Y, KC_U, KC_I, KC_O, KC_P, | ||
| 38 | KC_GA, KC_AS, KC_CD, KC_SF, KC_G, KC_H, KC_SJ, KC_CK, KC_AL, KC_GSCLN, | ||
| 39 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, | ||
| 40 | KC_LCTL, KC_ENT, KC_NUM_SPC, MO(_NAV) | ||
| 41 | ), | ||
| 42 | |||
| 43 | [_NUM_SYM] = LAYOUT( | ||
| 44 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, | ||
| 45 | KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_EQUAL, KC_MINS, | ||
| 46 | KC_BSLS,KC_LCBR, KC_LBRC, KC_LPRN, KC_UNDS, KC_RPRN, KC_RBRC, KC_RCBR, KC_DOT, KC_GRV, | ||
| 47 | KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS | ||
| 48 | ), | ||
| 49 | |||
| 50 | [_NAV] = LAYOUT( | ||
| 51 | QK_BOOT, _______, AG_NORM, AG_SWAP, DB_TOGG, KC_TRNS, KC_GRV, KC_PGDN, KC_UP, KC_PGUP, KC_SCLN, | ||
| 52 | RM_TOGG, RM_HUEU, RM_SATU, RM_VALU, KC_NO, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, | ||
| 53 | RM_NEXT, RM_HUED, RM_SATD, RM_VALD, KC_NO, KC_MINS, KC_INT1, KC_COMM, KC_DOT, KC_BSLS, | ||
| 54 | KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS | ||
| 55 | ) | ||
| 56 | }; | ||
| 57 | // clang-format on | ||
| 58 | |||
| 59 | #if defined(ENCODER_MAP_ENABLE) | ||
| 60 | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
| 61 | [_BASE] = {ENCODER_CCW_CW(KC_MNXT, KC_MPRV) }, | ||
| 62 | [_NUM_SYM] = { ENCODER_CCW_CW(MS_WHLD, MS_WHLU) }, | ||
| 63 | [_NAV] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP) } | ||
| 64 | }; | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #ifdef COMBO_ENABLE | ||
| 68 | enum combo_events { | ||
| 69 | COMBO_BSPC, | ||
| 70 | COMBO_NUMBAK, | ||
| 71 | COMBO_TAB, | ||
| 72 | COMBO_ESC, | ||
| 73 | COMBO_DEL, | ||
| 74 | }; | ||
| 75 | |||
| 76 | const uint16_t PROGMEM combo_bspc[] = {KC_O, KC_P, COMBO_END}; | ||
| 77 | const uint16_t PROGMEM combo_numbak[] = {KC_0, KC_9, COMBO_END}; | ||
| 78 | const uint16_t PROGMEM combo_tab[] = {KC_Q, KC_W, COMBO_END}; | ||
| 79 | const uint16_t PROGMEM combo_esc[] = {KC_E, KC_W, COMBO_END}; | ||
| 80 | const uint16_t PROGMEM combo_del[] = {KC_MINS, KC_EQL, COMBO_END}; | ||
| 81 | |||
| 82 | combo_t key_combos[] = { | ||
| 83 | [COMBO_BSPC] = COMBO(combo_bspc, KC_BSPC), | ||
| 84 | [COMBO_NUMBAK] = COMBO(combo_numbak, KC_BSPC), | ||
| 85 | [COMBO_TAB] = COMBO(combo_tab, KC_TAB), | ||
| 86 | [COMBO_ESC] = COMBO(combo_esc, KC_ESC), | ||
| 87 | [COMBO_DEL] = COMBO(combo_del, KC_DEL) | ||
| 88 | }; | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #ifdef OLED_ENABLE | ||
| 92 | |||
| 93 | // Add additional layer names here if desired. Only first 5 characters will be copied to display. | ||
| 94 | const char PROGMEM layer_base[] = "BASE"; | ||
| 95 | const char PROGMEM layer_num_sym[] = " SYM"; | ||
| 96 | const char PROGMEM layer_nav[] = " NAV"; | ||
| 97 | // Add layer name variables to array here. Make sure these are in order. | ||
| 98 | const char* const PROGMEM layer_names[] = { | ||
| 99 | layer_base, | ||
| 100 | layer_num_sym, | ||
| 101 | layer_nav | ||
| 102 | }; | ||
| 103 | |||
| 104 | static char oled_layer_buf[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
| 105 | static layer_state_t top_layer_cache; | ||
| 106 | |||
| 107 | /* BEGIN STANDARD QMK FUNCTIONS */ | ||
| 108 | bool oled_task_user(void) { | ||
| 109 | oled_write_raw_P(lechiffre_logo, sizeof(lechiffre_logo)); | ||
| 110 | // Renders the current keyboard state (layer, lock, caps, scroll, etc); | ||
| 111 | oled_set_cursor(0, 3); | ||
| 112 | oled_write_P(oled_section_break, false); | ||
| 113 | render_layer_status(oled_layer_buf); | ||
| 114 | oled_write_P(oled_section_break, false); | ||
| 115 | render_mod_status(get_mods() | get_oneshot_mods()); | ||
| 116 | oled_write_P(oled_section_break, false); | ||
| 117 | render_keylock_status(host_keyboard_led_state()); | ||
| 118 | oled_write_P(oled_section_break, false); | ||
| 119 | render_keylogger_status(); | ||
| 120 | |||
| 121 | return false; | ||
| 122 | } | ||
| 123 | |||
| 124 | bool process_record_user(uint16_t keycode, keyrecord_t* record) { | ||
| 125 | if (record->event.pressed) { | ||
| 126 | add_keylog(keycode, record); | ||
| 127 | } | ||
| 128 | |||
| 129 | return true; | ||
| 130 | } | ||
| 131 | |||
| 132 | // If we don't force an update during initialization, the layer name buffer will start out blank. | ||
| 133 | layer_state_t default_layer_state_set_user(layer_state_t state) { | ||
| 134 | update_layer_namebuf(get_highest_layer(state), true); | ||
| 135 | return state; | ||
| 136 | } | ||
| 137 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 138 | update_layer_namebuf(get_highest_layer(state | default_layer_state), false); | ||
| 139 | return state; | ||
| 140 | } | ||
| 141 | |||
| 142 | /* END STANDARD QMK FUNCTIONS */ | ||
| 143 | /* BEGIN CUSTOM HELPER FUNCTION FOR OLED */ | ||
| 144 | // Avoid excessive copying by only updating the layer name buffer when the layer changes | ||
| 145 | void update_layer_namebuf(layer_state_t layer, bool force_update) { | ||
| 146 | if (force_update || layer != top_layer_cache) { | ||
| 147 | top_layer_cache = layer; | ||
| 148 | if (layer < ARRAY_SIZE(layer_names)) { | ||
| 149 | memcpy_P(oled_layer_buf, pgm_read_ptr(&layer_names[layer]), ARRAY_SIZE(oled_layer_buf) - 1); | ||
| 150 | } else { | ||
| 151 | memcpy(oled_layer_buf, get_u8_str(layer, ' '), ARRAY_SIZE(oled_layer_buf) - 1); | ||
| 152 | } | ||
| 153 | } | ||
| 154 | } | ||
| 155 | #endif | ||
diff --git a/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.json b/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.json new file mode 100644 index 0000000000..252db21f5d --- /dev/null +++ b/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.json | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | { | ||
| 2 | "keyboard": "tominabox1/le_chiffre", | ||
| 3 | "keymap": "default", | ||
| 4 | "config": { | ||
| 5 | "features": { | ||
| 6 | "encoder_map": true | ||
| 7 | } | ||
| 8 | }, | ||
| 9 | "layout": "LAYOUT", | ||
| 10 | "layers": [ | ||
| 11 | [ | ||
| 12 | "KC_Q", "KC_W", "KC_E", "KC_R", "KC_T", "KC_MPLY", "KC_Y", "KC_U", "KC_I", "KC_O", "KC_P", | ||
| 13 | "LGUI_T(KC_A)", "LALT_T(KC_S)", "LCTL_T(KC_D)", "LSFT_T(KC_F)", "KC_G", "KC_H", "RSFT_T(KC_J)", "RCTL_T(KC_K)", "RALT_T(KC_L)", "RGUI_T(KC_SCLN)", | ||
| 14 | "KC_Z", "KC_X", "KC_C", "KC_V", "KC_B", "KC_N", "KC_M", "KC_COMM", "KC_DOT", "KC_SLSH", | ||
| 15 | "KC_LCTL", "KC_ENT", "LT(1, KC_SPC)", "MO(2)" | ||
| 16 | ], | ||
| 17 | [ | ||
| 18 | "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_TRNS", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", | ||
| 19 | "KC_EXLM", "KC_AT", "KC_HASH", "KC_DLR", "KC_PERC", "KC_CIRC", "KC_AMPR", "KC_ASTR", "KC_EQUAL", "KC_MINS", | ||
| 20 | "KC_BSLS", "KC_LCBR", "KC_LBRC", "KC_LPRN", "KC_UNDS", "KC_RPRN", "KC_RBRC", "KC_RCBR", "KC_DOT", "KC_GRV", | ||
| 21 | "KC_CAPS", "KC_TRNS", "KC_TRNS", "KC_TRNS" | ||
| 22 | ], | ||
| 23 | [ | ||
| 24 | "QK_BOOT", "KC_TRNS", "AG_NORM", "AG_SWAP", "DB_TOGG", "KC_TRNS", "KC_GRV", "KC_PGDN", "KC_UP", "KC_PGUP", | ||
| 25 | "KC_SCLN", "RM_TOGG", "RM_HUEU", "RM_SATU", "RM_VALU", "KC_NO", "KC_HOME", "KC_LEFT", "KC_DOWN", "KC_RGHT", | ||
| 26 | "KC_END", "RM_NEXT", "RM_HUED", "RM_SATD", "RM_VALD", "KC_NO", "KC_MINS", "KC_INT1", "KC_COMM", "KC_DOT", "KC_BSLS", | ||
| 27 | "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS" | ||
| 28 | ] | ||
| 29 | |||
| 30 | ], | ||
| 31 | "encoders": [ | ||
| 32 | [{"ccw": "KC_MNXT", "cw": "KC_MPRV"}], | ||
| 33 | [{"ccw": "MS_WHLD", "cw": "MS_WHLU"}], | ||
| 34 | [{"ccw": "KC_PGDN", "cw": "KC_PGUP"}] | ||
| 35 | ] | ||
| 36 | } | ||
diff --git a/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk b/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk deleted file mode 100644 index cbd8b4aa81..0000000000 --- a/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | COMBO_ENABLE = yes | ||
| 2 | ENCODER_MAP_ENABLE = yes | ||
