diff options
author | Nick Brassel <nick@tzarc.org> | 2023-11-28 16:39:48 +1100 |
---|---|---|
committer | Nick Brassel <nick@tzarc.org> | 2023-11-28 16:40:47 +1100 |
commit | 0115951de12bd4c798a43a380651c34552552e85 (patch) | |
tree | 62999011ae782d93aa6dc9c889615db2a840cafc /keyboards/jian | |
parent | 0379d1f59e58cefa18cdb72ba1b77507d1108ae6 (diff) | |
parent | 4d99e0a23cff02f4c6e55e093b5de08a9be0df7c (diff) |
`develop` -> `master`, 2023q4 edition
Diffstat (limited to 'keyboards/jian')
-rw-r--r-- | keyboards/jian/keymaps/advanced/config.h | 2 | ||||
-rw-r--r-- | keyboards/jian/keymaps/advanced/keymap.c | 120 | ||||
-rw-r--r-- | keyboards/jian/rev1/config.h | 1 | ||||
-rw-r--r-- | keyboards/jian/rev1/info.json | 23 | ||||
-rw-r--r-- | keyboards/jian/rev1/rules.mk | 1 |
5 files changed, 67 insertions, 80 deletions
diff --git a/keyboards/jian/keymaps/advanced/config.h b/keyboards/jian/keymaps/advanced/config.h index 1a033d8311..edeab03fb1 100644 --- a/keyboards/jian/keymaps/advanced/config.h +++ b/keyboards/jian/keymaps/advanced/config.h @@ -24,3 +24,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //#define AUTO_SHIFT_MODIFIERS #define ALT_LAYOUTS_ENABLE //#define TRAINING_HALFES_LOCK + +#define LAYER_STATE_32BIT diff --git a/keyboards/jian/keymaps/advanced/keymap.c b/keyboards/jian/keymaps/advanced/keymap.c index a825e061b5..7702fc20b7 100644 --- a/keyboards/jian/keymaps/advanced/keymap.c +++ b/keyboards/jian/keymaps/advanced/keymap.c @@ -11,7 +11,6 @@ typedef union { user_config_t user_config; #ifdef STENO_ENABLE -#include "keymap_steno.h" #endif // STENO_ENABLE @@ -86,9 +85,6 @@ enum jian_layers { _LEFT, _RIGHT, #endif //TRAINING_HALFES_LOCK -#ifdef DIPS_ENABLE - _DIPS, -#endif // DIPS_ENABLE #ifdef STENO_ENABLE _PLOVER #endif // STENO_ENABLE @@ -107,7 +103,7 @@ enum jian_keycodes { CH_QWE, CH_DVK, //endif // ALT_LAYOUTS_ENABLE -#ifdef DIPS_ENABLE +#ifdef DIP_SWITCH_ENABLE LAYOUT0, LAYOUT1, LAYOUT2, @@ -120,18 +116,18 @@ enum jian_keycodes { DIP9, DIP10, DIP11, -#endif // DIPS_ENABLE +#endif // DIP_SWITCH_ENABLE }; #ifdef TRAINING_HALFES_LOCK static uint8_t lock_timeout = 1; static uint8_t lock_cooldown = 0; #endif //TRAINING_HALFES_LOCK -#ifdef DIPS_ENABLE +#ifdef DIP_SWITCH_ENABLE #ifdef ALT_LAYOUTS_ENABLE static uint8_t layout_conversion_dip_state = 0; #endif // ALT_LAYOUTS_ENABLE -#endif // DIPS_ENABLE +#endif // DIP_SWITCH_ENABLE #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) @@ -190,13 +186,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT_base_wrapper(QWERTY_base), -#ifdef DIPS_ENABLE -[_DIPS] = LAYOUT_dips( - LAYOUT0, LAYOUT1, LAYOUT2, LAYOUT3, DIP_ISO, FLIP_TH, - LAYOUT0, LAYOUT1, LAYOUT2, LAYOUT3, DIP_ISO, FLIP_TH -), -#endif // DIPS_ENABLE - [_LOWER] = LAYOUT( _______, KC_UNDS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, F12_RGU, EQL_LCT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, MIN_RCT, @@ -282,7 +271,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } -#ifdef DIPS_ENABLE +#ifdef DIP_SWITCH_ENABLE #ifdef ALT_LAYOUTS_ENABLE void layout_convert(uint8_t statuses) { switch (0b1111 & statuses) { @@ -337,13 +326,7 @@ void layout_convert(uint8_t statuses) { } } #endif // ALT_LAYOUTS_ENABLE -#endif // DIPS_ENABLE - -void matrix_init_user(void) { -#ifdef DIPS_ENABLE - layer_on(_DIPS); -#endif // DIPS_ENABLE -} +#endif // DIP_SWITCH_ENABLE void keyboard_post_init_user(void) { user_config.raw = eeconfig_read_user(); @@ -515,70 +498,83 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; #endif // ALT_LAYOUTS_ENABLE -#ifdef DIPS_ENABLE -#ifdef ALT_LAYOUTS_ENABLE - case LAYOUT0: + case THUMB_ALT: + if (record->event.pressed) { + layer_invert(_THUMB_ALT); + user_config.thumb_alt ^= 1; + eeconfig_update_user(user_config.raw); + } + return false; + case ISO: if (record->event.pressed) { + layer_invert(_ISO); + user_config.iso ^= 1; + eeconfig_update_user(user_config.raw); + } + return false; + } + return true; +} + +#if defined(DIP_SWITCH_ENABLE) +bool dip_switch_update_user(uint8_t index, bool active) { + switch (index) { +# if defined(ALT_LAYOUTS_ENABLE) + case 0: // LAYOUT0 + case 6: + if (active) { layout_conversion_dip_state |= 1 << 0; } else { layout_conversion_dip_state &= ~(1 << 0); } layout_convert(layout_conversion_dip_state); - return false; - case LAYOUT1: - if (record->event.pressed) { + break; + case 1: // LAYOUT1 + case 7: + if (active) { layout_conversion_dip_state |= 1 << 1; } else { layout_conversion_dip_state &= ~(1 << 1); } layout_convert(layout_conversion_dip_state); - return false; - case LAYOUT2: - if (record->event.pressed) { + break; + case 2: // LAYOUT2 + case 8: + if (active) { layout_conversion_dip_state |= 1 << 2; } else { layout_conversion_dip_state &= ~(1 << 2); } layout_convert(layout_conversion_dip_state); - return false; - case LAYOUT3: - if (record->event.pressed) { + break; + case 3: // LAYOUT3 + case 9: + if (active) { layout_conversion_dip_state |= 1 << 3; } else { layout_conversion_dip_state &= ~(1 << 3); } layout_convert(layout_conversion_dip_state); - return false; -#endif // ALT_LAYOUTS_ENABLE - case DIP_ISO: - if (record->event.pressed) { - layer_on(_ISO); + break; + case 4: // DIP_ISO + case 10: + if (active) { + layer_on(_ISO); } else { - layer_off(_ISO); + layer_off(_ISO); } - return false; - case FLIP_TH: - if (record->event.pressed) { - layer_on(_THUMB_ALT); + break; + case 5: // FLIP_TH + case 11: + if (active) { + layer_on(_THUMB_ALT); } else { - layer_off(_THUMB_ALT); - } - return false; -#endif // DIPS_ENABLE - case THUMB_ALT: - if (record->event.pressed) { - layer_invert(_THUMB_ALT); - user_config.thumb_alt ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; - case ISO: - if (record->event.pressed) { - layer_invert(_ISO); - user_config.iso ^= 1; - eeconfig_update_user(user_config.raw); + layer_off(_THUMB_ALT); } - return false; + break; +# endif } + return true; } +#endif diff --git a/keyboards/jian/rev1/config.h b/keyboards/jian/rev1/config.h index 8f1a34c2ff..fcdf59f044 100644 --- a/keyboards/jian/rev1/config.h +++ b/keyboards/jian/rev1/config.h @@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define EE_HANDS // different Jian configs -#define DIPS_ENABLE #define PHYSICAL_LEDS_ENABLE #define NUM_LOCK_LED_PIN C6 #define CAPS_LOCK_LED_PIN D7 diff --git a/keyboards/jian/rev1/info.json b/keyboards/jian/rev1/info.json index 27c5c957a6..68a6efe47b 100644 --- a/keyboards/jian/rev1/info.json +++ b/keyboards/jian/rev1/info.json @@ -8,6 +8,12 @@ "rows": ["D3", "D2", "E6", "B4"] }, "diode_direction": "COL2ROW", + "dip_switch": { + "matrix_grid": [ + [1, 0], [2, 0], [3, 0], [3, 1], [3, 2], [3, 3], + [7, 3], [7, 2], [7, 1], [7, 0], [6, 0], [5, 0] + ] + }, "backlight": { "pin": "B6", "levels": 5 @@ -90,23 +96,6 @@ {"matrix": [7, 5], "x": 10, "y": 3.375}, {"matrix": [7, 4], "x": 11, "y": 3.25} ] - }, - "LAYOUT_dips": { - "layout": [ - {"matrix": [1, 0], "x": 0, "y": 0}, - {"matrix": [2, 0], "x": 1, "y": 0}, - {"matrix": [3, 0], "x": 2, "y": 0}, - {"matrix": [3, 1], "x": 3, "y": 0}, - {"matrix": [3, 2], "x": 4, "y": 0}, - {"matrix": [3, 3], "x": 5, "y": 0}, - - {"matrix": [7, 3], "x": 6, "y": 0}, - {"matrix": [7, 2], "x": 7, "y": 0}, - {"matrix": [7, 1], "x": 8, "y": 0}, - {"matrix": [7, 0], "x": 9, "y": 0}, - {"matrix": [6, 0], "x": 10, "y": 0}, - {"matrix": [5, 0], "x": 11, "y": 0} - ] } } } diff --git a/keyboards/jian/rev1/rules.mk b/keyboards/jian/rev1/rules.mk index 8e6da2d84f..33588c1755 100644 --- a/keyboards/jian/rev1/rules.mk +++ b/keyboards/jian/rev1/rules.mk @@ -5,3 +5,4 @@ CONSOLE_ENABLE = no SPLIT_KEYBOARD = yes BACKLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes +DIP_SWITCH_ENABLE = yes |