From 14c2e553e6208740c71a8def85a5152fc896c849 Mon Sep 17 00:00:00 2001 From: Less/Rikki <86894501+lesshonor@users.noreply.github.com> Date: Tue, 25 Jul 2023 02:29:07 -0400 Subject: [PATCH] [keyboard] tominabox1/le_chiffre refactor pt 1 (#21567) Co-authored-by: Duncan Sutherland --- keyboards/tominabox1/le_chiffre/config.h | 18 --- keyboards/tominabox1/le_chiffre/he/he.c | 33 ----- keyboards/tominabox1/le_chiffre/he/info.json | 36 ++---- keyboards/tominabox1/le_chiffre/he/rules.mk | 16 +-- keyboards/tominabox1/le_chiffre/info.json | 88 +++++++++++-- .../le_chiffre/keymaps/default/keymap.c | 119 +++++++++--------- .../le_chiffre/keymaps/default/rules.mk | 1 + .../le_chiffre/keymaps/via/keymap.c | 80 +++++------- .../le_chiffre/keymaps/via/rules.mk | 1 + keyboards/tominabox1/le_chiffre/readme.md | 36 +++++- .../tominabox1/le_chiffre/rev1/info.json | 36 ++---- keyboards/tominabox1/le_chiffre/rev1/rev1.c | 33 ----- keyboards/tominabox1/le_chiffre/rev1/rules.mk | 17 +-- .../tominabox1/le_chiffre/rev2/info.json | 36 ++---- keyboards/tominabox1/le_chiffre/rev2/rev2.c | 33 ----- keyboards/tominabox1/le_chiffre/rev2/rules.mk | 17 +-- 16 files changed, 240 insertions(+), 360 deletions(-) delete mode 100644 keyboards/tominabox1/le_chiffre/he/he.c delete mode 100644 keyboards/tominabox1/le_chiffre/rev1/rev1.c delete mode 100644 keyboards/tominabox1/le_chiffre/rev2/rev2.c diff --git a/keyboards/tominabox1/le_chiffre/config.h b/keyboards/tominabox1/le_chiffre/config.h index c4ae5fc38b..9b01cb3da4 100644 --- a/keyboards/tominabox1/le_chiffre/config.h +++ b/keyboards/tominabox1/le_chiffre/config.h @@ -23,23 +23,5 @@ /* * WS2812 Underglow Matrix options */ - #define RGB_MATRIX_LED_COUNT 11 - -#define RGBLIGHT_EFFECT_BREATHING -#define RGBLIGHT_EFFECT_RAINBOW_MOOD -#define RGBLIGHT_EFFECT_RAINBOW_SWIRL -#define RGBLIGHT_EFFECT_SNAKE -#define RGBLIGHT_EFFECT_KNIGHT -#define RGBLIGHT_EFFECT_CHRISTMAS -#define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_RGB_TEST -#define RGBLIGHT_EFFECT_ALTERNATING -#define RGBLIGHT_EFFECT_TWINKLE - -#ifdef RGB_MATRIX_ENABLE -#define RGB_MATRIX_KEYPRESSES // reacts to keypresses #define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. -#endif diff --git a/keyboards/tominabox1/le_chiffre/he/he.c b/keyboards/tominabox1/le_chiffre/he/he.c deleted file mode 100644 index 6ee8214953..0000000000 --- a/keyboards/tominabox1/le_chiffre/he/he.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2022 tominabox1 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "quantum.h" - -#ifdef RGB_MATRIX_ENABLE -led_config_t g_led_config = { { - // Key Matrix to LED Index - { 3, 4, NO_LED, 5, 6 }, - { NO_LED, NO_LED, 10, NO_LED, NO_LED }, - { NO_LED, NO_LED, 9, NO_LED, NO_LED }, - { 2, 1, 0, 8, 7 } -}, { - - // LED Index to Physical Position - { 128, 64 }, { 77, 64 }, { 0, 48 }, { 0, 0 }, { 115, 0 }, { 166, 0 }, { 255, 0 }, { 255, 48 }, { 178, 64 }, { 128, 40 }, { 128, 30 } -}, { - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -} }; -#endif diff --git a/keyboards/tominabox1/le_chiffre/he/info.json b/keyboards/tominabox1/le_chiffre/he/info.json index b4c02bf0e1..e7eb527602 100644 --- a/keyboards/tominabox1/le_chiffre/he/info.json +++ b/keyboards/tominabox1/le_chiffre/he/info.json @@ -1,16 +1,7 @@ { - "usb": { - "device_version": "0.0.3" - }, - "rgblight": { - "led_count": 11 - }, - "ws2812": { - "pin": "F0" - }, - "matrix_pins": { - "cols": ["F4", "F5", "B0", "B2", "B1", "B4", "D7", "C7", "D2", "F7"], - "rows": ["B3", "D4", "F1", "C6"] + "bootloader": "atmel-dfu", + "build": { + "lto": true }, "diode_direction": "COL2ROW", "encoder": { @@ -18,14 +9,17 @@ {"pin_a": "D5", "pin_b": "D3"} ] }, - "rgb_matrix": { - "driver": "WS2812", - "sat_steps": 8, - "val_steps": 8, - "speed_steps": 10 + "matrix_pins": { + "cols": ["F4", "F5", "B0", "B2", "B1", "B4", "D7", "C7", "D2", "F7"], + "rows": ["B3", "D4", "F1", "C6"] }, "processor": "atmega32u4", - "bootloader": "atmel-dfu", + "usb": { + "device_version": "0.0.3" + }, + "ws2812": { + "pin": "F0" + }, "layouts": { "LAYOUT": { "layout": [ @@ -40,34 +34,28 @@ {"matrix": [0, 7], "x": 8, "y": 0}, {"matrix": [0, 8], "x": 9, "y": 0}, {"matrix": [0, 9], "x": 10, "y": 0}, - {"matrix": [1, 0], "x": 0, "y": 1}, {"matrix": [1, 1], "x": 1, "y": 1}, {"matrix": [1, 2], "x": 2, "y": 1}, {"matrix": [1, 3], "x": 3, "y": 1}, {"matrix": [1, 4], "x": 4, "y": 1}, - {"matrix": [1, 5], "x": 6, "y": 1}, {"matrix": [1, 6], "x": 7, "y": 1}, {"matrix": [1, 7], "x": 8, "y": 1}, {"matrix": [1, 8], "x": 9, "y": 1}, {"matrix": [1, 9], "x": 10, "y": 1}, - {"matrix": [2, 0], "x": 0, "y": 2}, {"matrix": [2, 1], "x": 1, "y": 2}, {"matrix": [2, 2], "x": 2, "y": 2}, {"matrix": [2, 3], "x": 3, "y": 2}, {"matrix": [2, 4], "x": 4, "y": 2}, - {"matrix": [2, 5], "x": 6, "y": 2}, {"matrix": [2, 6], "x": 7, "y": 2}, {"matrix": [2, 7], "x": 8, "y": 2}, {"matrix": [2, 8], "x": 9, "y": 2}, {"matrix": [2, 9], "x": 10, "y": 2}, - {"matrix": [3, 2], "x": 1.75, "y": 3, "w": 1.25}, {"matrix": [3, 4], "x": 3, "y": 3, "w": 2}, - {"matrix": [3, 5], "x": 6, "y": 3, "w": 2}, {"matrix": [3, 7], "x": 8, "y": 3, "w": 1.25} ] diff --git a/keyboards/tominabox1/le_chiffre/he/rules.mk b/keyboards/tominabox1/le_chiffre/he/rules.mk index 53d9b0d47b..6e7633bfe0 100644 --- a/keyboards/tominabox1/le_chiffre/he/rules.mk +++ b/keyboards/tominabox1/le_chiffre/he/rules.mk @@ -1,15 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes +# This file intentionally left blank diff --git a/keyboards/tominabox1/le_chiffre/info.json b/keyboards/tominabox1/le_chiffre/info.json index 25f19145a9..688d9d8fa5 100644 --- a/keyboards/tominabox1/le_chiffre/info.json +++ b/keyboards/tominabox1/le_chiffre/info.json @@ -1,10 +1,82 @@ { - "keyboard_name": "Le Chiffre", - "manufacturer": "tominabox1", - "url": "", - "maintainer": "tominabox1", - "usb": { - "vid": "0x7431", - "pid": "0xD645" - } + "keyboard_name": "Le Chiffre", + "manufacturer": "tominabox1", + "url": "", + "maintainer": "tominabox1", + "features": { + "bootmagic": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "oled": true, + "rgb_matrix": true + }, + "rgblight": { + "animations": { + "alternating": true, + "breathing": true, + "christmas": true, + "knight": true, + "rainbow_mood": true, + "rainbow_swirl": true, + "rgb_test": true, + "snake": true, + "static_gradient": true, + "twinkle": true + }, + "saturation_steps": 8, + "brightness_steps": 8, + "max_brightness": 150, + "led_count": 11 + }, + "rgb_matrix": { + "driver": "WS2812", + "animations": { + "gradient_up_down": true, + "gradient_left_right": true, + "breathing": true, + "band_sat": true, + "band_val": true, + "band_spiral_sat": true, + "band_spiral_val": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "cycle_pinwheel": true, + "dual_beacon": true, + "rainbow_beacon": true, + "rainbow_pinwheels": true, + "raindrops": true, + "jellybean_raindrops": true, + "hue_breathing": true, + "hue_pendulum": true, + "hue_wave": true, + "pixel_rain": true, + "pixel_flow": true, + "pixel_fractal": true + }, + "layout": [ + {"x": 128, "y": 64, "flags": 2}, + {"x": 77, "y": 64, "flags": 2}, + {"x": 0, "y": 48, "flags": 2}, + {"x": 0, "y": 0, "flags": 2}, + {"x": 115, "y": 0, "flags": 2}, + {"x": 166, "y": 0, "flags": 2}, + {"x": 255, "y": 0, "flags": 2}, + {"x": 255, "y": 48, "flags": 2}, + {"x": 178, "y": 64, "flags": 2}, + {"x": 128, "y": 40, "flags": 8}, + {"x": 128, "y": 30, "flags": 8} + ], + "max_brightness": 150, + "sat_steps": 8, + "speed_steps": 10, + "val_steps": 8 + }, + "usb": { + "vid": "0x7431", + "pid": "0xD645" + } } diff --git a/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c b/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c index e9205d94b3..7008550f2b 100644 --- a/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c +++ b/keyboards/tominabox1/le_chiffre/keymaps/default/keymap.c @@ -15,18 +15,10 @@ */ #include QMK_KEYBOARD_H -enum layers{ - _BASE, - _NUM_SYM, - _NAV -}; - -enum combo_events { - COMBO_BSPC, - COMBO_NUMBAK, - COMBO_TAB, - COMBO_ESC, - COMBO_DEL, +enum layers { + _BASE, + _NUM_SYM, + _NAV }; #define KC_NUM_SPC LT(_NUM_SYM, KC_SPC) @@ -39,6 +31,7 @@ enum combo_events { #define KC_AL RALT_T(KC_L) #define KC_GSCLN RGUI_T(KC_SCLN) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT( KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MPLY, KC_Y, KC_U, KC_I, KC_O, KC_P, @@ -59,54 +52,58 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_NO, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_NO, KC_MINS, KC_INT1, KC_COMM, KC_DOT, KC_BSLS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS - ), + ) }; +// clang-format on -bool encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { - if (clockwise) { - tap_code(KC_VOLU); - } else { - tap_code(KC_VOLD); - } - } - return true; -} - -#ifdef COMBO_ENABLE -const uint16_t PROGMEM combo_bspc[] = {KC_O, KC_P, COMBO_END}; -const uint16_t PROGMEM combo_numbak[] = {KC_0, KC_9, COMBO_END}; -const uint16_t PROGMEM combo_tab[] = {KC_Q, KC_W, COMBO_END}; -const uint16_t PROGMEM combo_esc[] = {KC_E, KC_W, COMBO_END}; -const uint16_t PROGMEM combo_del[] = {KC_MINS, KC_EQL, COMBO_END}; - -combo_t key_combos[] = { - [COMBO_BSPC] = COMBO(combo_bspc,KC_BSPC), - [COMBO_NUMBAK] = COMBO(combo_numbak,KC_BSPC), - [COMBO_TAB] = COMBO(combo_tab,KC_TAB), - [COMBO_ESC] = COMBO(combo_esc,KC_ESC), - [COMBO_DEL] = COMBO(combo_del,KC_DEL), - +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_BASE] = {ENCODER_CCW_CW(KC_MNXT, KC_MPRV) }, + [_NUM_SYM] = { ENCODER_CCW_CW(KC_WH_D, KC_WH_U) }, + [_NAV] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP) } }; #endif -#ifdef OLED_ENABLE //Special thanks to Sickbabies for this great OLED widget! +#ifdef COMBO_ENABLE +enum combo_events { + COMBO_BSPC, + COMBO_NUMBAK, + COMBO_TAB, + COMBO_ESC, + COMBO_DEL, +}; + +const uint16_t PROGMEM combo_bspc[] = {KC_O, KC_P, COMBO_END}; +const uint16_t PROGMEM combo_numbak[] = {KC_0, KC_9, COMBO_END}; +const uint16_t PROGMEM combo_tab[] = {KC_Q, KC_W, COMBO_END}; +const uint16_t PROGMEM combo_esc[] = {KC_E, KC_W, COMBO_END}; +const uint16_t PROGMEM combo_del[] = {KC_MINS, KC_EQL, COMBO_END}; + +combo_t key_combos[] = { + [COMBO_BSPC] = COMBO(combo_bspc, KC_BSPC), + [COMBO_NUMBAK] = COMBO(combo_numbak, KC_BSPC), + [COMBO_TAB] = COMBO(combo_tab, KC_TAB), + [COMBO_ESC] = COMBO(combo_esc, KC_ESC), + [COMBO_DEL] = COMBO(combo_del, KC_DEL) +}; +#endif + +#ifdef OLED_ENABLE // Special thanks to Sickbabies for this great OLED widget! oled_rotation_t oled_init_user(oled_rotation_t rotation) { - return OLED_ROTATION_90; // rotates for proper orientation + return OLED_ROTATION_90; // rotates for proper orientation } void render_lechiffre_logo(void) { static const char PROGMEM lechiffre_logo[] = { - // 'lechiffre_logo', 32x20px - 0x00, 0x3e, 0x20, 0x20, 0x00, 0x18, 0x2c, 0xa8, 0x80, 0x00, 0x1c, 0x22, 0x22, 0x00, 0x3e, 0x08, -0x30, 0x00, 0x34, 0x00, 0x3c, 0x0a, 0x00, 0xbc, 0x8a, 0x00, 0x38, 0x08, 0x00, 0x18, 0x2c, 0x28, -0x00, 0xb6, 0xb6, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, -0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xb6, 0xb6, 0x00, -0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, -0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00 -}; + // 'lechiffre_logo', 32x20px + 0x00, 0x3e, 0x20, 0x20, 0x00, 0x18, 0x2c, 0xa8, 0x80, 0x00, 0x1c, 0x22, 0x22, 0x00, 0x3e, 0x08, + 0x30, 0x00, 0x34, 0x00, 0x3c, 0x0a, 0x00, 0xbc, 0x8a, 0x00, 0x38, 0x08, 0x00, 0x18, 0x2c, 0x28, + 0x00, 0xb6, 0xb6, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, + 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xb6, 0xb6, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, + 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00}; - oled_write_raw_P(lechiffre_logo, sizeof(lechiffre_logo)); + oled_write_raw_P(lechiffre_logo, sizeof(lechiffre_logo)); } static void render_layer_status(void) { @@ -161,7 +158,7 @@ void update_log(void) { } } -//Text only renders +// Text only renders void render_keylogger_status(void) { oled_write_P(PSTR("-----"), false); oled_write(keylog_str, false); @@ -170,15 +167,15 @@ void render_keylogger_status(void) { void render_keylock_status(led_t led_state) { oled_write_P(PSTR("-----"), false); oled_write_P(PSTR("C"), led_state.caps_lock); - oled_write_P(PSTR(" "), false); + oled_write_P(PSTR(" "), false); oled_write_P(PSTR("N"), led_state.num_lock); - oled_write_P(PSTR(" "), false); + oled_write_P(PSTR(" "), false); oled_write_P(PSTR("S"), led_state.scroll_lock); - //oled_write_ln_P(PSTR(" "), false); + // oled_write_ln_P(PSTR(" "), false); } void render_mod_status(uint8_t modifiers) { - oled_write_P(PSTR("-----"), false); + oled_write_P(PSTR("-----"), false); oled_write_ln_P(PSTR("SHFT"), (modifiers & MOD_MASK_SHIFT)); oled_write_ln_P(PSTR("ALT"), (modifiers & MOD_MASK_ALT)); oled_write_ln_P(PSTR("CTRL"), (modifiers & MOD_MASK_CTRL)); @@ -187,19 +184,19 @@ void render_mod_status(uint8_t modifiers) { bool oled_task_user(void) { render_lechiffre_logo(); - oled_set_cursor(0,3); - render_layer_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) - render_mod_status(get_mods()|get_oneshot_mods()); - render_keylock_status(host_keyboard_led_state()); - render_keylogger_status(); + oled_set_cursor(0, 3); + render_layer_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) + render_mod_status(get_mods() | get_oneshot_mods()); + render_keylock_status(host_keyboard_led_state()); + render_keylogger_status(); return false; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { - add_keylog(keycode); + add_keylog(keycode); } return true; - } +} #endif diff --git a/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk b/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk index ab1e438182..cbd8b4aa81 100644 --- a/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk +++ b/keyboards/tominabox1/le_chiffre/keymaps/default/rules.mk @@ -1 +1,2 @@ COMBO_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/tominabox1/le_chiffre/keymaps/via/keymap.c b/keyboards/tominabox1/le_chiffre/keymaps/via/keymap.c index c626cba1cc..2592ee5dc1 100644 --- a/keyboards/tominabox1/le_chiffre/keymaps/via/keymap.c +++ b/keyboards/tominabox1/le_chiffre/keymaps/via/keymap.c @@ -15,57 +15,39 @@ */ #include QMK_KEYBOARD_H +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MPLY, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LCTL, KC_ENT, KC_SPC, KC_RALT - ), - - [1] = LAYOUT( - 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 - ), - - [2] = LAYOUT( - 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 - ), + ) }; +// clang-format on -bool encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { - if (clockwise) { - tap_code(KC_MNXT); - } else { - tap_code(KC_MPRV); - } - } - return true; -} +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_MNXT, KC_MPRV) } +}; +#endif -#ifdef OLED_ENABLE //Special thanks to Sickbabies for this great OLED widget! +#ifdef OLED_ENABLE // Special thanks to Sickbabies for this great OLED widget! oled_rotation_t oled_init_user(oled_rotation_t rotation) { - return OLED_ROTATION_90; // rotates for proper orientation + return OLED_ROTATION_90; // rotates for proper orientation } void render_lechiffre_logo(void) { static const char PROGMEM lechiffre_logo[] = { - // 'lechiffre_logo', 32x20px - 0x00, 0x3e, 0x20, 0x20, 0x00, 0x18, 0x2c, 0xa8, 0x80, 0x00, 0x1c, 0x22, 0x22, 0x00, 0x3e, 0x08, -0x30, 0x00, 0x34, 0x00, 0x3c, 0x0a, 0x00, 0xbc, 0x8a, 0x00, 0x38, 0x08, 0x00, 0x18, 0x2c, 0x28, -0x00, 0xb6, 0xb6, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, -0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xb6, 0xb6, 0x00, -0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, -0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00 -}; + // 'lechiffre_logo', 32x20px + 0x00, 0x3e, 0x20, 0x20, 0x00, 0x18, 0x2c, 0xa8, 0x80, 0x00, 0x1c, 0x22, 0x22, 0x00, 0x3e, 0x08, + 0x30, 0x00, 0x34, 0x00, 0x3c, 0x0a, 0x00, 0xbc, 0x8a, 0x00, 0x38, 0x08, 0x00, 0x18, 0x2c, 0x28, + 0x00, 0xb6, 0xb6, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, + 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0x00, 0x6d, 0x6d, 0x00, 0xdb, 0xdb, 0x00, 0xb6, 0xb6, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, + 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00}; - oled_write_raw_P(lechiffre_logo, sizeof(lechiffre_logo)); + oled_write_raw_P(lechiffre_logo, sizeof(lechiffre_logo)); } // static void render_layer_status(void) { @@ -120,7 +102,7 @@ void update_log(void) { } } -//Text only renders +// Text only renders void render_keylogger_status(void) { oled_write_P(PSTR("-----"), false); oled_write(keylog_str, false); @@ -129,36 +111,36 @@ void render_keylogger_status(void) { void render_keylock_status(led_t led_state) { oled_write_P(PSTR("-----"), false); oled_write_P(PSTR("C"), led_state.caps_lock); - oled_write_P(PSTR(" "), false); + oled_write_P(PSTR(" "), false); oled_write_P(PSTR("N"), led_state.num_lock); - oled_write_P(PSTR(" "), false); + oled_write_P(PSTR(" "), false); oled_write_P(PSTR("S"), led_state.scroll_lock); - //oled_write_ln_P(PSTR(" "), false); + // oled_write_ln_P(PSTR(" "), false); } void render_mod_status(uint8_t modifiers) { - oled_write_P(PSTR("-----"), false); + oled_write_P(PSTR("-----"), false); oled_write_ln_P(PSTR("SHFT"), (modifiers & MOD_MASK_SHIFT)); oled_write_ln_P(PSTR("ALT"), (modifiers & MOD_MASK_ALT)); oled_write_ln_P(PSTR("CTRL"), (modifiers & MOD_MASK_CTRL)); oled_write_ln_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI)); } -void oled_task_keymap(void) { +bool oled_task_user(void) { render_lechiffre_logo(); - oled_set_cursor(0,3); - // render_layer_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) - render_mod_status(get_mods()|get_oneshot_mods()); - render_keylock_status(host_keyboard_led_state()); - render_keylogger_status(); + oled_set_cursor(0, 3); + // render_layer_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) + render_mod_status(get_mods() | get_oneshot_mods()); + render_keylock_status(host_keyboard_led_state()); + render_keylogger_status(); return false; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { - add_keylog(keycode); + add_keylog(keycode); } return true; - } +} #endif diff --git a/keyboards/tominabox1/le_chiffre/keymaps/via/rules.mk b/keyboards/tominabox1/le_chiffre/keymaps/via/rules.mk index 1e5b99807c..f1adcab005 100644 --- a/keyboards/tominabox1/le_chiffre/keymaps/via/rules.mk +++ b/keyboards/tominabox1/le_chiffre/keymaps/via/rules.mk @@ -1 +1,2 @@ VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/tominabox1/le_chiffre/readme.md b/keyboards/tominabox1/le_chiffre/readme.md index 9ac3d6c81c..23f1a96768 100644 --- a/keyboards/tominabox1/le_chiffre/readme.md +++ b/keyboards/tominabox1/le_chiffre/readme.md @@ -1,16 +1,22 @@ # Le Chiffre -![Le Chiffre](https://i.imgur.com/X1WsUmdl.png) +![Le Chiffre](https://i.imgur.com/X1WsUmdh.png) -Le Chiffre (ironically, "the number" in French) is a 30% keyboard designed by tominabox1. The purpose of the board is to provide a platform for MX and Choc ergo in one package for when ones wrists need a break. The board supports an RGB LED strip with DI on port F0. The board is also fitted with support for run-of-the-mill .91" OLED and EC11 rotary encoder. +Le Chiffre (ironically, "the number" in French) is a 30% keyboard designed by tominabox1. The purpose of the board is to provide an ergonomic platform supporting MX, Choc and Alps—for when one's wrists need a break. -There are 3 PCB revisions: Rev 1 (Original), Rev 2 (P3D version sold with the Le Chiffre Plus), and HE (Hotswap Edition from Checkerboards.xyz). +As open source hardware, various revisions of the board exist. The original supports a run-of-the-mill .91" I2C OLED, EC11 rotary encoder and WS2812 RGB LED strip. Most versions also feature SMD footprints for underglow and indicator RGB LEDs. -By default the OLED is **disabled**. This is to prevent issues with operation when one is not installed. Be sure to enable the OLED in the rules.mk file if you have one installed! +Firmware support for several incompatible PCBs can be found in this repository. Examine your PCB to determine which firmware it uses before flashing. +* Rev 1 (atmega32u4, atmel-dfu) + * The original. +* Rev 2 (atmega32u4, atmel-dfu) + * Widely known as the "curly traces" version; notably sold by [P3D](https://p3dstore.com) with the Le Chiffre Plus case. (P3D's store page referred to this PCB version as "Rev 3".) +* HE (atmega32u4, atmel-dfu) + * Created and sold by [Checker Boards](https://checkerboards.xyz). Uses MX hotswap sockets. No Choc or Alps support. * Keyboard Maintainer: [TJ Campie](https://github.com/tominabox1) -* Hardware Supported: [Le Chiffre](https://github.com/tominabox1/Le-Chiffre-Keyboard) -* Hardware Availability: Bring your own case. +* Hardware Supported: [Le Chiffre](https://github.com/tominabox1/Le-Chiffre-Keyboard), [Le Chiffre HE](https://github.com/npspears/Le-Chiffre_HE) +* Hardware Availability: Open source; PCBs are sometimes stocked by various keyboard vendors. Bring your own case. Make example for this keyboard (after setting up your build environment): @@ -18,4 +24,22 @@ Make example for this keyboard (after setting up your build environment): make tominabox1/le_chiffre/rev2:default make tominabox1/le_chiffre/he:default +Flashing example for this keyboard: + + make tominabox1/le_chiffre/rev1:default:flash + make tominabox1/le_chiffre/rev2:default:flash + make tominabox1/le_chiffre/he:default:flash + See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the top left key and plug in the keyboard. This will also clear EEPROM, so it is a good first step if the keyboard is misbehaving. +* **Physical reset**: Press the central button on the underside of the PCB. +* **Keycode in layout**: There is no key mapped to `QK_BOOT` in the pre-created keymaps, but you may assign this key in any keymaps you create. + +## Flashing + +After entering the bootloader through one of the three methods above, the keyboard will appear as an Atmel DFU device. It can be flashed using the QMK CLI or QMK Toolbox. diff --git a/keyboards/tominabox1/le_chiffre/rev1/info.json b/keyboards/tominabox1/le_chiffre/rev1/info.json index 73b6f435a7..44982ecdf5 100644 --- a/keyboards/tominabox1/le_chiffre/rev1/info.json +++ b/keyboards/tominabox1/le_chiffre/rev1/info.json @@ -1,16 +1,7 @@ { - "usb": { - "device_version": "0.0.1" - }, - "rgblight": { - "led_count": 11 - }, - "ws2812": { - "pin": "F0" - }, - "matrix_pins": { - "cols": ["F4", "F5", "B0", "B2", "B1", "B4", "D7", "C7", "D2", "F7"], - "rows": ["B3", "D4", "F1", "C6"] + "bootloader": "atmel-dfu", + "build": { + "lto": true }, "diode_direction": "ROW2COL", "encoder": { @@ -18,14 +9,17 @@ {"pin_a": "D5", "pin_b": "D3"} ] }, - "rgb_matrix": { - "driver": "WS2812", - "sat_steps": 8, - "val_steps": 8, - "speed_steps": 10 + "matrix_pins": { + "cols": ["F4", "F5", "B0", "B2", "B1", "B4", "D7", "C7", "D2", "F7"], + "rows": ["B3", "D4", "F1", "C6"] }, "processor": "atmega32u4", - "bootloader": "atmel-dfu", + "usb": { + "device_version": "0.0.1" + }, + "ws2812": { + "pin": "F0" + }, "layouts": { "LAYOUT": { "layout": [ @@ -40,34 +34,28 @@ {"matrix": [0, 7], "x": 8, "y": 0}, {"matrix": [0, 8], "x": 9, "y": 0}, {"matrix": [0, 9], "x": 10, "y": 0}, - {"matrix": [1, 0], "x": 0, "y": 1}, {"matrix": [1, 1], "x": 1, "y": 1}, {"matrix": [1, 2], "x": 2, "y": 1}, {"matrix": [1, 3], "x": 3, "y": 1}, {"matrix": [1, 4], "x": 4, "y": 1}, - {"matrix": [1, 5], "x": 6, "y": 1}, {"matrix": [1, 6], "x": 7, "y": 1}, {"matrix": [1, 7], "x": 8, "y": 1}, {"matrix": [1, 8], "x": 9, "y": 1}, {"matrix": [1, 9], "x": 10, "y": 1}, - {"matrix": [2, 0], "x": 0, "y": 2}, {"matrix": [2, 1], "x": 1, "y": 2}, {"matrix": [2, 2], "x": 2, "y": 2}, {"matrix": [2, 3], "x": 3, "y": 2}, {"matrix": [2, 4], "x": 4, "y": 2}, - {"matrix": [2, 5], "x": 6, "y": 2}, {"matrix": [2, 6], "x": 7, "y": 2}, {"matrix": [2, 7], "x": 8, "y": 2}, {"matrix": [2, 8], "x": 9, "y": 2}, {"matrix": [2, 9], "x": 10, "y": 2}, - {"matrix": [3, 2], "x": 1.75, "y": 3, "w": 1.25}, {"matrix": [3, 4], "x": 3, "y": 3, "w": 2}, - {"matrix": [3, 5], "x": 6, "y": 3, "w": 2}, {"matrix": [3, 7], "x": 8, "y": 3, "w": 1.25} ] diff --git a/keyboards/tominabox1/le_chiffre/rev1/rev1.c b/keyboards/tominabox1/le_chiffre/rev1/rev1.c deleted file mode 100644 index 66b0eb2f08..0000000000 --- a/keyboards/tominabox1/le_chiffre/rev1/rev1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2020 tominabox1 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "quantum.h" - -#ifdef RGB_MATRIX_ENABLE -led_config_t g_led_config = { { - // Key Matrix to LED Index - { 3, 4, NO_LED, 5, 6 }, - { NO_LED, NO_LED, 10, NO_LED, NO_LED }, - { NO_LED, NO_LED, 9, NO_LED, NO_LED }, - { 2, 1, 0, 8, 7 } -}, { - - // LED Index to Physical Position - { 128, 64 }, { 77, 64 }, { 0, 48 }, { 0, 0 }, { 115, 0 }, { 166, 0 }, { 255, 0 }, { 255, 48 }, { 178, 64 }, { 128, 40 }, { 128, 30 } -}, { - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -} }; -#endif diff --git a/keyboards/tominabox1/le_chiffre/rev1/rules.mk b/keyboards/tominabox1/le_chiffre/rev1/rules.mk index 7d791dd396..6e7633bfe0 100644 --- a/keyboards/tominabox1/le_chiffre/rev1/rules.mk +++ b/keyboards/tominabox1/le_chiffre/rev1/rules.mk @@ -1,16 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes - +# This file intentionally left blank diff --git a/keyboards/tominabox1/le_chiffre/rev2/info.json b/keyboards/tominabox1/le_chiffre/rev2/info.json index 44dcfdf728..155b264ce2 100644 --- a/keyboards/tominabox1/le_chiffre/rev2/info.json +++ b/keyboards/tominabox1/le_chiffre/rev2/info.json @@ -1,16 +1,7 @@ { - "usb": { - "device_version": "0.0.2" - }, - "rgblight": { - "led_count": 11 - }, - "ws2812": { - "pin": "B1" - }, - "matrix_pins": { - "cols": ["B2", "F0", "F1", "F4", "F5", "B5", "B4", "D7", "D6", "D4"], - "rows": ["B3", "F6", "F7", "C7"] + "bootloader": "atmel-dfu", + "build": { + "lto": true }, "diode_direction": "ROW2COL", "encoder": { @@ -18,14 +9,17 @@ {"pin_a": "B6", "pin_b": "C6"} ] }, - "rgb_matrix": { - "driver": "WS2812", - "sat_steps": 8, - "val_steps": 8, - "speed_steps": 10 + "matrix_pins": { + "cols": ["B2", "F0", "F1", "F4", "F5", "B5", "B4", "D7", "D6", "D4"], + "rows": ["B3", "F6", "F7", "C7"] }, "processor": "atmega32u4", - "bootloader": "atmel-dfu", + "usb": { + "device_version": "0.0.2" + }, + "ws2812": { + "pin": "B1" + }, "layouts": { "LAYOUT": { "layout": [ @@ -40,34 +34,28 @@ {"matrix": [0, 7], "x": 8, "y": 0}, {"matrix": [0, 8], "x": 9, "y": 0}, {"matrix": [0, 9], "x": 10, "y": 0}, - {"matrix": [1, 0], "x": 0, "y": 1}, {"matrix": [1, 1], "x": 1, "y": 1}, {"matrix": [1, 2], "x": 2, "y": 1}, {"matrix": [1, 3], "x": 3, "y": 1}, {"matrix": [1, 4], "x": 4, "y": 1}, - {"matrix": [1, 5], "x": 6, "y": 1}, {"matrix": [1, 6], "x": 7, "y": 1}, {"matrix": [1, 7], "x": 8, "y": 1}, {"matrix": [1, 8], "x": 9, "y": 1}, {"matrix": [1, 9], "x": 10, "y": 1}, - {"matrix": [2, 0], "x": 0, "y": 2}, {"matrix": [2, 1], "x": 1, "y": 2}, {"matrix": [2, 2], "x": 2, "y": 2}, {"matrix": [2, 3], "x": 3, "y": 2}, {"matrix": [2, 4], "x": 4, "y": 2}, - {"matrix": [2, 5], "x": 6, "y": 2}, {"matrix": [2, 6], "x": 7, "y": 2}, {"matrix": [2, 7], "x": 8, "y": 2}, {"matrix": [2, 8], "x": 9, "y": 2}, {"matrix": [2, 9], "x": 10, "y": 2}, - {"matrix": [3, 2], "x": 1.75, "y": 3, "w": 1.25}, {"matrix": [3, 4], "x": 3, "y": 3, "w": 2}, - {"matrix": [3, 5], "x": 6, "y": 3, "w": 2}, {"matrix": [3, 7], "x": 8, "y": 3, "w": 1.25} ] diff --git a/keyboards/tominabox1/le_chiffre/rev2/rev2.c b/keyboards/tominabox1/le_chiffre/rev2/rev2.c deleted file mode 100644 index 66b0eb2f08..0000000000 --- a/keyboards/tominabox1/le_chiffre/rev2/rev2.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2020 tominabox1 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "quantum.h" - -#ifdef RGB_MATRIX_ENABLE -led_config_t g_led_config = { { - // Key Matrix to LED Index - { 3, 4, NO_LED, 5, 6 }, - { NO_LED, NO_LED, 10, NO_LED, NO_LED }, - { NO_LED, NO_LED, 9, NO_LED, NO_LED }, - { 2, 1, 0, 8, 7 } -}, { - - // LED Index to Physical Position - { 128, 64 }, { 77, 64 }, { 0, 48 }, { 0, 0 }, { 115, 0 }, { 166, 0 }, { 255, 0 }, { 255, 48 }, { 178, 64 }, { 128, 40 }, { 128, 30 } -}, { - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 -} }; -#endif diff --git a/keyboards/tominabox1/le_chiffre/rev2/rules.mk b/keyboards/tominabox1/le_chiffre/rev2/rules.mk index 7d791dd396..6e7633bfe0 100644 --- a/keyboards/tominabox1/le_chiffre/rev2/rules.mk +++ b/keyboards/tominabox1/le_chiffre/rev2/rules.mk @@ -1,16 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes - +# This file intentionally left blank