diff options
author | 66f9e4eae <99080777+66f94eae@users.noreply.github.com> | 2022-02-22 01:09:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 09:09:19 -0800 |
commit | 249eb871028aaaaf508136088ef25fb67a83b28e (patch) | |
tree | 55cae2844f4672b9bb9ac6ff4c5840c795227f23 /keyboards/redox_w | |
parent | b1f86225136247177858203f08e7a3af09c4ad63 (diff) |
[Keyboard] [redox_w] add dvorak layout and white led support (#16259)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/redox_w')
-rw-r--r-- | keyboards/redox_w/keymaps/dvorak/keymap.c | 128 | ||||
-rw-r--r-- | keyboards/redox_w/keymaps/dvorak/readme.md | 38 | ||||
-rw-r--r-- | keyboards/redox_w/redox_w.c | 13 | ||||
-rw-r--r-- | keyboards/redox_w/redox_w.h | 27 |
4 files changed, 188 insertions, 18 deletions
diff --git a/keyboards/redox_w/keymaps/dvorak/keymap.c b/keyboards/redox_w/keymaps/dvorak/keymap.c new file mode 100644 index 0000000000..f2c2d85f04 --- /dev/null +++ b/keyboards/redox_w/keymaps/dvorak/keymap.c @@ -0,0 +1,128 @@ +/* Copyright 2021 66f94eae(66f94eae@gmail.com) + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layers { + _DVORAK, + _SYMB, + _QWERTY, + _ADJUST, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_DVORAK] = LAYOUT( +//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_GESC ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_BSPC , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_TAB ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,KC_LBRC, KC_RBRC ,KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_SLSH , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LCTL ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I ,KC_MINS, KC_EQL ,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_BSLS , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LSFT ,KC_SCLN ,KC_Q ,KC_J ,KC_K ,KC_X ,KC_PGUP ,KC_HOME , KC_END ,KC_PGDN ,KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_RSFT , +//├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + KC_CAPS ,KC_APP ,KC_LALT ,KC_LGUI , LT(3,KC_MUTE), KC_SPC ,KC_INS , KC_DEL ,KC_ENT , KC_RALT , KC_LEFT ,KC_DOWN ,KC_UP ,KC_RGHT +//└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ +), + +[_SYMB] = LAYOUT( +//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_GESC ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 , KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_BSPC , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_TAB , KC_BTN1 ,KC_MS_U ,KC_BTN2 ,KC_WH_U ,KC_COPY ,KC_F6 , KC_F7 ,KC_COPY ,KC_P7 ,KC_P8 ,KC_P9 ,KC_MPRV ,KC_PPLS , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LCTL ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_WH_D ,KC_CUT ,KC_VOLD , KC_VOLU ,KC_CUT ,KC_P4 ,KC_P5 ,KC_P6 ,KC_MNXT ,KC_PMNS , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LSFT ,KC_WH_L ,KC_UP ,KC_WH_R ,KC_LGUI ,KC_PSTE ,KC_WH_U ,KC_SLCK , KC_NLCK ,KC_WH_D ,KC_PSTE ,KC_P1 ,KC_P2 ,KC_P3 ,KC_PEQL ,KC_PAST , +//├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + KC_CAPS ,KC_LEFT ,KC_DOWN ,KC_RGHT, LT(3,KC_MUTE) ,KC_SPC ,KC_ESC , KC_DEL ,KC_ENT , KC_APP , KC_P0 ,KC_PDOT ,KC_PENT ,KC_PSLS +//└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ +), + +[_QWERTY] = LAYOUT( +//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_GESC ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_BSPC, +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_MINS , KC_EQL ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LCTL ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G ,KC_LBRC , KC_RBRC ,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,KC_QUOT , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_HOME ,KC_PGUP , KC_PGDN ,KC_END ,KC_N ,KC_M ,KC_COMM ,KC_DOT ,KC_SLSH ,KC_RSFT , +//├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + KC_CAPS ,KC_LGUI ,KC_LALT , KC_APP ,LT(3,KC_MUTE) , KC_SPC ,KC_INS , KC_DEL ,KC_ENT , KC_APP , KC_LEFT ,KC_UP ,KC_DOWN ,KC_RGHT +//└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ +), + +[_ADJUST] = LAYOUT( +//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_GESC ,TO(0) ,TO(1) ,TO(2) ,KC_NO ,KC_NO , KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO , KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO , KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO , +//├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LSFT ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_RSFT , +//├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + KC_NO ,KC_NO ,KC_NO ,KC_LGUI ,LT(3,KC_MUTE), KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_APP ,KC_NO ,KC_NO ,KC_NO ,KC_NO +//└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ +) + +}; + +layer_state_t layer_state_set_user(layer_state_t state) +{ + switch (get_highest_layer(state)) { + case _DVORAK: + blu_led_off; + grn_led_off; + break; + case _SYMB: + blu_led_on; + grn_led_off; + break; + case _QWERTY: + blu_led_off; + grn_led_on; + break; + case _ADJUST: + blu_led_on; + grn_led_on; + break; + default: + break; + } + return state; +} + +bool led_update_user(led_t led_state) +{ + if (led_state.caps_lock) { + red_led_on; + } else { + red_led_off; + } + if (led_state.num_lock) { + wht_led_on; + } else { + wht_led_off; + } + return false; +} diff --git a/keyboards/redox_w/keymaps/dvorak/readme.md b/keyboards/redox_w/keymaps/dvorak/readme.md new file mode 100644 index 0000000000..cdc90976a7 --- /dev/null +++ b/keyboards/redox_w/keymaps/dvorak/readme.md @@ -0,0 +1,38 @@ +### fork from default layout,and support dvorak layout[defalut layer] + +##### only use 3 layers + +``` +Keymap: 3 Layers +----------------- +stack of layers + ____________ precedence + / / | high + 31 /___________// | + : _:_:_:_:_:__ | + 3 /___________// | --- adjust + 2 /___________// | --- qwerty + 1 /___________// | --- symb + 0 /___________/ | --- dvorak[default] +``` + +defalut LED indicators + +RED --------- CAPS LOCK + +BLUE ------- SYMB layer + +GREEN----- QWERTY layer + +WHITE------ NUM LOCK *in my test case,this is inefficient on mac os* + +> BLUE and GREEN as a bit flag +> +> 0 0 + +| BLUE(0) | GREEN(0) | STATUS | DESCRIBE | +|:-------:|:--------:|:------:|:--------------------------------------------------- | +| 0 | 0 | 0 | layer 0[dvorak] is active,and blue,green led is off | +| 1 | 0 | 1 | layer1[symb] is active, and blue led is on | +| 0 | 1 | 2 | layer 2[qwerty] is active,and green led is on | +| 1 | 1 | 3 | layer 3[adjust] is active,and blue,green led is on | diff --git a/keyboards/redox_w/redox_w.c b/keyboards/redox_w/redox_w.c index 5b86344536..48ea7d3bed 100644 --- a/keyboards/redox_w/redox_w.c +++ b/keyboards/redox_w/redox_w.c @@ -1,10 +1,15 @@ #include "redox_w.h" void led_init(void) { - DDRD |= (1<<1); - PORTD |= (1<<1); - DDRF |= (1<<4) | (1<<5); - PORTF |= (1<<4) | (1<<5); + setPinOutput(D0); + setPinOutput(D1); + setPinOutput(F4); + setPinOutput(F5); + + writePinHigh(D0); + writePinHigh(D1); + writePinHigh(F4); + writePinHigh(F5); } diff --git a/keyboards/redox_w/redox_w.h b/keyboards/redox_w/redox_w.h index 727c3050dc..1ed42c8458 100644 --- a/keyboards/redox_w/redox_w.h +++ b/keyboards/redox_w/redox_w.h @@ -2,21 +2,20 @@ #include "quantum.h" -#define red_led_off PORTF |= (1<<5) -#define red_led_on PORTF &= ~(1<<5) -#define blu_led_off PORTF |= (1<<4) -#define blu_led_on PORTF &= ~(1<<4) -#define grn_led_off PORTD |= (1<<1) -#define grn_led_on PORTD &= ~(1<<1) +#define red_led_off writePinHigh(F5) +#define red_led_on writePinLow(F5) +#define blu_led_off writePinHigh(F4) +#define blu_led_on writePinLow(F4) +#define grn_led_off writePinHigh(D1) +#define grn_led_on writePinLow(D1) +#define wht_led_off writePinHigh(D0) +#define wht_led_on writePinLow(D0) -#define set_led_off red_led_off; grn_led_off; blu_led_off -#define set_led_red red_led_on; grn_led_off; blu_led_off -#define set_led_blue red_led_off; grn_led_off; blu_led_on -#define set_led_green red_led_off; grn_led_on; blu_led_off -#define set_led_yellow red_led_on; grn_led_on; blu_led_off -#define set_led_magenta red_led_on; grn_led_off; blu_led_on -#define set_led_cyan red_led_off; grn_led_on; blu_led_on -#define set_led_white red_led_on; grn_led_on; blu_led_on +#define set_led_off red_led_off; grn_led_off; blu_led_off; wht_led_off +#define set_led_red red_led_on; grn_led_off; blu_led_off; wht_led_off +#define set_led_blue red_led_off; grn_led_off; blu_led_on; wht_led_off +#define set_led_green red_led_off; grn_led_on; blu_led_off; wht_led_off +#define set_led_white red_led_off; grn_led_off; blu_led_off; wht_led_on // This a shortcut to help you visually see your layout. // The first section contains all of the arguements |