diff options
| author | climbalima <climbalima@gmail.com> | 2016-11-10 18:19:13 -0500 |
|---|---|---|
| committer | climbalima <climbalima@gmail.com> | 2016-11-10 18:19:13 -0500 |
| commit | 6e27f6fbde47804035d508eb84690ed7ee9acee7 (patch) | |
| tree | 53444134c444afe05a86ceae827b73e99d216d84 | |
| parent | 21e443101f4873a813d33e50486d4e9591e89f4e (diff) | |
| download | qmk_firmware-6e27f6fbde47804035d508eb84690ed7ee9acee7.tar.gz qmk_firmware-6e27f6fbde47804035d508eb84690ed7ee9acee7.zip | |
Changes to be committed:
new file: keyboards/lets_splitv2/Makefile
new file: keyboards/lets_splitv2/config.h
new file: keyboards/lets_splitv2/i2c.c
new file: keyboards/lets_splitv2/i2c.h
new file: keyboards/lets_splitv2/imgs/split-keyboard-i2c-schematic.png
new file: keyboards/lets_splitv2/imgs/split-keyboard-serial-schematic.png
new file: keyboards/lets_splitv2/keymaps/default/keymap.c
new file: keyboards/lets_splitv2/lets_split.c
new file: keyboards/lets_splitv2/lets_split.h
new file: keyboards/lets_splitv2/matrix.c
new file: keyboards/lets_splitv2/pro_micro.h
new file: keyboards/lets_splitv2/readme.md
new file: keyboards/lets_splitv2/serial.c
new file: keyboards/lets_splitv2/serial.h
new file: keyboards/lets_splitv2/split_util.c
new file: keyboards/lets_splitv2/split_util.h
new file: keyboards/maxipad/Makefile
new file: keyboards/maxipad/config.h
new file: keyboards/maxipad/keymaps/default/Makefile
new file: keyboards/maxipad/keymaps/default/config.h
new file: keyboards/maxipad/keymaps/default/keymap.c
new file: keyboards/maxipad/keymaps/default/readme.md
new file: keyboards/maxipad/maxipad.c
new file: keyboards/maxipad/maxipad.h
new file: keyboards/maxipad/readme.md
29 files changed, 2119 insertions, 68 deletions
diff --git a/keyboards/lets_split/Makefile b/keyboards/lets_split/Makefile index b9f07636b..982cfc591 100644 --- a/keyboards/lets_split/Makefile +++ b/keyboards/lets_split/Makefile | |||
| @@ -67,7 +67,7 @@ AUDIO_ENABLE ?= yes # Audio output on port C6 | |||
| 67 | UNICODE_ENABLE ?= no # Unicode | 67 | UNICODE_ENABLE ?= no # Unicode |
| 68 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | 68 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 69 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | 69 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. |
| 70 | 70 | USE_I2C ?= yes | |
| 71 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 71 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
| 72 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | 72 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend |
| 73 | 73 | ||
diff --git a/keyboards/lets_split/config.h b/keyboards/lets_split/config.h index 6f90997ab..bf618704c 100644 --- a/keyboards/lets_split/config.h +++ b/keyboards/lets_split/config.h | |||
| @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 25 | #define PRODUCT_ID 0x3060 | 25 | #define PRODUCT_ID 0x3060 |
| 26 | #define DEVICE_VER 0x0001 | 26 | #define DEVICE_VER 0x0001 |
| 27 | #define MANUFACTURER Wootpatoot | 27 | #define MANUFACTURER Wootpatoot |
| 28 | #define PRODUCT Lets Split | 28 | #define PRODUCT Lets Split v2 |
| 29 | #define DESCRIPTION A split keyboard for the cheap makers | 29 | #define DESCRIPTION A split keyboard for the cheap makers |
| 30 | 30 | ||
| 31 | /* key matrix size */ | 31 | /* key matrix size */ |
| @@ -34,8 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 34 | #define MATRIX_COLS 6 | 34 | #define MATRIX_COLS 6 |
| 35 | 35 | ||
| 36 | // wiring of each half | 36 | // wiring of each half |
| 37 | #define MATRIX_ROW_PINS { B5, B4, E6, D7 } | 37 | #define MATRIX_ROW_PINS { D7, E6, B4, B5 } |
| 38 | #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 } | 38 | #define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } |
| 39 | 39 | ||
| 40 | #define CATERINA_BOOTLOADER | 40 | #define CATERINA_BOOTLOADER |
| 41 | 41 | ||
diff --git a/keyboards/lets_split/keymaps/default/keymap.c b/keyboards/lets_split/keymaps/default/keymap.c index 0d2d94b67..8c8466ebd 100644 --- a/keyboards/lets_split/keymaps/default/keymap.c +++ b/keyboards/lets_split/keymaps/default/keymap.c | |||
| @@ -42,64 +42,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 42 | * `-----------------------------------------------------------------------------------' | 42 | * `-----------------------------------------------------------------------------------' |
| 43 | */ | 43 | */ |
| 44 | [_QWERTY] = KEYMAP( \ | 44 | [_QWERTY] = KEYMAP( \ |
| 45 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | 45 | KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ |
| 46 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | 46 | KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ |
| 47 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ | 47 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ |
| 48 | ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | 48 | KC_LCTL, _LOWER, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, KC_LSFT, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ |
| 49 | ), | 49 | ), |
| 50 | 50 | ||
| 51 | /* Colemak | ||
| 52 | * ,-----------------------------------------------------------------------------------. | ||
| 53 | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
| 54 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 55 | * | Esc | A | R | S | T | D | H | N | E | I | O | " | | ||
| 56 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 57 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
| 58 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 59 | * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | | ||
| 60 | * `-----------------------------------------------------------------------------------' | ||
| 61 | */ | ||
| 62 | [_COLEMAK] = KEYMAP( \ | ||
| 63 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ | ||
| 64 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ | ||
| 65 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ | ||
| 66 | ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 67 | ), | ||
| 68 | |||
| 69 | /* Dvorak | ||
| 70 | * ,-----------------------------------------------------------------------------------. | ||
| 71 | * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | | ||
| 72 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 73 | * | Esc | A | O | E | U | I | D | H | T | N | S | / | | ||
| 74 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 75 | * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | | ||
| 76 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 77 | * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | | ||
| 78 | * `-----------------------------------------------------------------------------------' | ||
| 79 | */ | ||
| 80 | [_DVORAK] = KEYMAP( \ | ||
| 81 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ | ||
| 82 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ | ||
| 83 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ | ||
| 84 | ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 85 | ), | ||
| 86 | |||
| 87 | /* Lower | ||
| 88 | * ,-----------------------------------------------------------------------------------. | ||
| 89 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 90 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 91 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | | ||
| 92 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 93 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | | ||
| 94 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 95 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 96 | * `-----------------------------------------------------------------------------------' | ||
| 97 | */ | ||
| 98 | [_LOWER] = KEYMAP( \ | 51 | [_LOWER] = KEYMAP( \ |
| 99 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ | 52 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ |
| 100 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ | 53 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ |
| 101 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ | 54 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ |
| 102 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | 55 | _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ |
| 103 | ), | 56 | ), |
| 104 | 57 | ||
| 105 | /* Raise | 58 | /* Raise |
| @@ -117,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 117 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | 70 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ |
| 118 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | 71 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ |
| 119 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | 72 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ |
| 120 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | 73 | _______, _______, _______, _______, _______, KC_ENT, KC_ENT, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ |
| 121 | ), | 74 | ), |
| 122 | 75 | ||
| 123 | /* Adjust (Lower + Raise) | 76 | /* Adjust (Lower + Raise) |
| @@ -131,14 +84,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 131 | * | | | | | | | | | | | | | 84 | * | | | | | | | | | | | | |
| 132 | * `-----------------------------------------------------------------------------------' | 85 | * `-----------------------------------------------------------------------------------' |
| 133 | */ | 86 | */ |
| 134 | [_ADJUST] = KEYMAP( \ | ||
| 135 | _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ | ||
| 136 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ | ||
| 137 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 138 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 139 | ) | ||
| 140 | |||
| 141 | |||
| 142 | }; | 87 | }; |
| 143 | 88 | ||
| 144 | #ifdef AUDIO_ENABLE | 89 | #ifdef AUDIO_ENABLE |
diff --git a/keyboards/lets_split/lets_split.h b/keyboards/lets_split/lets_split.h index fe7ae0767..04844ed63 100644 --- a/keyboards/lets_split/lets_split.h +++ b/keyboards/lets_split/lets_split.h | |||
| @@ -6,10 +6,10 @@ | |||
| 6 | void promicro_bootloader_jmp(bool program); | 6 | void promicro_bootloader_jmp(bool program); |
| 7 | 7 | ||
| 8 | #define KEYMAP( \ | 8 | #define KEYMAP( \ |
| 9 | k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \ | 9 | k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ |
| 10 | k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \ | 10 | k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ |
| 11 | k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \ | 11 | k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ |
| 12 | k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \ | 12 | k30, k31, k32, k33, k34, k35, k75, k74, k73, k72, k71, k70 \ |
| 13 | ) \ | 13 | ) \ |
| 14 | { \ | 14 | { \ |
| 15 | { k00, k01, k02, k03, k04, k05 }, \ | 15 | { k00, k01, k02, k03, k04, k05 }, \ |
diff --git a/keyboards/lets_splitv2/Makefile b/keyboards/lets_splitv2/Makefile new file mode 100644 index 000000000..982cfc591 --- /dev/null +++ b/keyboards/lets_splitv2/Makefile | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | SRC += matrix.c \ | ||
| 2 | i2c.c \ | ||
| 3 | split_util.c \ | ||
| 4 | serial.c | ||
| 5 | |||
| 6 | # MCU name | ||
| 7 | #MCU = at90usb1287 | ||
| 8 | MCU = atmega32u4 | ||
| 9 | |||
| 10 | # Processor frequency. | ||
| 11 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 12 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 13 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 14 | # automatically to create a 32-bit value in your source code. | ||
| 15 | # | ||
| 16 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 17 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 18 | # does not *change* the processor frequency - it should merely be updated to | ||
| 19 | # reflect the processor speed set externally so that the code can use accurate | ||
| 20 | # software delays. | ||
| 21 | F_CPU = 16000000 | ||
| 22 | |||
| 23 | # | ||
| 24 | # LUFA specific | ||
| 25 | # | ||
| 26 | # Target architecture (see library "Board Types" documentation). | ||
| 27 | ARCH = AVR8 | ||
| 28 | |||
| 29 | # Input clock frequency. | ||
| 30 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 31 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 32 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 33 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 34 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 35 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 36 | # source code. | ||
| 37 | # | ||
| 38 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 39 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 40 | F_USB = $(F_CPU) | ||
| 41 | |||
| 42 | # Interrupt driven control endpoint task(+60) | ||
| 43 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 44 | |||
| 45 | |||
| 46 | # Boot Section Size in *bytes* | ||
| 47 | # Teensy halfKay 512 | ||
| 48 | # Teensy++ halfKay 1024 | ||
| 49 | # Atmel DFU loader 4096 | ||
| 50 | # LUFA bootloader 4096 | ||
| 51 | # USBaspLoader 2048 | ||
| 52 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 53 | |||
| 54 | # Build Options | ||
| 55 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 56 | # the appropriate keymap folder that will get included automatically | ||
| 57 | # | ||
| 58 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
| 59 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 60 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 61 | CONSOLE_ENABLE ?= no # Console for debug(+400) | ||
| 62 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 63 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 64 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 65 | MIDI_ENABLE ?= no # MIDI controls | ||
| 66 | AUDIO_ENABLE ?= yes # Audio output on port C6 | ||
| 67 | UNICODE_ENABLE ?= no # Unicode | ||
| 68 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 69 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 70 | USE_I2C ?= yes | ||
| 71 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 72 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
| 73 | |||
| 74 | CUSTOM_MATRIX = yes | ||
| 75 | |||
| 76 | ifndef QUANTUM_DIR | ||
| 77 | include ../../Makefile | ||
| 78 | endif \ No newline at end of file | ||
diff --git a/keyboards/lets_splitv2/config.h b/keyboards/lets_splitv2/config.h new file mode 100644 index 000000000..bf618704c --- /dev/null +++ b/keyboards/lets_splitv2/config.h | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.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 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xFEED | ||
| 25 | #define PRODUCT_ID 0x3060 | ||
| 26 | #define DEVICE_VER 0x0001 | ||
| 27 | #define MANUFACTURER Wootpatoot | ||
| 28 | #define PRODUCT Lets Split v2 | ||
| 29 | #define DESCRIPTION A split keyboard for the cheap makers | ||
| 30 | |||
| 31 | /* key matrix size */ | ||
| 32 | // Rows are doubled-up | ||
| 33 | #define MATRIX_ROWS 8 | ||
| 34 | #define MATRIX_COLS 6 | ||
| 35 | |||
| 36 | // wiring of each half | ||
| 37 | #define MATRIX_ROW_PINS { D7, E6, B4, B5 } | ||
| 38 | #define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } | ||
| 39 | |||
| 40 | #define CATERINA_BOOTLOADER | ||
| 41 | |||
| 42 | // #define USE_I2C | ||
| 43 | |||
| 44 | // #define EE_HANDS | ||
| 45 | |||
| 46 | #define I2C_MASTER_LEFT | ||
| 47 | // #define I2C_MASTER_RIGHT | ||
| 48 | |||
| 49 | /* COL2ROW or ROW2COL */ | ||
| 50 | #define DIODE_DIRECTION COL2ROW | ||
| 51 | |||
| 52 | /* define if matrix has ghost */ | ||
| 53 | //#define MATRIX_HAS_GHOST | ||
| 54 | |||
| 55 | /* number of backlight levels */ | ||
| 56 | // #define BACKLIGHT_LEVELS 3 | ||
| 57 | |||
| 58 | /* Set 0 if debouncing isn't needed */ | ||
| 59 | #define DEBOUNCING_DELAY 5 | ||
| 60 | |||
| 61 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 62 | #define LOCKING_SUPPORT_ENABLE | ||
| 63 | /* Locking resynchronize hack */ | ||
| 64 | #define LOCKING_RESYNC_ENABLE | ||
| 65 | |||
| 66 | /* key combination for command */ | ||
| 67 | #define IS_COMMAND() ( \ | ||
| 68 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 69 | ) | ||
| 70 | |||
| 71 | /* ws2812 RGB LED */ | ||
| 72 | #define ws2812_PORTREG PORTD | ||
| 73 | #define ws2812_DDRREG DDRD | ||
| 74 | #define ws2812_pin PD1 | ||
| 75 | #define RGBLED_NUM 28 // Number of LEDs | ||
| 76 | #define RGBLIGHT_HUE_STEP 10 | ||
| 77 | #define RGBLIGHT_SAT_STEP 17 | ||
| 78 | #define RGBLIGHT_VAL_STEP 17 | ||
| 79 | |||
| 80 | /* | ||
| 81 | * Feature disable options | ||
| 82 | * These options are also useful to firmware size reduction. | ||
| 83 | */ | ||
| 84 | |||
| 85 | /* disable debug print */ | ||
| 86 | // #define NO_DEBUG | ||
| 87 | |||
| 88 | /* disable print */ | ||
| 89 | // #define NO_PRINT | ||
| 90 | |||
| 91 | /* disable action features */ | ||
| 92 | //#define NO_ACTION_LAYER | ||
| 93 | //#define NO_ACTION_TAPPING | ||
| 94 | //#define NO_ACTION_ONESHOT | ||
| 95 | //#define NO_ACTION_MACRO | ||
| 96 | //#define NO_ACTION_FUNCTION | ||
| 97 | |||
| 98 | #endif \ No newline at end of file | ||
diff --git a/keyboards/lets_splitv2/i2c.c b/keyboards/lets_splitv2/i2c.c new file mode 100644 index 000000000..c72789403 --- /dev/null +++ b/keyboards/lets_splitv2/i2c.c | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | #include <util/twi.h> | ||
| 2 | #include <avr/io.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/twi.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include "i2c.h" | ||
| 8 | |||
| 9 | // Limits the amount of we wait for any one i2c transaction. | ||
| 10 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | ||
| 11 | // 9 bits, a single transaction will take around 90μs to complete. | ||
| 12 | // | ||
| 13 | // (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit | ||
| 14 | // poll loop takes at least 8 clock cycles to execute | ||
| 15 | #define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 | ||
| 16 | |||
| 17 | #define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) | ||
| 18 | |||
| 19 | volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 20 | |||
| 21 | static volatile uint8_t slave_buffer_pos; | ||
| 22 | static volatile bool slave_has_register_set = false; | ||
| 23 | |||
| 24 | // Wait for an i2c operation to finish | ||
| 25 | inline static | ||
| 26 | void i2c_delay(void) { | ||
| 27 | uint16_t lim = 0; | ||
| 28 | while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) | ||
| 29 | lim++; | ||
| 30 | |||
| 31 | // easier way, but will wait slightly longer | ||
| 32 | // _delay_us(100); | ||
| 33 | } | ||
| 34 | |||
| 35 | // Setup twi to run at 100kHz | ||
| 36 | void i2c_master_init(void) { | ||
| 37 | // no prescaler | ||
| 38 | TWSR = 0; | ||
| 39 | // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. | ||
| 40 | // Check datasheets for more info. | ||
| 41 | TWBR = ((F_CPU/SCL_CLOCK)-16)/2; | ||
| 42 | } | ||
| 43 | |||
| 44 | // Start a transaction with the given i2c slave address. The direction of the | ||
| 45 | // transfer is set with I2C_READ and I2C_WRITE. | ||
| 46 | // returns: 0 => success | ||
| 47 | // 1 => error | ||
| 48 | uint8_t i2c_master_start(uint8_t address) { | ||
| 49 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); | ||
| 50 | |||
| 51 | i2c_delay(); | ||
| 52 | |||
| 53 | // check that we started successfully | ||
| 54 | if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) | ||
| 55 | return 1; | ||
| 56 | |||
| 57 | TWDR = address; | ||
| 58 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 59 | |||
| 60 | i2c_delay(); | ||
| 61 | |||
| 62 | if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) | ||
| 63 | return 1; // slave did not acknowledge | ||
| 64 | else | ||
| 65 | return 0; // success | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | // Finish the i2c transaction. | ||
| 70 | void i2c_master_stop(void) { | ||
| 71 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 72 | |||
| 73 | uint16_t lim = 0; | ||
| 74 | while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) | ||
| 75 | lim++; | ||
| 76 | } | ||
| 77 | |||
| 78 | // Write one byte to the i2c slave. | ||
| 79 | // returns 0 => slave ACK | ||
| 80 | // 1 => slave NACK | ||
| 81 | uint8_t i2c_master_write(uint8_t data) { | ||
| 82 | TWDR = data; | ||
| 83 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 84 | |||
| 85 | i2c_delay(); | ||
| 86 | |||
| 87 | // check if the slave acknowledged us | ||
| 88 | return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; | ||
| 89 | } | ||
| 90 | |||
| 91 | // Read one byte from the i2c slave. If ack=1 the slave is acknowledged, | ||
| 92 | // if ack=0 the acknowledge bit is not set. | ||
| 93 | // returns: byte read from i2c device | ||
| 94 | uint8_t i2c_master_read(int ack) { | ||
| 95 | TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); | ||
| 96 | |||
| 97 | i2c_delay(); | ||
| 98 | return TWDR; | ||
| 99 | } | ||
| 100 | |||
| 101 | void i2c_reset_state(void) { | ||
| 102 | TWCR = 0; | ||
| 103 | } | ||
| 104 | |||
| 105 | void i2c_slave_init(uint8_t address) { | ||
| 106 | TWAR = address << 0; // slave i2c address | ||
| 107 | // TWEN - twi enable | ||
| 108 | // TWEA - enable address acknowledgement | ||
| 109 | // TWINT - twi interrupt flag | ||
| 110 | // TWIE - enable the twi interrupt | ||
| 111 | TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); | ||
| 112 | } | ||
| 113 | |||
| 114 | ISR(TWI_vect); | ||
| 115 | |||
| 116 | ISR(TWI_vect) { | ||
| 117 | uint8_t ack = 1; | ||
| 118 | switch(TW_STATUS) { | ||
| 119 | case TW_SR_SLA_ACK: | ||
| 120 | // this device has been addressed as a slave receiver | ||
| 121 | slave_has_register_set = false; | ||
| 122 | break; | ||
| 123 | |||
| 124 | case TW_SR_DATA_ACK: | ||
| 125 | // this device has received data as a slave receiver | ||
| 126 | // The first byte that we receive in this transaction sets the location | ||
| 127 | // of the read/write location of the slaves memory that it exposes over | ||
| 128 | // i2c. After that, bytes will be written at slave_buffer_pos, incrementing | ||
| 129 | // slave_buffer_pos after each write. | ||
| 130 | if(!slave_has_register_set) { | ||
| 131 | slave_buffer_pos = TWDR; | ||
| 132 | // don't acknowledge the master if this memory loctaion is out of bounds | ||
| 133 | if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { | ||
| 134 | ack = 0; | ||
| 135 | slave_buffer_pos = 0; | ||
| 136 | } | ||
| 137 | slave_has_register_set = true; | ||
| 138 | } else { | ||
| 139 | i2c_slave_buffer[slave_buffer_pos] = TWDR; | ||
| 140 | BUFFER_POS_INC(); | ||
| 141 | } | ||
| 142 | break; | ||
| 143 | |||
| 144 | case TW_ST_SLA_ACK: | ||
| 145 | case TW_ST_DATA_ACK: | ||
| 146 | // master has addressed this device as a slave transmitter and is | ||
| 147 | // requesting data. | ||
| 148 | TWDR = i2c_slave_buffer[slave_buffer_pos]; | ||
| 149 | BUFFER_POS_INC(); | ||
| 150 | break; | ||
| 151 | |||
| 152 | case TW_BUS_ERROR: // something went wrong, reset twi state | ||
| 153 | TWCR = 0; | ||
| 154 | default: | ||
| 155 | break; | ||
| 156 | } | ||
| 157 | // Reset everything, so we are ready for the next TWI interrupt | ||
| 158 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | ||
| 159 | } | ||
diff --git a/keyboards/lets_splitv2/i2c.h b/keyboards/lets_splitv2/i2c.h new file mode 100644 index 000000000..08ce4b009 --- /dev/null +++ b/keyboards/lets_splitv2/i2c.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #ifndef I2C_H | ||
| 2 | #define I2C_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | #ifndef F_CPU | ||
| 7 | #define F_CPU 16000000UL | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #define I2C_READ 1 | ||
| 11 | #define I2C_WRITE 0 | ||
| 12 | |||
| 13 | #define I2C_ACK 1 | ||
| 14 | #define I2C_NACK 0 | ||
| 15 | |||
| 16 | #define SLAVE_BUFFER_SIZE 0x10 | ||
| 17 | |||
| 18 | // i2c SCL clock frequency | ||
| 19 | #define SCL_CLOCK 100000L | ||
| 20 | |||
| 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | void i2c_master_init(void); | ||
| 24 | uint8_t i2c_master_start(uint8_t address); | ||
| 25 | void i2c_master_stop(void); | ||
| 26 | uint8_t i2c_master_write(uint8_t data); | ||
| 27 | uint8_t i2c_master_read(int); | ||
| 28 | void i2c_reset_state(void); | ||
| 29 | void i2c_slave_init(uint8_t address); | ||
| 30 | |||
| 31 | #endif | ||
diff --git a/keyboards/lets_splitv2/imgs/split-keyboard-i2c-schematic.png b/keyboards/lets_splitv2/imgs/split-keyboard-i2c-schematic.png new file mode 100644 index 000000000..888294718 --- /dev/null +++ b/keyboards/lets_splitv2/imgs/split-keyboard-i2c-schematic.png | |||
| Binary files differ | |||
diff --git a/keyboards/lets_splitv2/imgs/split-keyboard-serial-schematic.png b/keyboards/lets_splitv2/imgs/split-keyboard-serial-schematic.png new file mode 100644 index 000000000..7621d38ed --- /dev/null +++ b/keyboards/lets_splitv2/imgs/split-keyboard-serial-schematic.png | |||
| Binary files differ | |||
diff --git a/keyboards/lets_splitv2/keymaps/default/keymap.c b/keyboards/lets_splitv2/keymaps/default/keymap.c new file mode 100644 index 000000000..8c8466ebd --- /dev/null +++ b/keyboards/lets_splitv2/keymaps/default/keymap.c | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | #include "lets_split.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 _COLEMAK 1 | ||
| 13 | #define _DVORAK 2 | ||
| 14 | #define _LOWER 3 | ||
| 15 | #define _RAISE 4 | ||
| 16 | #define _ADJUST 16 | ||
| 17 | |||
| 18 | enum custom_keycodes { | ||
| 19 | QWERTY = SAFE_RANGE, | ||
| 20 | COLEMAK, | ||
| 21 | DVORAK, | ||
| 22 | LOWER, | ||
| 23 | RAISE, | ||
| 24 | ADJUST, | ||
| 25 | }; | ||
| 26 | |||
| 27 | // Fillers to make layering more clear | ||
| 28 | #define _______ KC_TRNS | ||
| 29 | #define XXXXXXX KC_NO | ||
| 30 | |||
| 31 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 32 | |||
| 33 | /* Qwerty | ||
| 34 | * ,-----------------------------------------------------------------------------------. | ||
| 35 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
| 36 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 37 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
| 38 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 39 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
| 40 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 41 | * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | | ||
| 42 | * `-----------------------------------------------------------------------------------' | ||
| 43 | */ | ||
| 44 | [_QWERTY] = KEYMAP( \ | ||
| 45 | KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | ||
| 46 | KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | ||
| 47 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ | ||
| 48 | KC_LCTL, _LOWER, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, KC_LSFT, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 49 | ), | ||
| 50 | |||
| 51 | [_LOWER] = KEYMAP( \ | ||
| 52 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ | ||
| 53 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ | ||
| 54 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ | ||
| 55 | _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 56 | ), | ||
| 57 | |||
| 58 | /* Raise | ||
| 59 | * ,-----------------------------------------------------------------------------------. | ||
| 60 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
| 61 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 62 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
| 63 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 64 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | | ||
| 65 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 66 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 67 | * `-----------------------------------------------------------------------------------' | ||
| 68 | */ | ||
| 69 | [_RAISE] = KEYMAP( \ | ||
| 70 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | ||
| 71 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
| 72 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | ||
| 73 | _______, _______, _______, _______, _______, KC_ENT, KC_ENT, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 74 | ), | ||
| 75 | |||
| 76 | /* Adjust (Lower + Raise) | ||
| 77 | * ,-----------------------------------------------------------------------------------. | ||
| 78 | * | | Reset| | | | | | | | | | Del | | ||
| 79 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
| 80 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | | ||
| 81 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
| 82 | * | | | | | | | | | | | | | | ||
| 83 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 84 | * | | | | | | | | | | | | | ||
| 85 | * `-----------------------------------------------------------------------------------' | ||
| 86 | */ | ||
| 87 | }; | ||
| 88 | |||
| 89 | #ifdef AUDIO_ENABLE | ||
| 90 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 91 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 92 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 93 | #endif | ||
| 94 | |||
| 95 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 96 | eeconfig_update_default_layer(default_layer); | ||
| 97 | default_layer_set(default_layer); | ||
| 98 | } | ||
| 99 | |||
| 100 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 101 | switch (keycode) { | ||
| 102 | case QWERTY: | ||
| 103 | if (record->event.pressed) { | ||
| 104 | #ifdef AUDIO_ENABLE | ||
| 105 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 106 | #endif | ||
| 107 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 108 | } | ||
| 109 | return false; | ||
| 110 | break; | ||
| 111 | case COLEMAK: | ||
| 112 | if (record->event.pressed) { | ||
| 113 | #ifdef AUDIO_ENABLE | ||
| 114 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
| 115 | #endif | ||
| 116 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
| 117 | } | ||
| 118 | return false; | ||
| 119 | break; | ||
| 120 | case DVORAK: | ||
| 121 | if (record->event.pressed) { | ||
| 122 | #ifdef AUDIO_ENABLE | ||
| 123 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
| 124 | #endif | ||
| 125 | persistant_default_layer_set(1UL<<_DVORAK); | ||
| 126 | } | ||
| 127 | return false; | ||
| 128 | break; | ||
| 129 | case LOWER: | ||
| 130 | if (record->event.pressed) { | ||
| 131 | layer_on(_LOWER); | ||
| 132 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 133 | } else { | ||
| 134 | layer_off(_LOWER); | ||
| 135 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 136 | } | ||
| 137 | return false; | ||
| 138 | break; | ||
| 139 | case RAISE: | ||
| 140 | if (record->event.pressed) { | ||
| 141 | layer_on(_RAISE); | ||
| 142 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 143 | } else { | ||
| 144 | layer_off(_RAISE); | ||
| 145 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 146 | } | ||
| 147 | return false; | ||
| 148 | break; | ||
| 149 | case ADJUST: | ||
| 150 | if (record->event.pressed) { | ||
| 151 | layer_on(_ADJUST); | ||
| 152 | } else { | ||
| 153 | layer_off(_ADJUST); | ||
| 154 | } | ||
| 155 | return false; | ||
| 156 | break; | ||
| 157 | } | ||
| 158 | return true; | ||
| 159 | } \ No newline at end of file | ||
diff --git a/keyboards/lets_splitv2/lets_split.c b/keyboards/lets_splitv2/lets_split.c new file mode 100644 index 000000000..574c116a7 --- /dev/null +++ b/keyboards/lets_splitv2/lets_split.c | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #include "lets_split.h" | ||
| 2 | |||
| 3 | #ifdef AUDIO_ENABLE | ||
| 4 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 5 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 6 | #endif | ||
| 7 | |||
| 8 | void matrix_init_kb(void) { | ||
| 9 | |||
| 10 | #ifdef AUDIO_ENABLE | ||
| 11 | _delay_ms(20); // gets rid of tick | ||
| 12 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
| 13 | #endif | ||
| 14 | |||
| 15 | // // green led on | ||
| 16 | // DDRD |= (1<<5); | ||
| 17 | // PORTD &= ~(1<<5); | ||
| 18 | |||
| 19 | // // orange led on | ||
| 20 | // DDRB |= (1<<0); | ||
| 21 | // PORTB &= ~(1<<0); | ||
| 22 | |||
| 23 | matrix_init_user(); | ||
| 24 | }; | ||
| 25 | |||
| 26 | void shutdown_user(void) { | ||
| 27 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
| 28 | _delay_ms(150); | ||
| 29 | stop_all_notes(); | ||
| 30 | } | ||
diff --git a/keyboards/lets_splitv2/lets_split.h b/keyboards/lets_splitv2/lets_split.h new file mode 100644 index 000000000..04844ed63 --- /dev/null +++ b/keyboards/lets_splitv2/lets_split.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef LETS_SPLIT_H | ||
| 2 | #define LETS_SPLIT_H | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | |||
| 6 | void promicro_bootloader_jmp(bool program); | ||
| 7 | |||
| 8 | #define KEYMAP( \ | ||
| 9 | k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ | ||
| 10 | k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ | ||
| 11 | k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ | ||
| 12 | k30, k31, k32, k33, k34, k35, k75, k74, k73, k72, k71, k70 \ | ||
| 13 | ) \ | ||
| 14 | { \ | ||
| 15 | { k00, k01, k02, k03, k04, k05 }, \ | ||
| 16 | { k10, k11, k12, k13, k14, k15 }, \ | ||
| 17 | { k20, k21, k22, k23, k24, k25 }, \ | ||
| 18 | { k30, k31, k32, k33, k34, k35 }, \ | ||
| 19 | { k40, k41, k42, k43, k44, k45 }, \ | ||
| 20 | { k50, k51, k52, k53, k54, k55 }, \ | ||
| 21 | { k60, k61, k62, k63, k64, k65 }, \ | ||
| 22 | { k70, k71, k72, k73, k74, k75 } \ | ||
| 23 | } | ||
| 24 | |||
| 25 | #endif \ No newline at end of file | ||
diff --git a/keyboards/lets_splitv2/matrix.c b/keyboards/lets_splitv2/matrix.c new file mode 100644 index 000000000..1d768c59b --- /dev/null +++ b/keyboards/lets_splitv2/matrix.c | |||
| @@ -0,0 +1,311 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.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 | /* | ||
| 19 | * scan matrix | ||
| 20 | */ | ||
| 21 | #include <stdint.h> | ||
| 22 | #include <stdbool.h> | ||
| 23 | #include <avr/io.h> | ||
| 24 | #include <avr/wdt.h> | ||
| 25 | #include <avr/interrupt.h> | ||
| 26 | #include <util/delay.h> | ||
| 27 | #include "print.h" | ||
| 28 | #include "debug.h" | ||
| 29 | #include "util.h" | ||
| 30 | #include "matrix.h" | ||
| 31 | #include "i2c.h" | ||
| 32 | #include "serial.h" | ||
| 33 | #include "split_util.h" | ||
| 34 | #include "pro_micro.h" | ||
| 35 | #include "config.h" | ||
| 36 | |||
| 37 | #ifndef DEBOUNCE | ||
| 38 | # define DEBOUNCE 5 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #define ERROR_DISCONNECT_COUNT 5 | ||
| 42 | |||
| 43 | static uint8_t debouncing = DEBOUNCE; | ||
| 44 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; | ||
| 45 | static uint8_t error_count = 0; | ||
| 46 | |||
| 47 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
| 48 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 49 | |||
| 50 | /* matrix state(1:on, 0:off) */ | ||
| 51 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 52 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 53 | |||
| 54 | static matrix_row_t read_cols(void); | ||
| 55 | static void init_cols(void); | ||
| 56 | static void unselect_rows(void); | ||
| 57 | static void select_row(uint8_t row); | ||
| 58 | |||
| 59 | __attribute__ ((weak)) | ||
| 60 | void matrix_init_quantum(void) { | ||
| 61 | matrix_init_kb(); | ||
| 62 | } | ||
| 63 | |||
| 64 | __attribute__ ((weak)) | ||
| 65 | void matrix_scan_quantum(void) { | ||
| 66 | matrix_scan_kb(); | ||
| 67 | } | ||
| 68 | |||
| 69 | __attribute__ ((weak)) | ||
| 70 | void matrix_init_kb(void) { | ||
| 71 | matrix_init_user(); | ||
| 72 | } | ||
| 73 | |||
| 74 | __attribute__ ((weak)) | ||
| 75 | void matrix_scan_kb(void) { | ||
| 76 | matrix_scan_user(); | ||
| 77 | } | ||
| 78 | |||
| 79 | __attribute__ ((weak)) | ||
| 80 | void matrix_init_user(void) { | ||
| 81 | } | ||
| 82 | |||
| 83 | __attribute__ ((weak)) | ||
| 84 | void matrix_scan_user(void) { | ||
| 85 | } | ||
| 86 | |||
| 87 | inline | ||
| 88 | uint8_t matrix_rows(void) | ||
| 89 | { | ||
| 90 | return MATRIX_ROWS; | ||
| 91 | } | ||
| 92 | |||
| 93 | inline | ||
| 94 | uint8_t matrix_cols(void) | ||
| 95 | { | ||
| 96 | return MATRIX_COLS; | ||
| 97 | } | ||
| 98 | |||
| 99 | void matrix_init(void) | ||
| 100 | { | ||
| 101 | debug_enable = true; | ||
| 102 | debug_matrix = true; | ||
| 103 | debug_mouse = true; | ||
| 104 | // initialize row and col | ||
| 105 | unselect_rows(); | ||
| 106 | init_cols(); | ||
| 107 | |||
| 108 | TX_RX_LED_INIT; | ||
| 109 | |||
| 110 | // initialize matrix state: all keys off | ||
| 111 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 112 | matrix[i] = 0; | ||
| 113 | matrix_debouncing[i] = 0; | ||
| 114 | } | ||
| 115 | |||
| 116 | matrix_init_quantum(); | ||
| 117 | } | ||
| 118 | |||
| 119 | uint8_t _matrix_scan(void) | ||
| 120 | { | ||
| 121 | // Right hand is stored after the left in the matirx so, we need to offset it | ||
| 122 | int offset = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 123 | |||
| 124 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 125 | select_row(i); | ||
| 126 | _delay_us(30); // without this wait read unstable value. | ||
| 127 | matrix_row_t cols = read_cols(); | ||
| 128 | if (matrix_debouncing[i+offset] != cols) { | ||
| 129 | matrix_debouncing[i+offset] = cols; | ||
| 130 | debouncing = DEBOUNCE; | ||
| 131 | } | ||
| 132 | unselect_rows(); | ||
| 133 | } | ||
| 134 | |||
| 135 | if (debouncing) { | ||
| 136 | if (--debouncing) { | ||
| 137 | _delay_ms(1); | ||
| 138 | } else { | ||
| 139 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 140 | matrix[i+offset] = matrix_debouncing[i+offset]; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | return 1; | ||
| 146 | } | ||
| 147 | |||
| 148 | // Get rows from other half over i2c | ||
| 149 | int i2c_transaction(void) { | ||
| 150 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 151 | |||
| 152 | int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); | ||
| 153 | if (err) goto i2c_error; | ||
| 154 | |||
| 155 | // start of matrix stored at 0x00 | ||
| 156 | err = i2c_master_write(0x00); | ||
| 157 | if (err) goto i2c_error; | ||
| 158 | |||
| 159 | // Start read | ||
| 160 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | ||
| 161 | if (err) goto i2c_error; | ||
| 162 | |||
| 163 | if (!err) { | ||
| 164 | int i; | ||
| 165 | for (i = 0; i < ROWS_PER_HAND-1; ++i) { | ||
| 166 | matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); | ||
| 167 | } | ||
| 168 | matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); | ||
| 169 | i2c_master_stop(); | ||
| 170 | } else { | ||
| 171 | i2c_error: // the cable is disconnceted, or something else went wrong | ||
| 172 | i2c_reset_state(); | ||
| 173 | return err; | ||
| 174 | } | ||
| 175 | |||
| 176 | return 0; | ||
| 177 | } | ||
| 178 | |||
| 179 | #ifndef USE_I2C | ||
| 180 | int serial_transaction(void) { | ||
| 181 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 182 | |||
| 183 | if (serial_update_buffers()) { | ||
| 184 | return 1; | ||
| 185 | } | ||
| 186 | |||
| 187 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 188 | matrix[slaveOffset+i] = serial_slave_buffer[i]; | ||
| 189 | } | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | #endif | ||
| 193 | |||
| 194 | uint8_t matrix_scan(void) | ||
| 195 | { | ||
| 196 | int ret = _matrix_scan(); | ||
| 197 | |||
| 198 | |||
| 199 | |||
| 200 | #ifdef USE_I2C | ||
| 201 | if( i2c_transaction() ) { | ||
| 202 | #else | ||
| 203 | if( serial_transaction() ) { | ||
| 204 | #endif | ||
| 205 | // turn on the indicator led when halves are disconnected | ||
| 206 | TXLED1; | ||
| 207 | |||
| 208 | error_count++; | ||
| 209 | |||
| 210 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 211 | // reset other half if disconnected | ||
| 212 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 213 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 214 | matrix[slaveOffset+i] = 0; | ||
| 215 | } | ||
| 216 | } | ||
| 217 | } else { | ||
| 218 | // turn off the indicator led on no error | ||
| 219 | TXLED0; | ||
| 220 | error_count = 0; | ||
| 221 | } | ||
| 222 | |||
| 223 | matrix_scan_quantum(); | ||
| 224 | |||
| 225 | return ret; | ||
| 226 | } | ||
| 227 | |||
| 228 | void matrix_slave_scan(void) { | ||
| 229 | _matrix_scan(); | ||
| 230 | |||
| 231 | int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2); | ||
| 232 | |||
| 233 | #ifdef USE_I2C | ||
| 234 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 235 | /* i2c_slave_buffer[i] = matrix[offset+i]; */ | ||
| 236 | i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 237 | } | ||
| 238 | #else | ||
| 239 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 240 | serial_slave_buffer[i] = matrix[offset+i]; | ||
| 241 | } | ||
| 242 | #endif | ||
| 243 | } | ||
| 244 | |||
| 245 | bool matrix_is_modified(void) | ||
| 246 | { | ||
| 247 | if (debouncing) return false; | ||
| 248 | return true; | ||
| 249 | } | ||
| 250 | |||
| 251 | inline | ||
| 252 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 253 | { | ||
| 254 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
| 255 | } | ||
| 256 | |||
| 257 | inline | ||
| 258 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 259 | { | ||
| 260 | return matrix[row]; | ||
| 261 | } | ||
| 262 | |||
| 263 | void matrix_print(void) | ||
| 264 | { | ||
| 265 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 266 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 267 | phex(row); print(": "); | ||
| 268 | pbin_reverse16(matrix_get_row(row)); | ||
| 269 | print("\n"); | ||
| 270 | } | ||
| 271 | } | ||
| 272 | |||
| 273 | uint8_t matrix_key_count(void) | ||
| 274 | { | ||
| 275 | uint8_t count = 0; | ||
| 276 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 277 | count += bitpop16(matrix[i]); | ||
| 278 | } | ||
| 279 | return count; | ||
| 280 | } | ||
| 281 | |||
| 282 | static void init_cols(void) | ||
| 283 | { | ||
| 284 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 285 | _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); | ||
| 286 | _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); | ||
| 287 | } | ||
| 288 | } | ||
| 289 | |||
| 290 | static matrix_row_t read_cols(void) | ||
| 291 | { | ||
| 292 | matrix_row_t result = 0; | ||
| 293 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 294 | result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); | ||
| 295 | } | ||
| 296 | return result; | ||
| 297 | } | ||
| 298 | |||
| 299 | static void unselect_rows(void) | ||
| 300 | { | ||
| 301 | for(int x = 0; x < ROWS_PER_HAND; x++) { | ||
| 302 | _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); | ||
| 303 | _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 307 | static void select_row(uint8_t row) | ||
| 308 | { | ||
| 309 | _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); | ||
| 310 | _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); | ||
| 311 | } | ||
diff --git a/keyboards/lets_splitv2/pro_micro.h b/keyboards/lets_splitv2/pro_micro.h new file mode 100644 index 000000000..09e219b7b --- /dev/null +++ b/keyboards/lets_splitv2/pro_micro.h | |||
| @@ -0,0 +1,362 @@ | |||
| 1 | /* | ||
| 2 | pins_arduino.h - Pin definition functions for Arduino | ||
| 3 | Part of Arduino - http://www.arduino.cc/ | ||
| 4 | |||
| 5 | Copyright (c) 2007 David A. Mellis | ||
| 6 | |||
| 7 | This library is free software; you can redistribute it and/or | ||
| 8 | modify it under the terms of the GNU Lesser General Public | ||
| 9 | License as published by the Free Software Foundation; either | ||
| 10 | version 2.1 of the License, or (at your option) any later version. | ||
| 11 | |||
| 12 | This library is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | Lesser General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU Lesser General | ||
| 18 | Public License along with this library; if not, write to the | ||
| 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
| 20 | Boston, MA 02111-1307 USA | ||
| 21 | |||
| 22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef Pins_Arduino_h | ||
| 26 | #define Pins_Arduino_h | ||
| 27 | |||
| 28 | #include <avr/pgmspace.h> | ||
| 29 | |||
| 30 | // Workaround for wrong definitions in "iom32u4.h". | ||
| 31 | // This should be fixed in the AVR toolchain. | ||
| 32 | #undef UHCON | ||
| 33 | #undef UHINT | ||
| 34 | #undef UHIEN | ||
| 35 | #undef UHADDR | ||
| 36 | #undef UHFNUM | ||
| 37 | #undef UHFNUML | ||
| 38 | #undef UHFNUMH | ||
| 39 | #undef UHFLEN | ||
| 40 | #undef UPINRQX | ||
| 41 | #undef UPINTX | ||
| 42 | #undef UPNUM | ||
| 43 | #undef UPRST | ||
| 44 | #undef UPCONX | ||
| 45 | #undef UPCFG0X | ||
| 46 | #undef UPCFG1X | ||
| 47 | #undef UPSTAX | ||
| 48 | #undef UPCFG2X | ||
| 49 | #undef UPIENX | ||
| 50 | #undef UPDATX | ||
| 51 | #undef TCCR2A | ||
| 52 | #undef WGM20 | ||
| 53 | #undef WGM21 | ||
| 54 | #undef COM2B0 | ||
| 55 | #undef COM2B1 | ||
| 56 | #undef COM2A0 | ||
| 57 | #undef COM2A1 | ||
| 58 | #undef TCCR2B | ||
| 59 | #undef CS20 | ||
| 60 | #undef CS21 | ||
| 61 | #undef CS22 | ||
| 62 | #undef WGM22 | ||
| 63 | #undef FOC2B | ||
| 64 | #undef FOC2A | ||
| 65 | #undef TCNT2 | ||
| 66 | #undef TCNT2_0 | ||
| 67 | #undef TCNT2_1 | ||
| 68 | #undef TCNT2_2 | ||
| 69 | #undef TCNT2_3 | ||
| 70 | #undef TCNT2_4 | ||
| 71 | #undef TCNT2_5 | ||
| 72 | #undef TCNT2_6 | ||
| 73 | #undef TCNT2_7 | ||
| 74 | #undef OCR2A | ||
| 75 | #undef OCR2_0 | ||
| 76 | #undef OCR2_1 | ||
| 77 | #undef OCR2_2 | ||
| 78 | #undef OCR2_3 | ||
| 79 | #undef OCR2_4 | ||
| 80 | #undef OCR2_5 | ||
| 81 | #undef OCR2_6 | ||
| 82 | #undef OCR2_7 | ||
| 83 | #undef OCR2B | ||
| 84 | #undef OCR2_0 | ||
| 85 | #undef OCR2_1 | ||
| 86 | #undef OCR2_2 | ||
| 87 | #undef OCR2_3 | ||
| 88 | #undef OCR2_4 | ||
| 89 | #undef OCR2_5 | ||
| 90 | #undef OCR2_6 | ||
| 91 | #undef OCR2_7 | ||
| 92 | |||
| 93 | #define NUM_DIGITAL_PINS 30 | ||
| 94 | #define NUM_ANALOG_INPUTS 12 | ||
| 95 | |||
| 96 | #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) | ||
| 97 | #define TXLED0 PORTD |= (1<<5) | ||
| 98 | #define TXLED1 PORTD &= ~(1<<5) | ||
| 99 | #define RXLED0 PORTB |= (1<<0) | ||
| 100 | #define RXLED1 PORTB &= ~(1<<0) | ||
| 101 | |||
| 102 | static const uint8_t SDA = 2; | ||
| 103 | static const uint8_t SCL = 3; | ||
| 104 | #define LED_BUILTIN 13 | ||
| 105 | |||
| 106 | // Map SPI port to 'new' pins D14..D17 | ||
| 107 | static const uint8_t SS = 17; | ||
| 108 | static const uint8_t MOSI = 16; | ||
| 109 | static const uint8_t MISO = 14; | ||
| 110 | static const uint8_t SCK = 15; | ||
| 111 | |||
| 112 | // Mapping of analog pins as digital I/O | ||
| 113 | // A6-A11 share with digital pins | ||
| 114 | static const uint8_t A0 = 18; | ||
| 115 | static const uint8_t A1 = 19; | ||
| 116 | static const uint8_t A2 = 20; | ||
| 117 | static const uint8_t A3 = 21; | ||
| 118 | static const uint8_t A4 = 22; | ||
| 119 | static const uint8_t A5 = 23; | ||
| 120 | static const uint8_t A6 = 24; // D4 | ||
| 121 | static const uint8_t A7 = 25; // D6 | ||
| 122 | static const uint8_t A8 = 26; // D8 | ||
| 123 | static const uint8_t A9 = 27; // D9 | ||
| 124 | static const uint8_t A10 = 28; // D10 | ||
| 125 | static const uint8_t A11 = 29; // D12 | ||
| 126 | |||
| 127 | #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) | ||
| 128 | #define digitalPinToPCICRbit(p) 0 | ||
| 129 | #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) | ||
| 130 | #define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) | ||
| 131 | |||
| 132 | // __AVR_ATmega32U4__ has an unusual mapping of pins to channels | ||
| 133 | extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; | ||
| 134 | #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) | ||
| 135 | |||
| 136 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) | ||
| 137 | |||
| 138 | #ifdef ARDUINO_MAIN | ||
| 139 | |||
| 140 | // On the Arduino board, digital pins are also used | ||
| 141 | // for the analog output (software PWM). Analog input | ||
| 142 | // pins are a separate set. | ||
| 143 | |||
| 144 | // ATMEL ATMEGA32U4 / ARDUINO LEONARDO | ||
| 145 | // | ||
| 146 | // D0 PD2 RXD1/INT2 | ||
| 147 | // D1 PD3 TXD1/INT3 | ||
| 148 | // D2 PD1 SDA SDA/INT1 | ||
| 149 | // D3# PD0 PWM8/SCL OC0B/SCL/INT0 | ||
| 150 | // D4 A6 PD4 ADC8 | ||
| 151 | // D5# PC6 ??? OC3A/#OC4A | ||
| 152 | // D6# A7 PD7 FastPWM #OC4D/ADC10 | ||
| 153 | // D7 PE6 INT6/AIN0 | ||
| 154 | // | ||
| 155 | // D8 A8 PB4 ADC11/PCINT4 | ||
| 156 | // D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 | ||
| 157 | // D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 | ||
| 158 | // D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 | ||
| 159 | // D12 A11 PD6 T1/#OC4D/ADC9 | ||
| 160 | // D13# PC7 PWM10 CLK0/OC4A | ||
| 161 | // | ||
| 162 | // A0 D18 PF7 ADC7 | ||
| 163 | // A1 D19 PF6 ADC6 | ||
| 164 | // A2 D20 PF5 ADC5 | ||
| 165 | // A3 D21 PF4 ADC4 | ||
| 166 | // A4 D22 PF1 ADC1 | ||
| 167 | // A5 D23 PF0 ADC0 | ||
| 168 | // | ||
| 169 | // New pins D14..D17 to map SPI port to digital pins | ||
| 170 | // | ||
| 171 | // MISO D14 PB3 MISO,PCINT3 | ||
| 172 | // SCK D15 PB1 SCK,PCINT1 | ||
| 173 | // MOSI D16 PB2 MOSI,PCINT2 | ||
| 174 | // SS D17 PB0 RXLED,SS/PCINT0 | ||
| 175 | // | ||
| 176 | // Connected LEDs on board for TX and RX | ||
| 177 | // TXLED D24 PD5 XCK1 | ||
| 178 | // RXLED D17 PB0 | ||
| 179 | // HWB PE2 HWB | ||
| 180 | |||
| 181 | // these arrays map port names (e.g. port B) to the | ||
| 182 | // appropriate addresses for various functions (e.g. reading | ||
| 183 | // and writing) | ||
| 184 | const uint16_t PROGMEM port_to_mode_PGM[] = { | ||
| 185 | NOT_A_PORT, | ||
| 186 | NOT_A_PORT, | ||
| 187 | (uint16_t) &DDRB, | ||
| 188 | (uint16_t) &DDRC, | ||
| 189 | (uint16_t) &DDRD, | ||
| 190 | (uint16_t) &DDRE, | ||
| 191 | (uint16_t) &DDRF, | ||
| 192 | }; | ||
| 193 | |||
| 194 | const uint16_t PROGMEM port_to_output_PGM[] = { | ||
| 195 | NOT_A_PORT, | ||
| 196 | NOT_A_PORT, | ||
| 197 | (uint16_t) &PORTB, | ||
| 198 | (uint16_t) &PORTC, | ||
| 199 | (uint16_t) &PORTD, | ||
| 200 | (uint16_t) &PORTE, | ||
| 201 | (uint16_t) &PORTF, | ||
| 202 | }; | ||
| 203 | |||
| 204 | const uint16_t PROGMEM port_to_input_PGM[] = { | ||
| 205 | NOT_A_PORT, | ||
| 206 | NOT_A_PORT, | ||
| 207 | (uint16_t) &PINB, | ||
| 208 | (uint16_t) &PINC, | ||
| 209 | (uint16_t) &PIND, | ||
| 210 | (uint16_t) &PINE, | ||
| 211 | (uint16_t) &PINF, | ||
| 212 | }; | ||
| 213 | |||
| 214 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||
| 215 | PD, // D0 - PD2 | ||
| 216 | PD, // D1 - PD3 | ||
| 217 | PD, // D2 - PD1 | ||
| 218 | PD, // D3 - PD0 | ||
| 219 | PD, // D4 - PD4 | ||
| 220 | PC, // D5 - PC6 | ||
| 221 | PD, // D6 - PD7 | ||
| 222 | PE, // D7 - PE6 | ||
| 223 | |||
| 224 | PB, // D8 - PB4 | ||
| 225 | PB, // D9 - PB5 | ||
| 226 | PB, // D10 - PB6 | ||
| 227 | PB, // D11 - PB7 | ||
| 228 | PD, // D12 - PD6 | ||
| 229 | PC, // D13 - PC7 | ||
| 230 | |||
| 231 | PB, // D14 - MISO - PB3 | ||
| 232 | PB, // D15 - SCK - PB1 | ||
| 233 | PB, // D16 - MOSI - PB2 | ||
| 234 | PB, // D17 - SS - PB0 | ||
| 235 | |||
| 236 | PF, // D18 - A0 - PF7 | ||
| 237 | PF, // D19 - A1 - PF6 | ||
| 238 | PF, // D20 - A2 - PF5 | ||
| 239 | PF, // D21 - A3 - PF4 | ||
| 240 | PF, // D22 - A4 - PF1 | ||
| 241 | PF, // D23 - A5 - PF0 | ||
| 242 | |||
| 243 | PD, // D24 - PD5 | ||
| 244 | PD, // D25 / D6 - A7 - PD7 | ||
| 245 | PB, // D26 / D8 - A8 - PB4 | ||
| 246 | PB, // D27 / D9 - A9 - PB5 | ||
| 247 | PB, // D28 / D10 - A10 - PB6 | ||
| 248 | PD, // D29 / D12 - A11 - PD6 | ||
| 249 | }; | ||
| 250 | |||
| 251 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||
| 252 | _BV(2), // D0 - PD2 | ||
| 253 | _BV(3), // D1 - PD3 | ||
| 254 | _BV(1), // D2 - PD1 | ||
| 255 | _BV(0), // D3 - PD0 | ||
| 256 | _BV(4), // D4 - PD4 | ||
| 257 | _BV(6), // D5 - PC6 | ||
| 258 | _BV(7), // D6 - PD7 | ||
| 259 | _BV(6), // D7 - PE6 | ||
| 260 | |||
| 261 | _BV(4), // D8 - PB4 | ||
| 262 | _BV(5), // D9 - PB5 | ||
| 263 | _BV(6), // D10 - PB6 | ||
| 264 | _BV(7), // D11 - PB7 | ||
| 265 | _BV(6), // D12 - PD6 | ||
| 266 | _BV(7), // D13 - PC7 | ||
| 267 | |||
| 268 | _BV(3), // D14 - MISO - PB3 | ||
| 269 | _BV(1), // D15 - SCK - PB1 | ||
| 270 | _BV(2), // D16 - MOSI - PB2 | ||
| 271 | _BV(0), // D17 - SS - PB0 | ||
| 272 | |||
| 273 | _BV(7), // D18 - A0 - PF7 | ||
| 274 | _BV(6), // D19 - A1 - PF6 | ||
| 275 | _BV(5), // D20 - A2 - PF5 | ||
| 276 | _BV(4), // D21 - A3 - PF4 | ||
| 277 | _BV(1), // D22 - A4 - PF1 | ||
| 278 | _BV(0), // D23 - A5 - PF0 | ||
| 279 | |||
| 280 | _BV(5), // D24 - PD5 | ||
| 281 | _BV(7), // D25 / D6 - A7 - PD7 | ||
| 282 | _BV(4), // D26 / D8 - A8 - PB4 | ||
| 283 | _BV(5), // D27 / D9 - A9 - PB5 | ||
| 284 | _BV(6), // D28 / D10 - A10 - PB6 | ||
| 285 | _BV(6), // D29 / D12 - A11 - PD6 | ||
| 286 | }; | ||
| 287 | |||
| 288 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||
| 289 | NOT_ON_TIMER, | ||
| 290 | NOT_ON_TIMER, | ||
| 291 | NOT_ON_TIMER, | ||
| 292 | TIMER0B, /* 3 */ | ||
| 293 | NOT_ON_TIMER, | ||
| 294 | TIMER3A, /* 5 */ | ||
| 295 | TIMER4D, /* 6 */ | ||
| 296 | NOT_ON_TIMER, | ||
| 297 | |||
| 298 | NOT_ON_TIMER, | ||
| 299 | TIMER1A, /* 9 */ | ||
| 300 | TIMER1B, /* 10 */ | ||
| 301 | TIMER0A, /* 11 */ | ||
| 302 | |||
| 303 | NOT_ON_TIMER, | ||
| 304 | TIMER4A, /* 13 */ | ||
| 305 | |||
| 306 | NOT_ON_TIMER, | ||
| 307 | NOT_ON_TIMER, | ||
| 308 | NOT_ON_TIMER, | ||
| 309 | NOT_ON_TIMER, | ||
| 310 | NOT_ON_TIMER, | ||
| 311 | NOT_ON_TIMER, | ||
| 312 | |||
| 313 | NOT_ON_TIMER, | ||
| 314 | NOT_ON_TIMER, | ||
| 315 | NOT_ON_TIMER, | ||
| 316 | NOT_ON_TIMER, | ||
| 317 | NOT_ON_TIMER, | ||
| 318 | NOT_ON_TIMER, | ||
| 319 | NOT_ON_TIMER, | ||
| 320 | NOT_ON_TIMER, | ||
| 321 | NOT_ON_TIMER, | ||
| 322 | NOT_ON_TIMER, | ||
| 323 | }; | ||
| 324 | |||
| 325 | const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { | ||
| 326 | 7, // A0 PF7 ADC7 | ||
| 327 | 6, // A1 PF6 ADC6 | ||
| 328 | 5, // A2 PF5 ADC5 | ||
| 329 | 4, // A3 PF4 ADC4 | ||
| 330 | 1, // A4 PF1 ADC1 | ||
| 331 | 0, // A5 PF0 ADC0 | ||
| 332 | 8, // A6 D4 PD4 ADC8 | ||
| 333 | 10, // A7 D6 PD7 ADC10 | ||
| 334 | 11, // A8 D8 PB4 ADC11 | ||
| 335 | 12, // A9 D9 PB5 ADC12 | ||
| 336 | 13, // A10 D10 PB6 ADC13 | ||
| 337 | 9 // A11 D12 PD6 ADC9 | ||
| 338 | }; | ||
| 339 | |||
| 340 | #endif /* ARDUINO_MAIN */ | ||
| 341 | |||
| 342 | // These serial port names are intended to allow libraries and architecture-neutral | ||
| 343 | // sketches to automatically default to the correct port name for a particular type | ||
| 344 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
| 345 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
| 346 | // | ||
| 347 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
| 348 | // | ||
| 349 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
| 350 | // | ||
| 351 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
| 352 | // | ||
| 353 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
| 354 | // | ||
| 355 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
| 356 | // pins are NOT connected to anything by default. | ||
| 357 | #define SERIAL_PORT_MONITOR Serial | ||
| 358 | #define SERIAL_PORT_USBVIRTUAL Serial | ||
| 359 | #define SERIAL_PORT_HARDWARE Serial1 | ||
| 360 | #define SERIAL_PORT_HARDWARE_OPEN Serial1 | ||
| 361 | |||
| 362 | #endif /* Pins_Arduino_h */ | ||
diff --git a/keyboards/lets_splitv2/readme.md b/keyboards/lets_splitv2/readme.md new file mode 100644 index 000000000..73fdb0f78 --- /dev/null +++ b/keyboards/lets_splitv2/readme.md | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | Let's Split | ||
| 2 | ====== | ||
| 3 | |||
| 4 | This readme and most of the code are from https://github.com/ahtn/tmk_keyboard/ | ||
| 5 | |||
| 6 | Split keyboard firmware for Arduino Pro Micro or other ATmega32u4 | ||
| 7 | based boards. | ||
| 8 | |||
| 9 | Features | ||
| 10 | -------- | ||
| 11 | |||
| 12 | Some features supported by the firmware: | ||
| 13 | |||
| 14 | * Either half can connect to the computer via USB, or both halves can be used | ||
| 15 | independently. | ||
| 16 | * You only need 3 wires to connect the two halves. Two for VCC and GND and one | ||
| 17 | for serial communication. | ||
| 18 | * Optional support for I2C connection between the two halves if for some | ||
| 19 | reason you require a faster connection between the two halves. Note this | ||
| 20 | requires an extra wire between halves and pull-up resistors on the data lines. | ||
| 21 | |||
| 22 | Required Hardware | ||
| 23 | ----------------- | ||
| 24 | |||
| 25 | Apart from diodes and key switches for the keyboard matrix in each half, you | ||
| 26 | will need: | ||
| 27 | |||
| 28 | * 2 Arduino Pro Micro's. You can find theses on aliexpress for ≈3.50USD each. | ||
| 29 | * 2 TRS sockets | ||
| 30 | * 1 TRS cable. | ||
| 31 | |||
| 32 | Alternatively, you can use any sort of cable and socket that has at least 3 | ||
| 33 | wires. If you want to use I2C to communicate between halves, you will need a | ||
| 34 | cable with at least 4 wires and 2x 4.7kΩ pull-up resistors | ||
| 35 | |||
| 36 | Optional Hardware | ||
| 37 | ----------------- | ||
| 38 | |||
| 39 | A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and turned on via `AUDIO_ENABLE`. | ||
| 40 | |||
| 41 | Wiring | ||
| 42 | ------ | ||
| 43 | |||
| 44 | The 3 wires of the TRS cable need to connect GND, VCC, and digital pin 3 (i.e. | ||
| 45 | PD0 on the ATmega32u4) between the two Pro Micros. | ||
| 46 | |||
| 47 | Then wire your key matrix to any of the remaining 17 IO pins of the pro micro | ||
| 48 | and modify the `matrix.c` accordingly. | ||
| 49 | |||
| 50 | The wiring for serial: | ||
| 51 | |||
| 52 |  | ||
| 53 | |||
| 54 | The wiring for i2c: | ||
| 55 | |||
| 56 |  | ||
| 57 | |||
| 58 | The pull-up resistors may be placed on either half. It is also possible | ||
| 59 | to use 4 resistors and have the pull-ups in both halves, but this is | ||
| 60 | unnecessary in simple use cases. | ||
| 61 | |||
| 62 | Notes on Software Configuration | ||
| 63 | ------------------------------- | ||
| 64 | |||
| 65 | Configuring the firmware is similar to any other TMK project. One thing | ||
| 66 | to note is that `MATIX_ROWS` in `config.h` is the total number of rows between | ||
| 67 | the two halves, i.e. if your split keyboard has 4 rows in each half, then | ||
| 68 | `MATRIX_ROWS=8`. | ||
| 69 | |||
| 70 | Also the current implementation assumes a maximum of 8 columns, but it would | ||
| 71 | not be very difficult to adapt it to support more if required. | ||
| 72 | |||
| 73 | |||
| 74 | Flashing | ||
| 75 | -------- | ||
| 76 | |||
| 77 | If you define `EE_HANDS` in your `config.h`, you will need to set the | ||
| 78 | EEPROM for the left and right halves. The EEPROM is used to store whether the | ||
| 79 | half is left handed or right handed. This makes it so that the same firmware | ||
| 80 | file will run on both hands instead of having to flash left and right handed | ||
| 81 | versions of the firmware to each half. To flash the EEPROM file for the left | ||
| 82 | half run: | ||
| 83 | ``` | ||
| 84 | make eeprom-left | ||
| 85 | ``` | ||
| 86 | and similarly for right half | ||
| 87 | ``` | ||
| 88 | make eeprom-right | ||
| 89 | ``` | ||
| 90 | |||
| 91 | After you have flashed the EEPROM for the first time, you then need to program | ||
| 92 | the flash memory: | ||
| 93 | ``` | ||
| 94 | make program | ||
| 95 | ``` | ||
| 96 | Note that you need to program both halves, but you have the option of using | ||
| 97 | different keymaps for each half. You could program the left half with a QWERTY | ||
| 98 | layout and the right half with a Colemak layout. Then if you connect the left | ||
| 99 | half to a computer by USB the keyboard will use QWERTY and Colemak when the | ||
| 100 | right half is connected. | ||
| 101 | |||
| 102 | |||
diff --git a/keyboards/lets_splitv2/serial.c b/keyboards/lets_splitv2/serial.c new file mode 100644 index 000000000..f439c2f20 --- /dev/null +++ b/keyboards/lets_splitv2/serial.c | |||
| @@ -0,0 +1,225 @@ | |||
| 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 | |||
| 14 | #include "serial.h" | ||
| 15 | |||
| 16 | // Serial pulse period in microseconds. Its probably a bad idea to lower this | ||
| 17 | // value. | ||
| 18 | #define SERIAL_DELAY 24 | ||
| 19 | |||
| 20 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | ||
| 21 | uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; | ||
| 22 | |||
| 23 | #define SLAVE_DATA_CORRUPT (1<<0) | ||
| 24 | volatile uint8_t status = 0; | ||
| 25 | |||
| 26 | inline static | ||
| 27 | void serial_delay(void) { | ||
| 28 | _delay_us(SERIAL_DELAY); | ||
| 29 | } | ||
| 30 | |||
| 31 | inline static | ||
| 32 | void serial_output(void) { | ||
| 33 | SERIAL_PIN_DDR |= SERIAL_PIN_MASK; | ||
| 34 | } | ||
| 35 | |||
| 36 | // make the serial pin an input with pull-up resistor | ||
| 37 | inline static | ||
| 38 | void serial_input(void) { | ||
| 39 | SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; | ||
| 40 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 41 | } | ||
| 42 | |||
| 43 | inline static | ||
| 44 | uint8_t serial_read_pin(void) { | ||
| 45 | return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); | ||
| 46 | } | ||
| 47 | |||
| 48 | inline static | ||
| 49 | void serial_low(void) { | ||
| 50 | SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; | ||
| 51 | } | ||
| 52 | |||
| 53 | inline static | ||
| 54 | void serial_high(void) { | ||
| 55 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 56 | } | ||
| 57 | |||
| 58 | void serial_master_init(void) { | ||
| 59 | serial_output(); | ||
| 60 | serial_high(); | ||
| 61 | } | ||
| 62 | |||
| 63 | void serial_slave_init(void) { | ||
| 64 | serial_input(); | ||
| 65 | |||
| 66 | // Enable INT0 | ||
| 67 | EIMSK |= _BV(INT0); | ||
| 68 | // Trigger on falling edge of INT0 | ||
| 69 | EICRA &= ~(_BV(ISC00) | _BV(ISC01)); | ||
| 70 | } | ||
| 71 | |||
| 72 | // Used by the master to synchronize timing with the slave. | ||
| 73 | static | ||
| 74 | void sync_recv(void) { | ||
| 75 | serial_input(); | ||
| 76 | // This shouldn't hang if the slave disconnects because the | ||
| 77 | // serial line will float to high if the slave does disconnect. | ||
| 78 | while (!serial_read_pin()); | ||
| 79 | serial_delay(); | ||
| 80 | } | ||
| 81 | |||
| 82 | // Used by the slave to send a synchronization signal to the master. | ||
| 83 | static | ||
| 84 | void sync_send(void) { | ||
| 85 | serial_output(); | ||
| 86 | |||
| 87 | serial_low(); | ||
| 88 | serial_delay(); | ||
| 89 | |||
| 90 | serial_high(); | ||
| 91 | } | ||
| 92 | |||
| 93 | // Reads a byte from the serial line | ||
| 94 | static | ||
| 95 | uint8_t serial_read_byte(void) { | ||
| 96 | uint8_t byte = 0; | ||
| 97 | serial_input(); | ||
| 98 | for ( uint8_t i = 0; i < 8; ++i) { | ||
| 99 | byte = (byte << 1) | serial_read_pin(); | ||
| 100 | serial_delay(); | ||
| 101 | _delay_us(1); | ||
| 102 | } | ||
| 103 | |||
| 104 | return byte; | ||
| 105 | } | ||
| 106 | |||
| 107 | // Sends a byte with MSB ordering | ||
| 108 | static | ||
| 109 | void serial_write_byte(uint8_t data) { | ||
| 110 | uint8_t b = 8; | ||
| 111 | serial_output(); | ||
| 112 | while( b-- ) { | ||
| 113 | if(data & (1 << b)) { | ||
| 114 | serial_high(); | ||
| 115 | } else { | ||
| 116 | serial_low(); | ||
| 117 | } | ||
| 118 | serial_delay(); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | // interrupt handle to be used by the slave device | ||
| 123 | ISR(SERIAL_PIN_INTERRUPT) { | ||
| 124 | sync_send(); | ||
| 125 | |||
| 126 | uint8_t checksum = 0; | ||
| 127 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
| 128 | serial_write_byte(serial_slave_buffer[i]); | ||
| 129 | sync_send(); | ||
| 130 | checksum += serial_slave_buffer[i]; | ||
| 131 | } | ||
| 132 | serial_write_byte(checksum); | ||
| 133 | sync_send(); | ||
| 134 | |||
| 135 | // wait for the sync to finish sending | ||
| 136 | serial_delay(); | ||
| 137 | |||
| 138 | // read the middle of pulses | ||
| 139 | _delay_us(SERIAL_DELAY/2); | ||
| 140 | |||
| 141 | uint8_t checksum_computed = 0; | ||
| 142 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
| 143 | serial_master_buffer[i] = serial_read_byte(); | ||
| 144 | sync_send(); | ||
| 145 | checksum_computed += serial_master_buffer[i]; | ||
| 146 | } | ||
| 147 | uint8_t checksum_received = serial_read_byte(); | ||
| 148 | sync_send(); | ||
| 149 | |||
| 150 | serial_input(); // end transaction | ||
| 151 | |||
| 152 | if ( checksum_computed != checksum_received ) { | ||
| 153 | status |= SLAVE_DATA_CORRUPT; | ||
| 154 | } else { | ||
| 155 | status &= ~SLAVE_DATA_CORRUPT; | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | inline | ||
| 160 | bool serial_slave_DATA_CORRUPT(void) { | ||
| 161 | return status & SLAVE_DATA_CORRUPT; | ||
| 162 | } | ||
| 163 | |||
| 164 | // Copies the serial_slave_buffer to the master and sends the | ||
| 165 | // serial_master_buffer to the slave. | ||
| 166 | // | ||
| 167 | // Returns: | ||
| 168 | // 0 => no error | ||
| 169 | // 1 => slave did not respond | ||
| 170 | int serial_update_buffers(void) { | ||
| 171 | // this code is very time dependent, so we need to disable interrupts | ||
| 172 | cli(); | ||
| 173 | |||
| 174 | // signal to the slave that we want to start a transaction | ||
| 175 | serial_output(); | ||
| 176 | serial_low(); | ||
| 177 | _delay_us(1); | ||
| 178 | |||
| 179 | // wait for the slaves response | ||
| 180 | serial_input(); | ||
| 181 | serial_high(); | ||
| 182 | _delay_us(SERIAL_DELAY); | ||
| 183 | |||
| 184 | // check if the slave is present | ||
| 185 | if (serial_read_pin()) { | ||
| 186 | // slave failed to pull the line low, assume not present | ||
| 187 | sei(); | ||
| 188 | return 1; | ||
| 189 | } | ||
| 190 | |||
| 191 | // if the slave is present syncronize with it | ||
| 192 | sync_recv(); | ||
| 193 | |||
| 194 | uint8_t checksum_computed = 0; | ||
| 195 | // receive data from the slave | ||
| 196 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
| 197 | serial_slave_buffer[i] = serial_read_byte(); | ||
| 198 | sync_recv(); | ||
| 199 | checksum_computed += serial_slave_buffer[i]; | ||
| 200 | } | ||
| 201 | uint8_t checksum_received = serial_read_byte(); | ||
| 202 | sync_recv(); | ||
| 203 | |||
| 204 | if (checksum_computed != checksum_received) { | ||
| 205 | sei(); | ||
| 206 | return 1; | ||
| 207 | } | ||
| 208 | |||
| 209 | uint8_t checksum = 0; | ||
| 210 | // send data to the slave | ||
| 211 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
| 212 | serial_write_byte(serial_master_buffer[i]); | ||
| 213 | sync_recv(); | ||
| 214 | checksum += serial_master_buffer[i]; | ||
| 215 | } | ||
| 216 | serial_write_byte(checksum); | ||
| 217 | sync_recv(); | ||
| 218 | |||
| 219 | // always, release the line when not in use | ||
| 220 | serial_output(); | ||
| 221 | serial_high(); | ||
| 222 | |||
| 223 | sei(); | ||
| 224 | return 0; | ||
| 225 | } | ||
diff --git a/keyboards/lets_splitv2/serial.h b/keyboards/lets_splitv2/serial.h new file mode 100644 index 000000000..15fe4db7b --- /dev/null +++ b/keyboards/lets_splitv2/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/lets_splitv2/split_util.c b/keyboards/lets_splitv2/split_util.c new file mode 100644 index 000000000..65003a71a --- /dev/null +++ b/keyboards/lets_splitv2/split_util.c | |||
| @@ -0,0 +1,76 @@ | |||
| 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 "i2c.h" | ||
| 10 | #include "serial.h" | ||
| 11 | #include "keyboard.h" | ||
| 12 | #include "config.h" | ||
| 13 | |||
| 14 | volatile bool isLeftHand = true; | ||
| 15 | |||
| 16 | static void setup_handedness(void) { | ||
| 17 | #ifdef EE_HANDS | ||
| 18 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | ||
| 19 | #else | ||
| 20 | #ifdef I2C_MASTER_RIGHT | ||
| 21 | isLeftHand = !has_usb(); | ||
| 22 | #else | ||
| 23 | isLeftHand = has_usb(); | ||
| 24 | #endif | ||
| 25 | #endif | ||
| 26 | } | ||
| 27 | |||
| 28 | static void keyboard_master_setup(void) { | ||
| 29 | #ifdef USE_I2C | ||
| 30 | i2c_master_init(); | ||
| 31 | #else | ||
| 32 | serial_master_init(); | ||
| 33 | #endif | ||
| 34 | } | ||
| 35 | |||
| 36 | static void keyboard_slave_setup(void) { | ||
| 37 | #ifdef USE_I2C | ||
| 38 | i2c_slave_init(SLAVE_I2C_ADDRESS); | ||
| 39 | #else | ||
| 40 | serial_slave_init(); | ||
| 41 | #endif | ||
| 42 | } | ||
| 43 | |||
| 44 | bool has_usb(void) { | ||
| 45 | USBCON |= (1 << OTGPADE); //enables VBUS pad | ||
| 46 | _delay_us(5); | ||
| 47 | return (USBSTA & (1<<VBUS)); //checks state of VBUS | ||
| 48 | } | ||
| 49 | |||
| 50 | void split_keyboard_setup(void) { | ||
| 51 | setup_handedness(); | ||
| 52 | |||
| 53 | if (has_usb()) { | ||
| 54 | keyboard_master_setup(); | ||
| 55 | } else { | ||
| 56 | keyboard_slave_setup(); | ||
| 57 | } | ||
| 58 | sei(); | ||
| 59 | } | ||
| 60 | |||
| 61 | void keyboard_slave_loop(void) { | ||
| 62 | matrix_init(); | ||
| 63 | |||
| 64 | while (1) { | ||
| 65 | matrix_slave_scan(); | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | // this code runs before the usb and keyboard is initialized | ||
| 70 | void matrix_setup(void) { | ||
| 71 | split_keyboard_setup(); | ||
| 72 | |||
| 73 | if (!has_usb()) { | ||
| 74 | keyboard_slave_loop(); | ||
| 75 | } | ||
| 76 | } | ||
diff --git a/keyboards/lets_splitv2/split_util.h b/keyboards/lets_splitv2/split_util.h new file mode 100644 index 000000000..6b896679c --- /dev/null +++ b/keyboards/lets_splitv2/split_util.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #ifndef SPLIT_KEYBOARD_UTIL_H | ||
| 2 | #define SPLIT_KEYBOARD_UTIL_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | |||
| 6 | #ifdef EE_HANDS | ||
| 7 | #define EECONFIG_BOOTMAGIC_END (uint8_t *)10 | ||
| 8 | #define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #define SLAVE_I2C_ADDRESS 0x32 | ||
| 12 | |||
| 13 | extern volatile bool isLeftHand; | ||
| 14 | |||
| 15 | // slave version of matix scan, defined in matrix.c | ||
| 16 | void matrix_slave_scan(void); | ||
| 17 | |||
| 18 | void split_keyboard_setup(void); | ||
| 19 | bool has_usb(void); | ||
| 20 | void keyboard_slave_loop(void); | ||
| 21 | |||
| 22 | #endif | ||
diff --git a/keyboards/maxipad/Makefile b/keyboards/maxipad/Makefile new file mode 100644 index 000000000..3f6d133c9 --- /dev/null +++ b/keyboards/maxipad/Makefile | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # MCU name | ||
| 4 | #MCU = at90usb1287 | ||
| 5 | MCU = atmega32u4 | ||
| 6 | |||
| 7 | # Processor frequency. | ||
| 8 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 9 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 10 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 11 | # automatically to create a 32-bit value in your source code. | ||
| 12 | # | ||
| 13 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 14 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 15 | # does not *change* the processor frequency - it should merely be updated to | ||
| 16 | # reflect the processor speed set externally so that the code can use accurate | ||
| 17 | # software delays. | ||
| 18 | F_CPU = 16000000 | ||
| 19 | |||
| 20 | |||
| 21 | # | ||
| 22 | # LUFA specific | ||
| 23 | # | ||
| 24 | # Target architecture (see library "Board Types" documentation). | ||
| 25 | ARCH = AVR8 | ||
| 26 | |||
| 27 | # Input clock frequency. | ||
| 28 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 29 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 30 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 31 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 32 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 33 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 34 | # source code. | ||
| 35 | # | ||
| 36 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 37 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 38 | F_USB = $(F_CPU) | ||
| 39 | |||
| 40 | # Interrupt driven control endpoint task(+60) | ||
| 41 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 42 | |||
| 43 | |||
| 44 | # Boot Section Size in *bytes* | ||
| 45 | # Teensy halfKay 512 | ||
| 46 | # Teensy++ halfKay 1024 | ||
| 47 | # Atmel DFU loader 4096 | ||
| 48 | # LUFA bootloader 4096 | ||
| 49 | # USBaspLoader 2048 | ||
| 50 | OPT_DEFS += -DBOOTLOADER_SIZE=512 | ||
| 51 | |||
| 52 | |||
| 53 | # Build Options | ||
| 54 | # change yes to no to disable | ||
| 55 | # | ||
| 56 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
| 57 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 58 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 59 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
| 60 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 61 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 62 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
| 63 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 64 | NKRO_ENABLE ?= no # USB Nkey Rollover | ||
| 65 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default | ||
| 66 | MIDI_ENABLE ?= no # MIDI controls | ||
| 67 | UNICODE_ENABLE ?= no # Unicode | ||
| 68 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 69 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 70 | |||
| 71 | ifndef QUANTUM_DIR | ||
| 72 | include ../../Makefile | ||
| 73 | endif | ||
| 74 | |||
| 75 | |||
diff --git a/keyboards/maxipad/config.h b/keyboards/maxipad/config.h new file mode 100644 index 000000000..59b8cebec --- /dev/null +++ b/keyboards/maxipad/config.h | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.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 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xFEED | ||
| 25 | #define PRODUCT_ID 0x6060 | ||
| 26 | #define DEVICE_VER 0x0001 | ||
| 27 | #define MANUFACTURER Wootpatoot | ||
| 28 | #define PRODUCT maxipad | ||
| 29 | #define DESCRIPTION g8ming keeb | ||
| 30 | |||
| 31 | /* key matrix size */ | ||
| 32 | #define MATRIX_ROWS 5 | ||
| 33 | #define MATRIX_COLS 6 | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Keyboard Matrix Assignments | ||
| 37 | * | ||
| 38 | * Change this to how you wired your keyboard | ||
| 39 | * COLS: AVR pins used for columns, left to right | ||
| 40 | * ROWS: AVR pins used for rows, top to bottom | ||
| 41 | * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) | ||
| 42 | * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) | ||
| 43 | * | ||
| 44 | */ | ||
| 45 | #define MATRIX_ROW_PINS { B6, F7, B2, B3, B1 } | ||
| 46 | #define MATRIX_COL_PINS { F6, C6, D7, F5, B4, B5 } | ||
| 47 | #define UNUSED_PINS | ||
| 48 | |||
| 49 | /* COL2ROW or ROW2COL */ | ||
| 50 | #define DIODE_DIRECTION COL2ROW | ||
| 51 | |||
| 52 | // #define BACKLIGHT_PIN B7 | ||
| 53 | // #define BACKLIGHT_BREATHING | ||
| 54 | // #define BACKLIGHT_LEVELS 3 | ||
| 55 | |||
| 56 | |||
| 57 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 58 | #define DEBOUNCING_DELAY 5 | ||
| 59 | |||
| 60 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
| 61 | //#define MATRIX_HAS_GHOST | ||
| 62 | |||
| 63 | /* number of backlight levels */ | ||
| 64 | |||
| 65 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 66 | #define LOCKING_SUPPORT_ENABLE | ||
| 67 | /* Locking resynchronize hack */ | ||
| 68 | #define LOCKING_RESYNC_ENABLE | ||
| 69 | |||
| 70 | /* | ||
| 71 | * Force NKRO | ||
| 72 | * | ||
| 73 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
| 74 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
| 75 | * makefile for this to work.) | ||
| 76 | * | ||
| 77 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
| 78 | * until the next keyboard reset. | ||
| 79 | * | ||
| 80 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
| 81 | * fully operational during normal computer usage. | ||
| 82 | * | ||
| 83 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
| 84 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
| 85 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
| 86 | * power-up. | ||
| 87 | * | ||
| 88 | */ | ||
| 89 | //#define FORCE_NKRO | ||
| 90 | |||
| 91 | /* | ||
| 92 | * Magic Key Options | ||
| 93 | * | ||
| 94 | * Magic keys are hotkey commands that allow control over firmware functions of | ||
| 95 | * the keyboard. They are best used in combination with the HID Listen program, | ||
| 96 | * found here: https://www.pjrc.com/teensy/hid_listen.html | ||
| 97 | * | ||
| 98 | * The options below allow the magic key functionality to be changed. This is | ||
| 99 | * useful if your keyboard/keypad is missing keys and you want magic key support. | ||
| 100 | * | ||
| 101 | */ | ||
| 102 | |||
| 103 | /* key combination for magic key command */ | ||
| 104 | #define IS_COMMAND() ( \ | ||
| 105 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 106 | ) | ||
| 107 | |||
| 108 | /* control how magic key switches layers */ | ||
| 109 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true | ||
| 110 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true | ||
| 111 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false | ||
| 112 | |||
| 113 | /* override magic key keymap */ | ||
| 114 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS | ||
| 115 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS | ||
| 116 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM | ||
| 117 | //#define MAGIC_KEY_HELP1 H | ||
| 118 | //#define MAGIC_KEY_HELP2 SLASH | ||
| 119 | //#define MAGIC_KEY_DEBUG D | ||
| 120 | //#define MAGIC_KEY_DEBUG_MATRIX X | ||
| 121 | //#define MAGIC_KEY_DEBUG_KBD K | ||
| 122 | //#define MAGIC_KEY_DEBUG_MOUSE M | ||
| 123 | //#define MAGIC_KEY_VERSION V | ||
| 124 | //#define MAGIC_KEY_STATUS S | ||
| 125 | //#define MAGIC_KEY_CONSOLE C | ||
| 126 | //#define MAGIC_KEY_LAYER0_ALT1 ESC | ||
| 127 | //#define MAGIC_KEY_LAYER0_ALT2 GRAVE | ||
| 128 | //#define MAGIC_KEY_LAYER0 0 | ||
| 129 | //#define MAGIC_KEY_LAYER1 1 | ||
| 130 | //#define MAGIC_KEY_LAYER2 2 | ||
| 131 | //#define MAGIC_KEY_LAYER3 3 | ||
| 132 | //#define MAGIC_KEY_LAYER4 4 | ||
| 133 | //#define MAGIC_KEY_LAYER5 5 | ||
| 134 | //#define MAGIC_KEY_LAYER6 6 | ||
| 135 | //#define MAGIC_KEY_LAYER7 7 | ||
| 136 | //#define MAGIC_KEY_LAYER8 8 | ||
| 137 | //#define MAGIC_KEY_LAYER9 9 | ||
| 138 | //#define MAGIC_KEY_BOOTLOADER PAUSE | ||
| 139 | //#define MAGIC_KEY_LOCK CAPS | ||
| 140 | //#define MAGIC_KEY_EEPROM E | ||
| 141 | //#define MAGIC_KEY_NKRO N | ||
| 142 | //#define MAGIC_KEY_SLEEP_LED Z | ||
| 143 | |||
| 144 | /* | ||
| 145 | * Feature disable options | ||
| 146 | * These options are also useful to firmware size reduction. | ||
| 147 | */ | ||
| 148 | |||
| 149 | /* disable debug print */ | ||
| 150 | //#define NO_DEBUG | ||
| 151 | |||
| 152 | /* disable print */ | ||
| 153 | //#define NO_PRINT | ||
| 154 | |||
| 155 | /* disable action features */ | ||
| 156 | //#define NO_ACTION_LAYER | ||
| 157 | //#define NO_ACTION_TAPPING | ||
| 158 | //#define NO_ACTION_ONESHOT | ||
| 159 | //#define NO_ACTION_MACRO | ||
| 160 | //#define NO_ACTION_FUNCTION | ||
| 161 | |||
| 162 | #endif | ||
diff --git a/keyboards/maxipad/keymaps/default/Makefile b/keyboards/maxipad/keymaps/default/Makefile new file mode 100644 index 000000000..f4671a9d1 --- /dev/null +++ b/keyboards/maxipad/keymaps/default/Makefile | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # Build Options | ||
| 2 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 3 | # the appropriate keymap folder that will get included automatically | ||
| 4 | # | ||
| 5 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 6 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 7 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 8 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 9 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 10 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 12 | MIDI_ENABLE = no # MIDI controls | ||
| 13 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 14 | UNICODE_ENABLE = no # Unicode | ||
| 15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 16 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 17 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 18 | |||
| 19 | ifndef QUANTUM_DIR | ||
| 20 | include ../../../../Makefile | ||
| 21 | endif \ No newline at end of file | ||
diff --git a/keyboards/maxipad/keymaps/default/config.h b/keyboards/maxipad/keymaps/default/config.h new file mode 100644 index 000000000..df06a2620 --- /dev/null +++ b/keyboards/maxipad/keymaps/default/config.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | // place overrides here | ||
| 7 | |||
| 8 | #endif \ No newline at end of file | ||
diff --git a/keyboards/maxipad/keymaps/default/keymap.c b/keyboards/maxipad/keymaps/default/keymap.c new file mode 100644 index 000000000..7ca127fe4 --- /dev/null +++ b/keyboards/maxipad/keymaps/default/keymap.c | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | #include "maxipad.h" | ||
| 2 | |||
| 3 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 4 | [0] = KEYMAP( /* Base */ | ||
| 5 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, \ | ||
| 6 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, \ | ||
| 7 | MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, \ | ||
| 8 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, \ | ||
| 9 | KC_LCTL, KC_LALT, MO(1), KC_ENT,KC_GRV,KC_SPC \ | ||
| 10 | ), | ||
| 11 | [1] = KEYMAP( | ||
| 12 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, \ | ||
| 13 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
| 14 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
| 15 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
| 16 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ | ||
| 17 | ), | ||
| 18 | }; | ||
| 19 | |||
| 20 | const uint16_t PROGMEM fn_actions[] = { | ||
| 21 | |||
| 22 | }; | ||
| 23 | |||
| 24 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 25 | { | ||
| 26 | // MACRODOWN only works in this function | ||
| 27 | switch(id) { | ||
| 28 | case 0: | ||
| 29 | if (record->event.pressed) { | ||
| 30 | register_code(KC_RSFT); | ||
| 31 | } else { | ||
| 32 | unregister_code(KC_RSFT); | ||
| 33 | } | ||
| 34 | break; | ||
| 35 | } | ||
| 36 | return MACRO_NONE; | ||
| 37 | }; | ||
| 38 | |||
| 39 | |||
| 40 | void matrix_init_user(void) { | ||
| 41 | |||
| 42 | } | ||
| 43 | |||
| 44 | void matrix_scan_user(void) { | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 49 | return true; | ||
| 50 | } | ||
| 51 | |||
| 52 | void led_set_user(uint8_t usb_led) { | ||
| 53 | |||
| 54 | } \ No newline at end of file | ||
diff --git a/keyboards/maxipad/keymaps/default/readme.md b/keyboards/maxipad/keymaps/default/readme.md new file mode 100644 index 000000000..a6c0d4a3f --- /dev/null +++ b/keyboards/maxipad/keymaps/default/readme.md | |||
| @@ -0,0 +1 @@ | |||
| # The default keymap for maxipad \ No newline at end of file | |||
diff --git a/keyboards/maxipad/maxipad.c b/keyboards/maxipad/maxipad.c new file mode 100644 index 000000000..879ae86a7 --- /dev/null +++ b/keyboards/maxipad/maxipad.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include "maxipad.h" | ||
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | // put your keyboard start-up code here | ||
| 5 | // runs once when the firmware starts up | ||
| 6 | |||
| 7 | matrix_init_user(); | ||
| 8 | } | ||
| 9 | |||
| 10 | void matrix_scan_kb(void) { | ||
| 11 | // put your looping keyboard code here | ||
| 12 | // runs every cycle (a lot) | ||
| 13 | |||
| 14 | matrix_scan_user(); | ||
| 15 | } | ||
| 16 | |||
| 17 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 18 | // put your per-action keyboard code here | ||
| 19 | // runs for every action, just before processing by the firmware | ||
| 20 | |||
| 21 | return process_record_user(keycode, record); | ||
| 22 | } | ||
| 23 | |||
| 24 | void led_set_kb(uint8_t usb_led) { | ||
| 25 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 26 | |||
| 27 | led_set_user(usb_led); | ||
| 28 | } | ||
diff --git a/keyboards/maxipad/maxipad.h b/keyboards/maxipad/maxipad.h new file mode 100644 index 000000000..eee1309dd --- /dev/null +++ b/keyboards/maxipad/maxipad.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef MAXIPAD_H | ||
| 2 | #define MAXIPAD_H | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | |||
| 6 | // This a shortcut to help you visually see your layout. | ||
| 7 | // The following is an example using the Planck MIT layout | ||
| 8 | // The first section contains all of the arguements | ||
| 9 | // The second converts the arguments into a two-dimensional array | ||
| 10 | #define KEYMAP( \ | ||
| 11 | k00, k01, k02, k03, k04, k05, \ | ||
| 12 | k10, k11, k12, k13, k14, k15, \ | ||
| 13 | k20, k21, k22, k23, k24, k25, \ | ||
| 14 | k30, k31, k32, k33, k34, k35, \ | ||
| 15 | k40, k41, k42, k43, k44, k45 \ | ||
| 16 | ) \ | ||
| 17 | { \ | ||
| 18 | { k00, k01, k02, k03, k04, k05 }, \ | ||
| 19 | { k10, k11, k12, k13, k14, k15 }, \ | ||
| 20 | { k20, k21, k22, k23, k24, k25 }, \ | ||
| 21 | { k30, k31, k32, k33, k34, k35 }, \ | ||
| 22 | { k40, k41, k42, k43, k44, k45} \ | ||
| 23 | } | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/keyboards/maxipad/readme.md b/keyboards/maxipad/readme.md new file mode 100644 index 000000000..964212b8a --- /dev/null +++ b/keyboards/maxipad/readme.md | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | maxipad keyboard firmware | ||
| 2 | ====================== | ||
| 3 | |||
| 4 | ## Quantum MK Firmware | ||
| 5 | |||
| 6 | For the full Quantum feature list, see [the parent readme.md](/doc/readme.md). | ||
| 7 | |||
| 8 | ## Building | ||
| 9 | |||
| 10 | Download or clone the whole firmware and navigate to the keyboards/maxipad folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. | ||
| 11 | |||
| 12 | Depending on which keymap you would like to use, you will have to compile slightly differently. | ||
| 13 | |||
| 14 | ### Default | ||
| 15 | |||
| 16 | To build with the default keymap, simply run `make`. | ||
| 17 | |||
| 18 | ### Other Keymaps | ||
| 19 | |||
| 20 | Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files. | ||
| 21 | |||
| 22 | To build the firmware binary hex file with a keymap just do `make` with `keymap` option like: | ||
| 23 | |||
| 24 | ``` | ||
| 25 | $ make keymap=[default|jack|<name>] | ||
| 26 | ``` | ||
| 27 | |||
| 28 | Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/` \ No newline at end of file | ||
