diff options
| author | Legonut <legonut3@gmail.com> | 2018-02-06 23:44:10 -0500 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-02-06 23:44:10 -0500 |
| commit | ad01e3c03a5213a46d5e6bd14cbb3c3231f68c78 (patch) | |
| tree | 790ce99ed792d643d4007a7c64357566529c35fd | |
| parent | 9cfcd494064439b0c8b31bc45969b0487ec6e81a (diff) | |
| download | qmk_firmware-ad01e3c03a5213a46d5e6bd14cbb3c3231f68c78.tar.gz qmk_firmware-ad01e3c03a5213a46d5e6bd14cbb3c3231f68c78.zip | |
New keyboard added "Zen" (#2347)
* New keyboard added
Zen is a split ortholinear currently in group buy.
* remove bad keymap
Keymap was throwing errors
* remove other bad keymap
I should have checked these before haha
* small fix to update folder name
* renamed temp
* renamed to zen
* update folder name
* Slim down matrix code
Suggested by drashna
* move KC_NO
* Update keymap
* change from rev2 to rev1
| -rw-r--r-- | keyboards/zen/config.h | 29 | ||||
| -rw-r--r-- | keyboards/zen/keymaps/default/config.h | 41 | ||||
| -rw-r--r-- | keyboards/zen/keymaps/default/keymap.c | 103 | ||||
| -rw-r--r-- | keyboards/zen/keymaps/default/rules.mk | 6 | ||||
| -rw-r--r-- | keyboards/zen/matrix.c | 466 | ||||
| -rw-r--r-- | keyboards/zen/readme.md | 12 | ||||
| -rw-r--r-- | keyboards/zen/rev1/config.h | 91 | ||||
| -rw-r--r-- | keyboards/zen/rev1/rev1.c | 22 | ||||
| -rw-r--r-- | keyboards/zen/rev1/rev1.h | 40 | ||||
| -rw-r--r-- | keyboards/zen/rev1/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/zen/rules.mk | 73 | ||||
| -rw-r--r-- | keyboards/zen/serial.c | 228 | ||||
| -rw-r--r-- | keyboards/zen/serial.h | 26 | ||||
| -rw-r--r-- | keyboards/zen/split_rgb.c | 41 | ||||
| -rw-r--r-- | keyboards/zen/split_rgb.h | 6 | ||||
| -rw-r--r-- | keyboards/zen/split_util.c | 86 | ||||
| -rw-r--r-- | keyboards/zen/split_util.h | 20 | ||||
| -rw-r--r-- | keyboards/zen/zen.c | 1 | ||||
| -rw-r--r-- | keyboards/zen/zen.h | 23 |
19 files changed, 1316 insertions, 0 deletions
diff --git a/keyboards/zen/config.h b/keyboards/zen/config.h new file mode 100644 index 000000000..f8f8bbf33 --- /dev/null +++ b/keyboards/zen/config.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Danny Nguyen <danny@hexwire.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | #endif // CONFIG_H | ||
| 24 | |||
| 25 | #undef RGBLED_NUM | ||
| 26 | #define RGBLIGHT_ANIMATIONS | ||
| 27 | #define RGBLED_NUM 16 | ||
| 28 | |||
| 29 | #define TAPPING_TERM 100 \ No newline at end of file | ||
diff --git a/keyboards/zen/keymaps/default/config.h b/keyboards/zen/keymaps/default/config.h new file mode 100644 index 000000000..38e4d73f0 --- /dev/null +++ b/keyboards/zen/keymaps/default/config.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Danny Nguyen <danny@hexwire.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_USER_H | ||
| 19 | #define CONFIG_USER_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* Use I2C or Serial, not both */ | ||
| 24 | |||
| 25 | #define USE_SERIAL | ||
| 26 | // #define USE_I2C | ||
| 27 | |||
| 28 | /* Select hand configuration */ | ||
| 29 | |||
| 30 | #define MASTER_LEFT | ||
| 31 | // #define MASTER_RIGHT | ||
| 32 | // #define EE_HANDS | ||
| 33 | |||
| 34 | #undef RGBLED_NUM | ||
| 35 | #define RGBLIGHT_ANIMATIONS | ||
| 36 | #define RGBLED_NUM 16 | ||
| 37 | #define RGBLIGHT_HUE_STEP 8 | ||
| 38 | #define RGBLIGHT_SAT_STEP 8 | ||
| 39 | #define RGBLIGHT_VAL_STEP 8 | ||
| 40 | |||
| 41 | #endif | ||
diff --git a/keyboards/zen/keymaps/default/keymap.c b/keyboards/zen/keymaps/default/keymap.c new file mode 100644 index 000000000..a955e892f --- /dev/null +++ b/keyboards/zen/keymaps/default/keymap.c | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | #include "zen.h" | ||
| 2 | #include "action_layer.h" | ||
| 3 | #include "eeconfig.h" | ||
| 4 | |||
| 5 | extern keymap_config_t keymap_config; | ||
| 6 | |||
| 7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 9 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 10 | // entirely and just use numbers. | ||
| 11 | #define _QWERTY 0 | ||
| 12 | #define _NAV 2 | ||
| 13 | |||
| 14 | |||
| 15 | enum custom_keycodes { | ||
| 16 | QWERTY = SAFE_RANGE, | ||
| 17 | NAV, | ||
| 18 | |||
| 19 | }; | ||
| 20 | |||
| 21 | // Fillers to make layering more clear | ||
| 22 | #define _______ KC_TRNS | ||
| 23 | #define XXXXXXX KC_NO | ||
| 24 | |||
| 25 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 26 | |||
| 27 | /* Qwerty | ||
| 28 | * ,-----------------------------------------. .-----------------------------------------. | ||
| 29 | * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
| 30 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 31 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | | ||
| 32 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 33 | * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " | | ||
| 34 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 35 | * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | | ||
| 36 | * |------+------+------+------+------+------+------..-----+------+------+------+------+------+------| | ||
| 37 | * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter|Space | NAV | - | = | PGUP | PGDN | | ||
| 38 | * `------------------------------------------------''-----------------------------------------------' | ||
| 39 | */ | ||
| 40 | [_QWERTY] = KEYMAP( \ | ||
| 41 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | ||
| 42 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \ | ||
| 43 | LT(_NAV, KC_CAPS),KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | ||
| 44 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ | ||
| 45 | KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_NAV), KC_SPC, KC_DEL, KC_ENT, KC_SPACE, MO(_NAV), KC_MINS, KC_EQL, KC_PGUP, KC_PGDN \ | ||
| 46 | ), | ||
| 47 | |||
| 48 | /* NAV | ||
| 49 | * ,-----------------------------------------. .-----------------------------------------. | ||
| 50 | * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | | ||
| 51 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 52 | * | |RGBSAI|RGBVAI|RGBSAD| RESET| [ | | ] | Pgup | Up | Pgdn |Insert| Home | | ||
| 53 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 54 | * | |RGBHUD|RGBVAD|RGBHUI| | | | | Left | Down | Right|Delete| End | | ||
| 55 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 56 | * |Shift | | | | | | | NKRO | | | Pause| Back | Next | | ||
| 57 | * |------+------+------+------+------+------+------..-----+------+------+------+------+------+------| | ||
| 58 | * | Ctrl | GUI | Alt |RGBMOD| | | || | | | | Mute | VOLUP| VOLDN| | ||
| 59 | * `------------------------------------------------''-----------------------------------------------' | ||
| 60 | */ | ||
| 61 | [_NAV] = KEYMAP( \ | ||
| 62 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12 , \ | ||
| 63 | KC_TRNS, RGB_SAI, RGB_VAI, RGB_SAD, RESET, KC_LBRC, KC_RBRC, KC_PGUP, KC_UP, KC_PGDN, KC_INS, KC_HOME , \ | ||
| 64 | KC_TRNS, RGB_HUD, RGB_VAD, RGB_HUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_END , \ | ||
| 65 | KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MAGIC_TOGGLE_NKRO, KC_TRNS, KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT , \ | ||
| 66 | KC_LCTL, KC_LGUI, KC_LALT, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLU, KC_VOLD \ | ||
| 67 | ), | ||
| 68 | |||
| 69 | }; | ||
| 70 | |||
| 71 | #ifdef AUDIO_ENABLE | ||
| 72 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 73 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 74 | #endif | ||
| 75 | |||
| 76 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 77 | eeconfig_update_default_layer(default_layer); | ||
| 78 | default_layer_set(default_layer); | ||
| 79 | } | ||
| 80 | |||
| 81 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 82 | switch (keycode) { | ||
| 83 | case QWERTY: | ||
| 84 | if (record->event.pressed) { | ||
| 85 | #ifdef AUDIO_ENABLE | ||
| 86 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 87 | #endif | ||
| 88 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 89 | } | ||
| 90 | return false; | ||
| 91 | break; | ||
| 92 | //case COLEMAK: | ||
| 93 | //if (record->event.pressed) { | ||
| 94 | //#ifdef AUDIO_ENABLE | ||
| 95 | //PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
| 96 | //#endif | ||
| 97 | //persistant_default_layer_set(1UL<<_COLEMAK); | ||
| 98 | //} | ||
| 99 | //return false; | ||
| 100 | //break; | ||
| 101 | } | ||
| 102 | return true; | ||
| 103 | } \ No newline at end of file | ||
diff --git a/keyboards/zen/keymaps/default/rules.mk b/keyboards/zen/keymaps/default/rules.mk new file mode 100644 index 000000000..22b6ec476 --- /dev/null +++ b/keyboards/zen/keymaps/default/rules.mk | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | RGBLIGHT_ENABLE = yes | ||
| 2 | BACKLIGHT_ENABLE = yes | ||
| 3 | |||
| 4 | ifndef QUANTUM_DIR | ||
| 5 | include ../../../../Makefile | ||
| 6 | endif | ||
diff --git a/keyboards/zen/matrix.c b/keyboards/zen/matrix.c new file mode 100644 index 000000000..12f22214e --- /dev/null +++ b/keyboards/zen/matrix.c | |||
| @@ -0,0 +1,466 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Danny Nguyen <danny@keeb.io> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* | ||
| 19 | * scan matrix | ||
| 20 | */ | ||
| 21 | #include <stdint.h> | ||
| 22 | #include <stdbool.h> | ||
| 23 | #include <avr/io.h> | ||
| 24 | #include "wait.h" | ||
| 25 | #include "print.h" | ||
| 26 | #include "debug.h" | ||
| 27 | #include "util.h" | ||
| 28 | #include "matrix.h" | ||
| 29 | #include "split_util.h" | ||
| 30 | #include "pro_micro.h" | ||
| 31 | #include "config.h" | ||
| 32 | #include "timer.h" | ||
| 33 | #include "backlight.h" | ||
| 34 | |||
| 35 | #ifdef USE_I2C | ||
| 36 | # include "i2c.h" | ||
| 37 | #else // USE_SERIAL | ||
| 38 | # include "serial.h" | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #ifndef DEBOUNCING_DELAY | ||
| 42 | # define DEBOUNCING_DELAY 5 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #if (DEBOUNCING_DELAY > 0) | ||
| 46 | static uint16_t debouncing_time; | ||
| 47 | static bool debouncing = false; | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #if (MATRIX_COLS <= 8) | ||
| 51 | # define print_matrix_header() print("\nr/c 01234567\n") | ||
| 52 | # define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) | ||
| 53 | # define matrix_bitpop(i) bitpop(matrix[i]) | ||
| 54 | # define ROW_SHIFTER ((uint8_t)1) | ||
| 55 | #else | ||
| 56 | # error "Currently only supports 8 COLS" | ||
| 57 | #endif | ||
| 58 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 59 | |||
| 60 | #define ERROR_DISCONNECT_COUNT 5 | ||
| 61 | |||
| 62 | #define SERIAL_LED_ADDR 0x00 | ||
| 63 | |||
| 64 | #define ROWS_PER_HAND (MATRIX_ROWS/2) | ||
| 65 | |||
| 66 | static uint8_t error_count = 0; | ||
| 67 | |||
| 68 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
| 69 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 70 | |||
| 71 | /* matrix state(1:on, 0:off) */ | ||
| 72 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 73 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 74 | |||
| 75 | #if (DIODE_DIRECTION == COL2ROW) | ||
| 76 | static void init_cols(void); | ||
| 77 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); | ||
| 78 | static void unselect_rows(void); | ||
| 79 | static void select_row(uint8_t row); | ||
| 80 | static void unselect_row(uint8_t row); | ||
| 81 | #elif (DIODE_DIRECTION == ROW2COL) | ||
| 82 | static void init_rows(void); | ||
| 83 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); | ||
| 84 | static void unselect_cols(void); | ||
| 85 | static void unselect_col(uint8_t col); | ||
| 86 | static void select_col(uint8_t col); | ||
| 87 | #endif | ||
| 88 | |||
| 89 | __attribute__ ((weak)) | ||
| 90 | void matrix_init_kb(void) { | ||
| 91 | matrix_init_user(); | ||
| 92 | } | ||
| 93 | |||
| 94 | __attribute__ ((weak)) | ||
| 95 | void matrix_scan_kb(void) { | ||
| 96 | matrix_scan_user(); | ||
| 97 | } | ||
| 98 | |||
| 99 | __attribute__ ((weak)) | ||
| 100 | void matrix_init_user(void) { | ||
| 101 | } | ||
| 102 | |||
| 103 | __attribute__ ((weak)) | ||
| 104 | void matrix_scan_user(void) { | ||
| 105 | } | ||
| 106 | |||
| 107 | inline | ||
| 108 | uint8_t matrix_rows(void) | ||
| 109 | { | ||
| 110 | return MATRIX_ROWS; | ||
| 111 | } | ||
| 112 | |||
| 113 | inline | ||
| 114 | uint8_t matrix_cols(void) | ||
| 115 | { | ||
| 116 | return MATRIX_COLS; | ||
| 117 | } | ||
| 118 | |||
| 119 | void matrix_init(void) | ||
| 120 | { | ||
| 121 | debug_enable = true; | ||
| 122 | debug_matrix = true; | ||
| 123 | debug_mouse = true; | ||
| 124 | // initialize row and col | ||
| 125 | unselect_rows(); | ||
| 126 | init_cols(); | ||
| 127 | |||
| 128 | TX_RX_LED_INIT; | ||
| 129 | |||
| 130 | // initialize matrix state: all keys off | ||
| 131 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 132 | matrix[i] = 0; | ||
| 133 | matrix_debouncing[i] = 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | |||
| 137 | } | ||
| 138 | |||
| 139 | uint8_t _matrix_scan(void) | ||
| 140 | { | ||
| 141 | int offset = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 142 | #if (DIODE_DIRECTION == COL2ROW) | ||
| 143 | // Set row, read cols | ||
| 144 | for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { | ||
| 145 | # if (DEBOUNCING_DELAY > 0) | ||
| 146 | bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); | ||
| 147 | |||
| 148 | if (matrix_changed) { | ||
| 149 | debouncing = true; | ||
| 150 | debouncing_time = timer_read(); | ||
| 151 | PORTD ^= (1 << 2); | ||
| 152 | } | ||
| 153 | |||
| 154 | # else | ||
| 155 | read_cols_on_row(matrix+offset, current_row); | ||
| 156 | # endif | ||
| 157 | |||
| 158 | } | ||
| 159 | |||
| 160 | #elif (DIODE_DIRECTION == ROW2COL) | ||
| 161 | // Set col, read rows | ||
| 162 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { | ||
| 163 | # if (DEBOUNCING_DELAY > 0) | ||
| 164 | bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); | ||
| 165 | if (matrix_changed) { | ||
| 166 | debouncing = true; | ||
| 167 | debouncing_time = timer_read(); | ||
| 168 | } | ||
| 169 | # else | ||
| 170 | read_rows_on_col(matrix+offset, current_col); | ||
| 171 | # endif | ||
| 172 | |||
| 173 | } | ||
| 174 | #endif | ||
| 175 | |||
| 176 | # if (DEBOUNCING_DELAY > 0) | ||
| 177 | if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { | ||
| 178 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 179 | matrix[i+offset] = matrix_debouncing[i+offset]; | ||
| 180 | } | ||
| 181 | debouncing = false; | ||
| 182 | } | ||
| 183 | # endif | ||
| 184 | |||
| 185 | return 1; | ||
| 186 | } | ||
| 187 | |||
| 188 | #ifdef USE_I2C | ||
| 189 | |||
| 190 | // Get rows from other half over i2c | ||
| 191 | int i2c_transaction(void) { | ||
| 192 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 193 | |||
| 194 | int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); | ||
| 195 | if (err) goto i2c_error; | ||
| 196 | |||
| 197 | // start of matrix stored at 0x00 | ||
| 198 | err = i2c_master_write(0x00); | ||
| 199 | if (err) goto i2c_error; | ||
| 200 | |||
| 201 | // Start read | ||
| 202 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | ||
| 203 | if (err) goto i2c_error; | ||
| 204 | |||
| 205 | if (!err) { | ||
| 206 | int i; | ||
| 207 | for (i = 0; i < ROWS_PER_HAND-1; ++i) { | ||
| 208 | matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); | ||
| 209 | } | ||
| 210 | matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); | ||
| 211 | i2c_master_stop(); | ||
| 212 | } else { | ||
| 213 | i2c_error: // the cable is disconnceted, or something else went wrong | ||
| 214 | i2c_reset_state(); | ||
| 215 | return err; | ||
| 216 | } | ||
| 217 | |||
| 218 | return 0; | ||
| 219 | } | ||
| 220 | |||
| 221 | #else // USE_SERIAL | ||
| 222 | |||
| 223 | int serial_transaction(void) { | ||
| 224 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 225 | |||
| 226 | if (serial_update_buffers()) { | ||
| 227 | return 1; | ||
| 228 | } | ||
| 229 | |||
| 230 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 231 | matrix[slaveOffset+i] = serial_slave_buffer[i]; | ||
| 232 | } | ||
| 233 | |||
| 234 | #ifdef BACKLIGHT_ENABLE | ||
| 235 | // Write backlight level for slave to read | ||
| 236 | serial_master_buffer[SERIAL_LED_ADDR] = get_backlight_level(); | ||
| 237 | #endif | ||
| 238 | return 0; | ||
| 239 | } | ||
| 240 | #endif | ||
| 241 | |||
| 242 | uint8_t matrix_scan(void) | ||
| 243 | { | ||
| 244 | uint8_t ret = _matrix_scan(); | ||
| 245 | |||
| 246 | #ifdef USE_I2C | ||
| 247 | if( i2c_transaction() ) { | ||
| 248 | #else // USE_SERIAL | ||
| 249 | if( serial_transaction() ) { | ||
| 250 | #endif | ||
| 251 | // turn on the indicator led when halves are disconnected | ||
| 252 | TXLED1; | ||
| 253 | |||
| 254 | error_count++; | ||
| 255 | |||
| 256 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 257 | // reset other half if disconnected | ||
| 258 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 259 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 260 | matrix[slaveOffset+i] = 0; | ||
| 261 | } | ||
| 262 | } | ||
| 263 | } else { | ||
| 264 | // turn off the indicator led on no error | ||
| 265 | TXLED0; | ||
| 266 | error_count = 0; | ||
| 267 | } | ||
| 268 | return ret; | ||
| 269 | } | ||
| 270 | |||
| 271 | void matrix_slave_scan(void) { | ||
| 272 | _matrix_scan(); | ||
| 273 | |||
| 274 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | ||
| 275 | |||
| 276 | #ifdef USE_I2C | ||
| 277 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 278 | i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 279 | } | ||
| 280 | #else // USE_SERIAL | ||
| 281 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 282 | serial_slave_buffer[i] = matrix[offset+i]; | ||
| 283 | } | ||
| 284 | |||
| 285 | #ifdef BACKLIGHT_ENABLE | ||
| 286 | // Read backlight level sent from master and update level on slave | ||
| 287 | backlight_set(serial_master_buffer[SERIAL_LED_ADDR]); | ||
| 288 | #endif | ||
| 289 | #endif | ||
| 290 | } | ||
| 291 | |||
| 292 | bool matrix_is_modified(void) | ||
| 293 | { | ||
| 294 | if (debouncing) return false; | ||
| 295 | return true; | ||
| 296 | } | ||
| 297 | |||
| 298 | inline | ||
| 299 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 300 | { | ||
| 301 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
| 302 | } | ||
| 303 | |||
| 304 | inline | ||
| 305 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 306 | { | ||
| 307 | return matrix[row]; | ||
| 308 | } | ||
| 309 | |||
| 310 | void matrix_print(void) | ||
| 311 | { | ||
| 312 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 313 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 314 | phex(row); print(": "); | ||
| 315 | pbin_reverse16(matrix_get_row(row)); | ||
| 316 | print("\n"); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | uint8_t matrix_key_count(void) | ||
| 321 | { | ||
| 322 | uint8_t count = 0; | ||
| 323 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 324 | count += bitpop16(matrix[i]); | ||
| 325 | } | ||
| 326 | return count; | ||
| 327 | } | ||
| 328 | |||
| 329 | #if (DIODE_DIRECTION == COL2ROW) | ||
| 330 | |||
| 331 | static void init_cols(void) | ||
| 332 | { | ||
| 333 | for(uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
| 334 | uint8_t pin = col_pins[x]; | ||
| 335 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
| 336 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) | ||
| 341 | { | ||
| 342 | // Store last value of row prior to reading | ||
| 343 | matrix_row_t last_row_value = current_matrix[current_row]; | ||
| 344 | |||
| 345 | // Clear data in matrix row | ||
| 346 | current_matrix[current_row] = 0; | ||
| 347 | |||
| 348 | // Select row and wait for row selecton to stabilize | ||
| 349 | select_row(current_row); | ||
| 350 | wait_us(30); | ||
| 351 | |||
| 352 | // For each col... | ||
| 353 | for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { | ||
| 354 | |||
| 355 | // Select the col pin to read (active low) | ||
| 356 | uint8_t pin = col_pins[col_index]; | ||
| 357 | uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); | ||
| 358 | |||
| 359 | // Populate the matrix row with the state of the col pin | ||
| 360 | current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); | ||
| 361 | } | ||
| 362 | |||
| 363 | // Unselect row | ||
| 364 | unselect_row(current_row); | ||
| 365 | |||
| 366 | return (last_row_value != current_matrix[current_row]); | ||
| 367 | } | ||
| 368 | |||
| 369 | static void select_row(uint8_t row) | ||
| 370 | { | ||
| 371 | uint8_t pin = row_pins[row]; | ||
| 372 | _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT | ||
| 373 | _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW | ||
| 374 | } | ||
| 375 | |||
| 376 | static void unselect_row(uint8_t row) | ||
| 377 | { | ||
| 378 | uint8_t pin = row_pins[row]; | ||
| 379 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
| 380 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
| 381 | } | ||
| 382 | |||
| 383 | static void unselect_rows(void) | ||
| 384 | { | ||
| 385 | for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { | ||
| 386 | uint8_t pin = row_pins[x]; | ||
| 387 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
| 388 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
| 389 | } | ||
| 390 | } | ||
| 391 | |||
| 392 | #elif (DIODE_DIRECTION == ROW2COL) | ||
| 393 | |||
| 394 | static void init_rows(void) | ||
| 395 | { | ||
| 396 | for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { | ||
| 397 | uint8_t pin = row_pins[x]; | ||
| 398 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
| 399 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
| 400 | } | ||
| 401 | } | ||
| 402 | |||
| 403 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) | ||
| 404 | { | ||
| 405 | bool matrix_changed = false; | ||
| 406 | |||
| 407 | // Select col and wait for col selecton to stabilize | ||
| 408 | select_col(current_col); | ||
| 409 | wait_us(30); | ||
| 410 | |||
| 411 | // For each row... | ||
| 412 | for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) | ||
| 413 | { | ||
| 414 | |||
| 415 | // Store last value of row prior to reading | ||
| 416 | matrix_row_t last_row_value = current_matrix[row_index]; | ||
| 417 | |||
| 418 | // Check row pin state | ||
| 419 | if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) | ||
| 420 | { | ||
| 421 | // Pin LO, set col bit | ||
| 422 | current_matrix[row_index] |= (ROW_SHIFTER << current_col); | ||
| 423 | } | ||
| 424 | else | ||
| 425 | { | ||
| 426 | // Pin HI, clear col bit | ||
| 427 | current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); | ||
| 428 | } | ||
| 429 | |||
| 430 | // Determine if the matrix changed state | ||
| 431 | if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) | ||
| 432 | { | ||
| 433 | matrix_changed = true; | ||
| 434 | } | ||
| 435 | } | ||
| 436 | |||
| 437 | // Unselect col | ||
| 438 | unselect_col(current_col); | ||
| 439 | |||
| 440 | return matrix_changed; | ||
| 441 | } | ||
| 442 | |||
| 443 | static void select_col(uint8_t col) | ||
| 444 | { | ||
| 445 | uint8_t pin = col_pins[col]; | ||
| 446 | _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT | ||
| 447 | _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW | ||
| 448 | } | ||
| 449 | |||
| 450 | static void unselect_col(uint8_t col) | ||
| 451 | { | ||
| 452 | uint8_t pin = col_pins[col]; | ||
| 453 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
| 454 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
| 455 | } | ||
| 456 | |||
| 457 | static void unselect_cols(void) | ||
| 458 | { | ||
| 459 | for(uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
| 460 | uint8_t pin = col_pins[x]; | ||
| 461 | _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN | ||
| 462 | _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI | ||
| 463 | } | ||
| 464 | } | ||
| 465 | |||
| 466 | #endif | ||
diff --git a/keyboards/zen/readme.md b/keyboards/zen/readme.md new file mode 100644 index 000000000..36c63d293 --- /dev/null +++ b/keyboards/zen/readme.md | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | Zen Keyboard | ||
| 2 | ==== | ||
| 3 | |||
| 4 | A split ergo keyboard with a few goals in mind: | ||
| 5 | - Be as thin as possible. Other split KBs (Let's Split, Nyquist, Iris) are 15.2mm thick. The Zen is only 8.0mm thick. | ||
| 6 | - Layout designed for gaming. 1.5u pinky keys, ortho alphas, and angled thumb keys. After trying Ortholiniear, Atreus62, and Ergodox, this is the best layout for gaming and typing. | ||
| 7 | - RGB backlighting. 16 WS2812b LEDs shine through the perimeter switches. The SK6812 variant are cheap and easy to solder. | ||
| 8 | - Price. Using Arduino Pro Micro, SK6812 LEDs, and PCB FR4 for the case, the cost of each half without switches or caps can be reduced to under $20 when purchased at volume. | ||
| 9 | |||
| 10 | A build guide and more info for this keyboard can be found here: [Zen Build Guide](https://legonut.gitbooks.io/zen-keyboard/content/) | ||
| 11 | |||
| 12 | Maintained by u/legonut3 \ No newline at end of file | ||
diff --git a/keyboards/zen/rev1/config.h b/keyboards/zen/rev1/config.h new file mode 100644 index 000000000..efae55892 --- /dev/null +++ b/keyboards/zen/rev1/config.h | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Danny Nguyen <danny@hexwire.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef REV1_CONFIG_H | ||
| 19 | #define REV1_CONFIG_H | ||
| 20 | |||
| 21 | #include QMK_KEYBOARD_CONFIG_H | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xCEEB | ||
| 25 | #define PRODUCT_ID 0x1256 | ||
| 26 | #define DEVICE_VER 0x0200 | ||
| 27 | #define MANUFACTURER Legonut | ||
| 28 | #define PRODUCT Project Zen | ||
| 29 | #define DESCRIPTION Split gaming keyboard | ||
| 30 | |||
| 31 | /* key matrix size */ | ||
| 32 | // Rows are doubled-up | ||
| 33 | #define MATRIX_ROWS 10 | ||
| 34 | #define MATRIX_COLS 7 | ||
| 35 | |||
| 36 | // wiring of each half | ||
| 37 | #define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 } | ||
| 38 | #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, D4, B6 } | ||
| 39 | |||
| 40 | /* COL2ROW or ROW2COL */ | ||
| 41 | #define DIODE_DIRECTION COL2ROW | ||
| 42 | |||
| 43 | /* define if matrix has ghost */ | ||
| 44 | //#define MATRIX_HAS_GHOST | ||
| 45 | |||
| 46 | /* number of backlight levels */ | ||
| 47 | // #define BACKLIGHT_LEVELS 3 | ||
| 48 | |||
| 49 | /* Set 0 if debouncing isn't needed */ | ||
| 50 | #define DEBOUNCING_DELAY 5 | ||
| 51 | |||
| 52 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 53 | #define LOCKING_SUPPORT_ENABLE | ||
| 54 | /* Locking resynchronize hack */ | ||
| 55 | #define LOCKING_RESYNC_ENABLE | ||
| 56 | |||
| 57 | /* key combination for command */ | ||
| 58 | #define IS_COMMAND() ( \ | ||
| 59 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 60 | ) | ||
| 61 | |||
| 62 | #define BACKLIGHT_PIN F4 | ||
| 63 | #define BACKLIGHT_LEVELS 5 | ||
| 64 | |||
| 65 | |||
| 66 | /* ws2812 RGB LED */ | ||
| 67 | #define RGB_DI_PIN D1 | ||
| 68 | #define RGBLIGHT_TIMER | ||
| 69 | #define RGBLED_NUM 16 // Number of LEDs | ||
| 70 | #define ws2812_PORTREG PORTD | ||
| 71 | #define ws2812_DDRREG DDRD | ||
| 72 | |||
| 73 | /* | ||
| 74 | * Feature disable options | ||
| 75 | * These options are also useful to firmware size reduction. | ||
| 76 | */ | ||
| 77 | |||
| 78 | /* disable debug print */ | ||
| 79 | // #define NO_DEBUG | ||
| 80 | |||
| 81 | /* disable print */ | ||
| 82 | // #define NO_PRINT | ||
| 83 | |||
| 84 | /* disable action features */ | ||
| 85 | //#define NO_ACTION_LAYER | ||
| 86 | //#define NO_ACTION_TAPPING | ||
| 87 | //#define NO_ACTION_ONESHOT | ||
| 88 | //#define NO_ACTION_MACRO | ||
| 89 | //#define NO_ACTION_FUNCTION | ||
| 90 | |||
| 91 | #endif | ||
diff --git a/keyboards/zen/rev1/rev1.c b/keyboards/zen/rev1/rev1.c new file mode 100644 index 000000000..5f4cd32f6 --- /dev/null +++ b/keyboards/zen/rev1/rev1.c | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #include "rev1.h" | ||
| 2 | |||
| 3 | #ifdef SSD1306OLED | ||
| 4 | void led_set_kb(uint8_t usb_led) { | ||
| 5 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 6 | led_set_user(usb_led); | ||
| 7 | } | ||
| 8 | #endif | ||
| 9 | |||
| 10 | void matrix_init_kb(void) { | ||
| 11 | |||
| 12 | // // green led on | ||
| 13 | // DDRD |= (1<<5); | ||
| 14 | // PORTD &= ~(1<<5); | ||
| 15 | |||
| 16 | // // orange led on | ||
| 17 | // DDRB |= (1<<0); | ||
| 18 | // PORTB &= ~(1<<0); | ||
| 19 | |||
| 20 | matrix_init_user(); | ||
| 21 | }; | ||
| 22 | |||
diff --git a/keyboards/zen/rev1/rev1.h b/keyboards/zen/rev1/rev1.h new file mode 100644 index 000000000..4983bb2a3 --- /dev/null +++ b/keyboards/zen/rev1/rev1.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #ifndef REV1_H | ||
| 2 | #define REV1_H | ||
| 3 | |||
| 4 | #include "zen.h" | ||
| 5 | |||
| 6 | //void promicro_bootloader_jmp(bool program); | ||
| 7 | #include "quantum.h" | ||
| 8 | |||
| 9 | |||
| 10 | #ifdef USE_I2C | ||
| 11 | #include <stddef.h> | ||
| 12 | #ifdef __AVR__ | ||
| 13 | #include <avr/io.h> | ||
| 14 | #include <avr/interrupt.h> | ||
| 15 | #endif | ||
| 16 | #endif | ||
| 17 | |||
| 18 | //void promicro_bootloader_jmp(bool program); | ||
| 19 | |||
| 20 | #define KEYMAP( \ | ||
| 21 | k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \ | ||
| 22 | k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \ | ||
| 23 | k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \ | ||
| 24 | k30, k31, k32, k33, k34, k35, k85, k84, k83, k82, k81, k80, \ | ||
| 25 | k40, k41, k42, k43, k44, k45, k46, k96, k95, k94, k93, k92, k91, k90 \ | ||
| 26 | ) \ | ||
| 27 | { \ | ||
| 28 | { k00, k01, k02, k03, k04, k05, KC_NO }, \ | ||
| 29 | { k10, k11, k12, k13, k14, k15, KC_NO }, \ | ||
| 30 | { k20, k21, k22, k23, k24, k25, KC_NO }, \ | ||
| 31 | { k30, k31, k32, k33, k34, k35, KC_NO }, \ | ||
| 32 | { k40, k41, k42, k43, k44, k45, k46 }, \ | ||
| 33 | { k50, k51, k52, k53, k54, k55, KC_NO }, \ | ||
| 34 | { k60, k61, k62, k63, k64, k65, KC_NO }, \ | ||
| 35 | { k70, k71, k72, k73, k74, k75, KC_NO }, \ | ||
| 36 | { k80, k81, k82, k83, k84, k85, KC_NO }, \ | ||
| 37 | { k90, k91, k92, k93, k94, k95, k96 } \ | ||
| 38 | } | ||
| 39 | |||
| 40 | #endif | ||
diff --git a/keyboards/zen/rev1/rules.mk b/keyboards/zen/rev1/rules.mk new file mode 100644 index 000000000..d7463419b --- /dev/null +++ b/keyboards/zen/rev1/rules.mk | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | RGBLIGHT_ENABLE = yes | ||
| 2 | BACKLIGHT_ENABLE = yes | ||
diff --git a/keyboards/zen/rules.mk b/keyboards/zen/rules.mk new file mode 100644 index 000000000..32d3dc51c --- /dev/null +++ b/keyboards/zen/rules.mk | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | SRC += matrix.c \ | ||
| 2 | split_util.c \ | ||
| 3 | serial.c | ||
| 4 | |||
| 5 | # MCU name | ||
| 6 | #MCU = at90usb1287 | ||
| 7 | MCU = atmega32u4 | ||
| 8 | |||
| 9 | # Processor frequency. | ||
| 10 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 11 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 12 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 13 | # automatically to create a 32-bit value in your source code. | ||
| 14 | # | ||
| 15 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 16 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 17 | # does not *change* the processor frequency - it should merely be updated to | ||
| 18 | # reflect the processor speed set externally so that the code can use accurate | ||
| 19 | # software delays. | ||
| 20 | F_CPU = 16000000 | ||
| 21 | |||
| 22 | # | ||
| 23 | # LUFA specific | ||
| 24 | # | ||
| 25 | # Target architecture (see library "Board Types" documentation). | ||
| 26 | ARCH = AVR8 | ||
| 27 | |||
| 28 | # Input clock frequency. | ||
| 29 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 30 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 31 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 32 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 33 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 34 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 35 | # source code. | ||
| 36 | # | ||
| 37 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 38 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 39 | F_USB = $(F_CPU) | ||
| 40 | |||
| 41 | # Bootloader | ||
| 42 | # This definition is optional, and if your keyboard supports multiple bootloaders of | ||
| 43 | # different sizes, comment this out, and the correct address will be loaded | ||
| 44 | # automatically (+60). See bootloader.mk for all options. | ||
| 45 | BOOTLOADER = caterina | ||
| 46 | |||
| 47 | # Interrupt driven control endpoint task(+60) | ||
| 48 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 49 | |||
| 50 | # Build Options | ||
| 51 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 52 | # the appropriate keymap folder that will get included automatically | ||
| 53 | # | ||
| 54 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 55 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 56 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 57 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 58 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 59 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 60 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
| 61 | MIDI_ENABLE = no # MIDI controls | ||
| 62 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 63 | UNICODE_ENABLE = no # Unicode | ||
| 64 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 65 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 66 | SUBPROJECT_rev1 = yes | ||
| 67 | USE_I2C = no | ||
| 68 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 69 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 70 | |||
| 71 | CUSTOM_MATRIX = yes | ||
| 72 | |||
| 73 | DEFAULT_FOLDER = zen/rev1 | ||
diff --git a/keyboards/zen/serial.c b/keyboards/zen/serial.c new file mode 100644 index 000000000..74bcbb6bf --- /dev/null +++ b/keyboards/zen/serial.c | |||
| @@ -0,0 +1,228 @@ | |||
| 1 | /* | ||
| 2 | * WARNING: be careful changing this code, it is very timing dependent | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef F_CPU | ||
| 6 | #define F_CPU 16000000 | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #include <avr/io.h> | ||
| 10 | #include <avr/interrupt.h> | ||
| 11 | #include <util/delay.h> | ||
| 12 | #include <stdbool.h> | ||
| 13 | #include "serial.h" | ||
| 14 | |||
| 15 | #ifndef USE_I2C | ||
| 16 | |||
| 17 | // Serial pulse period in microseconds. Its probably a bad idea to lower this | ||
| 18 | // value. | ||
| 19 | #define SERIAL_DELAY 24 | ||
| 20 | |||
| 21 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | ||
| 22 | uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; | ||
| 23 | |||
| 24 | #define SLAVE_DATA_CORRUPT (1<<0) | ||
| 25 | volatile uint8_t status = 0; | ||
| 26 | |||
| 27 | inline static | ||
| 28 | void serial_delay(void) { | ||
| 29 | _delay_us(SERIAL_DELAY); | ||
| 30 | } | ||
| 31 | |||
| 32 | inline static | ||
| 33 | void serial_output(void) { | ||
| 34 | SERIAL_PIN_DDR |= SERIAL_PIN_MASK; | ||
| 35 | } | ||
| 36 | |||
| 37 | // make the serial pin an input with pull-up resistor | ||
| 38 | inline static | ||
| 39 | void serial_input(void) { | ||
| 40 | SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; | ||
| 41 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 42 | } | ||
| 43 | |||
| 44 | inline static | ||
| 45 | uint8_t serial_read_pin(void) { | ||
| 46 | return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); | ||
| 47 | } | ||
| 48 | |||
| 49 | inline static | ||
| 50 | void serial_low(void) { | ||
| 51 | SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; | ||
| 52 | } | ||
| 53 | |||
| 54 | inline static | ||
| 55 | void serial_high(void) { | ||
| 56 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 57 | } | ||
| 58 | |||
| 59 | void serial_master_init(void) { | ||
| 60 | serial_output(); | ||
| 61 | serial_high(); | ||
| 62 | } | ||
| 63 | |||
| 64 | void serial_slave_init(void) { | ||
| 65 | serial_input(); | ||
| 66 | |||
| 67 | // Enable INT0 | ||
| 68 | EIMSK |= _BV(INT0); | ||
| 69 | // Trigger on falling edge of INT0 | ||
| 70 | EICRA &= ~(_BV(ISC00) | _BV(ISC01)); | ||
| 71 | } | ||
| 72 | |||
| 73 | // Used by the master to synchronize timing with the slave. | ||
| 74 | static | ||
| 75 | void sync_recv(void) { | ||
| 76 | serial_input(); | ||
| 77 | // This shouldn't hang if the slave disconnects because the | ||
| 78 | // serial line will float to high if the slave does disconnect. | ||
| 79 | while (!serial_read_pin()); | ||
| 80 | serial_delay(); | ||
| 81 | } | ||
| 82 | |||
| 83 | // Used by the slave to send a synchronization signal to the master. | ||
| 84 | static | ||
| 85 | void sync_send(void) { | ||
| 86 | serial_output(); | ||
| 87 | |||
| 88 | serial_low(); | ||
| 89 | serial_delay(); | ||
| 90 | |||
| 91 | serial_high(); | ||
| 92 | } | ||
| 93 | |||
| 94 | // Reads a byte from the serial line | ||
| 95 | static | ||
| 96 | uint8_t serial_read_byte(void) { | ||
| 97 | uint8_t byte = 0; | ||
| 98 | serial_input(); | ||
| 99 | for ( uint8_t i = 0; i < 8; ++i) { | ||
| 100 | byte = (byte << 1) | serial_read_pin(); | ||
| 101 | serial_delay(); | ||
| 102 | _delay_us(1); | ||
| 103 | } | ||
| 104 | |||
| 105 | return byte; | ||
| 106 | } | ||
| 107 | |||
| 108 | // Sends a byte with MSB ordering | ||
| 109 | static | ||
| 110 | void serial_write_byte(uint8_t data) { | ||
| 111 | uint8_t b = 8; | ||
| 112 | serial_output(); | ||
| 113 | while( b-- ) { | ||
| 114 | if(data & (1 << b)) { | ||
| 115 | serial_high(); | ||
| 116 | } else { | ||
| 117 | serial_low(); | ||
| 118 | } | ||
| 119 | serial_delay(); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | // interrupt handle to be used by the slave device | ||
| 124 | ISR(SERIAL_PIN_INTERRUPT) { | ||
| 125 | sync_send(); | ||
| 126 | |||
| 127 | uint8_t checksum = 0; | ||
| 128 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
| 129 | serial_write_byte(serial_slave_buffer[i]); | ||
| 130 | sync_send(); | ||
| 131 | checksum += serial_slave_buffer[i]; | ||
| 132 | } | ||
| 133 | serial_write_byte(checksum); | ||
| 134 | sync_send(); | ||
| 135 | |||
| 136 | // wait for the sync to finish sending | ||
| 137 | serial_delay(); | ||
| 138 | |||
| 139 | // read the middle of pulses | ||
| 140 | _delay_us(SERIAL_DELAY/2); | ||
| 141 | |||
| 142 | uint8_t checksum_computed = 0; | ||
| 143 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
| 144 | serial_master_buffer[i] = serial_read_byte(); | ||
| 145 | sync_send(); | ||
| 146 | checksum_computed += serial_master_buffer[i]; | ||
| 147 | } | ||
| 148 | uint8_t checksum_received = serial_read_byte(); | ||
| 149 | sync_send(); | ||
| 150 | |||
| 151 | serial_input(); // end transaction | ||
| 152 | |||
| 153 | if ( checksum_computed != checksum_received ) { | ||
| 154 | status |= SLAVE_DATA_CORRUPT; | ||
| 155 | } else { | ||
| 156 | status &= ~SLAVE_DATA_CORRUPT; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | inline | ||
| 161 | bool serial_slave_DATA_CORRUPT(void) { | ||
| 162 | return status & SLAVE_DATA_CORRUPT; | ||
| 163 | } | ||
| 164 | |||
| 165 | // Copies the serial_slave_buffer to the master and sends the | ||
| 166 | // serial_master_buffer to the slave. | ||
| 167 | // | ||
| 168 | // Returns: | ||
| 169 | // 0 => no error | ||
| 170 | // 1 => slave did not respond | ||
| 171 | int serial_update_buffers(void) { | ||
| 172 | // this code is very time dependent, so we need to disable interrupts | ||
| 173 | cli(); | ||
| 174 | |||
| 175 | // signal to the slave that we want to start a transaction | ||
| 176 | serial_output(); | ||
| 177 | serial_low(); | ||
| 178 | _delay_us(1); | ||
| 179 | |||
| 180 | // wait for the slaves response | ||
| 181 | serial_input(); | ||
| 182 | serial_high(); | ||
| 183 | _delay_us(SERIAL_DELAY); | ||
| 184 | |||
| 185 | // check if the slave is present | ||
| 186 | if (serial_read_pin()) { | ||
| 187 | // slave failed to pull the line low, assume not present | ||
| 188 | sei(); | ||
| 189 | return 1; | ||
| 190 | } | ||
| 191 | |||
| 192 | // if the slave is present syncronize with it | ||
| 193 | sync_recv(); | ||
| 194 | |||
| 195 | uint8_t checksum_computed = 0; | ||
| 196 | // receive data from the slave | ||
| 197 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
| 198 | serial_slave_buffer[i] = serial_read_byte(); | ||
| 199 | sync_recv(); | ||
| 200 | checksum_computed += serial_slave_buffer[i]; | ||
| 201 | } | ||
| 202 | uint8_t checksum_received = serial_read_byte(); | ||
| 203 | sync_recv(); | ||
| 204 | |||
| 205 | if (checksum_computed != checksum_received) { | ||
| 206 | sei(); | ||
| 207 | return 1; | ||
| 208 | } | ||
| 209 | |||
| 210 | uint8_t checksum = 0; | ||
| 211 | // send data to the slave | ||
| 212 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
| 213 | serial_write_byte(serial_master_buffer[i]); | ||
| 214 | sync_recv(); | ||
| 215 | checksum += serial_master_buffer[i]; | ||
| 216 | } | ||
| 217 | serial_write_byte(checksum); | ||
| 218 | sync_recv(); | ||
| 219 | |||
| 220 | // always, release the line when not in use | ||
| 221 | serial_output(); | ||
| 222 | serial_high(); | ||
| 223 | |||
| 224 | sei(); | ||
| 225 | return 0; | ||
| 226 | } | ||
| 227 | |||
| 228 | #endif | ||
diff --git a/keyboards/zen/serial.h b/keyboards/zen/serial.h new file mode 100644 index 000000000..15fe4db7b --- /dev/null +++ b/keyboards/zen/serial.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #ifndef MY_SERIAL_H | ||
| 2 | #define MY_SERIAL_H | ||
| 3 | |||
| 4 | #include "config.h" | ||
| 5 | #include <stdbool.h> | ||
| 6 | |||
| 7 | /* TODO: some defines for interrupt setup */ | ||
| 8 | #define SERIAL_PIN_DDR DDRD | ||
| 9 | #define SERIAL_PIN_PORT PORTD | ||
| 10 | #define SERIAL_PIN_INPUT PIND | ||
| 11 | #define SERIAL_PIN_MASK _BV(PD0) | ||
| 12 | #define SERIAL_PIN_INTERRUPT INT0_vect | ||
| 13 | |||
| 14 | #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 15 | #define SERIAL_MASTER_BUFFER_LENGTH 1 | ||
| 16 | |||
| 17 | // Buffers for master - slave communication | ||
| 18 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; | ||
| 19 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; | ||
| 20 | |||
| 21 | void serial_master_init(void); | ||
| 22 | void serial_slave_init(void); | ||
| 23 | int serial_update_buffers(void); | ||
| 24 | bool serial_slave_data_corrupt(void); | ||
| 25 | |||
| 26 | #endif | ||
diff --git a/keyboards/zen/split_rgb.c b/keyboards/zen/split_rgb.c new file mode 100644 index 000000000..6d7cb44cf --- /dev/null +++ b/keyboards/zen/split_rgb.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #include <stdint.h> | ||
| 2 | #include <stdbool.h> | ||
| 3 | #include "split_util.h" | ||
| 4 | #include "progmem.h" | ||
| 5 | #include "print.h" | ||
| 6 | #include "rgblight.h" | ||
| 7 | |||
| 8 | #ifdef USE_I2C | ||
| 9 | # include "i2c.h" | ||
| 10 | #else // USE_SERIAL | ||
| 11 | # include "serial.h" | ||
| 12 | #endif | ||
| 13 | |||
| 14 | |||
| 15 | rgblight_config_t rgblight_config; | ||
| 16 | |||
| 17 | void rgblight_slave_update(void) { | ||
| 18 | //rgblight_effect_christmas(); | ||
| 19 | } | ||
| 20 | |||
| 21 | |||
| 22 | void rgblight_set(void) { | ||
| 23 | if (rgblight_config.enable) { | ||
| 24 | #ifdef RGBW | ||
| 25 | ws2812_setleds_rgbw(led, RGBLED_NUM); | ||
| 26 | #else | ||
| 27 | ws2812_setleds(led, RGBLED_NUM); | ||
| 28 | #endif | ||
| 29 | } else { | ||
| 30 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | ||
| 31 | led[i].r = 0; | ||
| 32 | led[i].g = 0; | ||
| 33 | led[i].b = 0; | ||
| 34 | } | ||
| 35 | #ifdef RGBW | ||
| 36 | ws2812_setleds_rgbw(led, RGBLED_NUM); | ||
| 37 | #else | ||
| 38 | ws2812_setleds(led, RGBLED_NUM); | ||
| 39 | #endif | ||
| 40 | } | ||
| 41 | } | ||
diff --git a/keyboards/zen/split_rgb.h b/keyboards/zen/split_rgb.h new file mode 100644 index 000000000..5f552890a --- /dev/null +++ b/keyboards/zen/split_rgb.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef SPLIT_RGB_H | ||
| 2 | #define SPLIT_RGB_H | ||
| 3 | |||
| 4 | void rgblight_slave_update(void); | ||
| 5 | |||
| 6 | #endif | ||
diff --git a/keyboards/zen/split_util.c b/keyboards/zen/split_util.c new file mode 100644 index 000000000..346cbc908 --- /dev/null +++ b/keyboards/zen/split_util.c | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | #include <avr/io.h> | ||
| 2 | #include <avr/wdt.h> | ||
| 3 | #include <avr/power.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/delay.h> | ||
| 6 | #include <avr/eeprom.h> | ||
| 7 | #include "split_util.h" | ||
| 8 | #include "matrix.h" | ||
| 9 | #include "keyboard.h" | ||
| 10 | #include "config.h" | ||
| 11 | #include "timer.h" | ||
| 12 | |||
| 13 | #ifdef USE_I2C | ||
| 14 | # include "i2c.h" | ||
| 15 | #else | ||
| 16 | # include "serial.h" | ||
| 17 | #endif | ||
| 18 | |||
| 19 | volatile bool isLeftHand = true; | ||
| 20 | |||
| 21 | static void setup_handedness(void) { | ||
| 22 | #ifdef EE_HANDS | ||
| 23 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | ||
| 24 | #else | ||
| 25 | // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c | ||
| 26 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) | ||
| 27 | isLeftHand = !has_usb(); | ||
| 28 | #else | ||
| 29 | isLeftHand = has_usb(); | ||
| 30 | #endif | ||
| 31 | #endif | ||
| 32 | } | ||
| 33 | |||
| 34 | static void keyboard_master_setup(void) { | ||
| 35 | #ifdef USE_I2C | ||
| 36 | i2c_master_init(); | ||
| 37 | #ifdef SSD1306OLED | ||
| 38 | matrix_master_OLED_init (); | ||
| 39 | #endif | ||
| 40 | #else | ||
| 41 | serial_master_init(); | ||
| 42 | #endif | ||
| 43 | } | ||
| 44 | |||
| 45 | static void keyboard_slave_setup(void) { | ||
| 46 | timer_init(); | ||
| 47 | #ifdef USE_I2C | ||
| 48 | i2c_slave_init(SLAVE_I2C_ADDRESS); | ||
| 49 | #else | ||
| 50 | serial_slave_init(); | ||
| 51 | #endif | ||
| 52 | } | ||
| 53 | |||
| 54 | bool has_usb(void) { | ||
| 55 | USBCON |= (1 << OTGPADE); //enables VBUS pad | ||
| 56 | _delay_us(5); | ||
| 57 | return (USBSTA & (1<<VBUS)); //checks state of VBUS | ||
| 58 | } | ||
| 59 | |||
| 60 | void split_keyboard_setup(void) { | ||
| 61 | setup_handedness(); | ||
| 62 | |||
| 63 | if (has_usb()) { | ||
| 64 | keyboard_master_setup(); | ||
| 65 | } else { | ||
| 66 | keyboard_slave_setup(); | ||
| 67 | } | ||
| 68 | sei(); | ||
| 69 | } | ||
| 70 | |||
| 71 | void keyboard_slave_loop(void) { | ||
| 72 | matrix_init(); | ||
| 73 | |||
| 74 | while (1) { | ||
| 75 | matrix_slave_scan(); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | // this code runs before the usb and keyboard is initialized | ||
| 80 | void matrix_setup(void) { | ||
| 81 | split_keyboard_setup(); | ||
| 82 | |||
| 83 | if (!has_usb()) { | ||
| 84 | keyboard_slave_loop(); | ||
| 85 | } | ||
| 86 | } | ||
diff --git a/keyboards/zen/split_util.h b/keyboards/zen/split_util.h new file mode 100644 index 000000000..595a0659e --- /dev/null +++ b/keyboards/zen/split_util.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef SPLIT_KEYBOARD_UTIL_H | ||
| 2 | #define SPLIT_KEYBOARD_UTIL_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include "eeconfig.h" | ||
| 6 | |||
| 7 | #define SLAVE_I2C_ADDRESS 0x32 | ||
| 8 | |||
| 9 | extern volatile bool isLeftHand; | ||
| 10 | |||
| 11 | // slave version of matix scan, defined in matrix.c | ||
| 12 | void matrix_slave_scan(void); | ||
| 13 | |||
| 14 | void split_keyboard_setup(void); | ||
| 15 | bool has_usb(void); | ||
| 16 | void keyboard_slave_loop(void); | ||
| 17 | |||
| 18 | void matrix_master_OLED_init (void); | ||
| 19 | |||
| 20 | #endif | ||
diff --git a/keyboards/zen/zen.c b/keyboards/zen/zen.c new file mode 100644 index 000000000..22131ef5c --- /dev/null +++ b/keyboards/zen/zen.c | |||
| @@ -0,0 +1 @@ | |||
| #include "zen.h" | |||
diff --git a/keyboards/zen/zen.h b/keyboards/zen/zen.h new file mode 100644 index 000000000..4560ff8cd --- /dev/null +++ b/keyboards/zen/zen.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #ifndef ZEN_H | ||
| 2 | #define ZEN_H | ||
| 3 | |||
| 4 | #include "rev1.h" | ||
| 5 | #include "quantum.h" | ||
| 6 | |||
| 7 | // Used to create a keymap using only KC_ prefixed keys | ||
| 8 | #define KC_KEYMAP( \ | ||
| 9 | L00, L01, L02, L03, L04, L05, R01, R02, R03, R04, R05, R06,\ | ||
| 10 | L10, L11, L12, L13, L14, L15, R11, R12, R13, R14, R15, R16,\ | ||
| 11 | L20, L21, L22, L23, L24, L25, R21, R22, R23, R24, R25, R26,\ | ||
| 12 | L30, L31, L32, L33, L34, L35, R31, R32, R33, R34, R35, R36,\ | ||
| 13 | L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46 \ | ||
| 14 | ) \ | ||
| 15 | KEYMAP( \ | ||
| 16 | KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, KC_##R06, \ | ||
| 17 | KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, KC_##R16, \ | ||
| 18 | KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, KC_##R26, \ | ||
| 19 | KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, KC_##R36, \ | ||
| 20 | KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##L46, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45, KC_##R46, \ | ||
| 21 | ) | ||
| 22 | |||
| 23 | #endif \ No newline at end of file | ||
