diff options
| author | Phil Pirozhkov <pirj@users.noreply.github.com> | 2021-09-22 00:07:55 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-21 14:07:55 -0700 |
| commit | 8d32ddd8e948136a992ab3c10d13c7dbf9e1e119 (patch) | |
| tree | 261c62e6cf113b3b3cc29810b32b205323725e9f | |
| parent | d84794b35213fe95a712468c21ae4a4cad2795e3 (diff) | |
| download | qmk_firmware-8d32ddd8e948136a992ab3c10d13c7dbf9e1e119.tar.gz qmk_firmware-8d32ddd8e948136a992ab3c10d13c7dbf9e1e119.zip | |
[Keyboard] gBoards GergoPlex (#13027)
* Moved gergoplex to seperate PR
* vendor + cformat
* Update keyboards/gboards/k/gergoplex/matrix.c
Co-Authored-By: Drashna Jaelre <drashna@live.com>
* lifiting keyboards up
* Update readme.md
* Update keyboards/gboards/gergoplex/config.h
Co-authored-by: Drashna Jaelre <drashna@live.com>
* remove English dicts
* cformatted
* Prettify keymap
* Remove via keymaps
Via doesn't support chords/combos, and this makes the keymap on such a
small keyboard quite uncomfortable and incomplete.
* Address QMK pull code review notes
* Cleanup (tabs, excessive comments)
* Fix keymap typos
* Use enum to define layers
* Multiple changes
- got rid of LAYOUT_kc in favour of LAYOUT_split_3x5_3
- fixed matrix custom C code to build with updated external dependencies (gcc)
- fixed used combo docs
keyboards/gboards/gergoplex/matrix.c:189:9: error: implicit declaration of function 'phex' [-Werror=implicit-function-declaration]
phex(row);
^~~~
keyboards/gboards/gergoplex/matrix.c:191:9: error: implicit declaration of function 'pbin_reverse16'; did you mean 'print_bin_reverse16'? [-Werror=implicit-function-declaration]
pbin_reverse16(matrix_get_row(row));
* Remove apparently redundant macros
* Replace direct pin control with IO functions
* config mouse enable and combo delay fix
The default delay is 200:
#define COMBO_TERM 200
how long for the Combo keys to be detected. Defaults to TAPPING_TERM if not defined.
tmk_core/common/action_tapping.h|22| 13:# define TAPPING_TERM 200
* Remove redundant defines
* Unambiguously refer to the Special layer
* Fix formatting
* gboards/gergoplex set IGNORE_MOD_TAP_INTERRUPT
This solves my issue was with KC_CTL_A working correctly and it was set in @germ's repo
https://github.com/germ/qmk_firmware/blob/39c86e080dc04b68ee08387dcb5144c88cb44855/keyboards/gboards/k/gergoplex/config.h#L49
https://beta.docs.qmk.fm/using-qmk/software-features/tap_hold#ignore-mod-tap-interrupt
* Name change
See commit 581368596ed
* Wording change
* Update keyboards/gboards/gergoplex/keymaps/default/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Add copyright headers
* Fix debounce type
| avr-gcc: error: .build/obj_gboards_gergoplex_default/quantum/debounce/eager_pr.o: No such file or directory
* Implement colemak-dhm keymap
Co-authored-by: Germ <jeremythegeek@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Brian Tannous <Brian@BrianTannous.com>
| -rw-r--r-- | keyboards/gboards/combos/colemakdhm-vim-helpers.def | 9 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/config.h | 52 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/gergoplex.c | 68 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/gergoplex.h | 56 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/colemak-dhm/combos.def | 10 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/colemak-dhm/gergoplex.def | 11 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c | 99 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk | 17 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/default/combos.def | 11 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/default/gergoplex.def | 10 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/default/keymap.c | 113 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/keymaps/default/rules.mk | 17 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/matrix.c | 241 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/readme.md | 43 | ||||
| -rw-r--r-- | keyboards/gboards/gergoplex/rules.mk | 18 |
15 files changed, 775 insertions, 0 deletions
diff --git a/keyboards/gboards/combos/colemakdhm-vim-helpers.def b/keyboards/gboards/combos/colemakdhm-vim-helpers.def new file mode 100644 index 000000000..f4950be05 --- /dev/null +++ b/keyboards/gboards/combos/colemakdhm-vim-helpers.def | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | // Vim-Mode combos | ||
| 2 | |||
| 3 | COMB(wfEsc, KC_ESC, KC_W, KC_F) | ||
| 4 | COMB(rsBspc, KC_BSPC, KC_R, KC_S) | ||
| 5 | COMB(stTab, KC_TAB, KC_S, KC_T) | ||
| 6 | COMB(cdEnt, KC_ENT, KC_C, KC_D) | ||
| 7 | COMB(luEsc, KC_ESC, KC_L, KC_U) | ||
| 8 | COMB(neCol, KC_COLN, KC_N, KC_E) | ||
| 9 | COMB(mkEnt, KC_ENT, KC_M, KC_K) | ||
diff --git a/keyboards/gboards/gergoplex/config.h b/keyboards/gboards/gergoplex/config.h new file mode 100644 index 000000000..a6d8d6b1b --- /dev/null +++ b/keyboards/gboards/gergoplex/config.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | // Copy and worked on with love from the EZ team | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | #include "config_common.h" | ||
| 23 | |||
| 24 | /* USB Device descriptor parameter */ | ||
| 25 | #define VENDOR_ID 0x6B0A | ||
| 26 | #define PRODUCT_ID 0x0002 | ||
| 27 | #define DEVICE_VER 0x0001 | ||
| 28 | #define MANUFACTURER g Heavy Industries | ||
| 29 | #define PRODUCT GergoPlex | ||
| 30 | |||
| 31 | /* key matrix size */ | ||
| 32 | #define MATRIX_ROWS 10 | ||
| 33 | #define MATRIX_ROWS_PER_SIDE (MATRIX_ROWS / 2) | ||
| 34 | #define MATRIX_COLS 4 | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Keyboard Matrix Assignments | ||
| 38 | * | ||
| 39 | * Change this to how you wired your keyboard | ||
| 40 | * COLS: AVR pins used for columns, left to right | ||
| 41 | * ROWS: AVR pins used for rows, top to bottom | ||
| 42 | */ | ||
| 43 | #define MATRIX_ROW_PINS { F6, F5, F4, F1 } | ||
| 44 | #define MATRIX_COL_PINS { B1, B2, B3, D2, D3 } | ||
| 45 | #define UNUSED_PINS | ||
| 46 | #define IGNORE_MOD_TAP_INTERRUPT | ||
| 47 | #define COMBO_ALLOW_ACTION_KEYS | ||
| 48 | #define COMBO_VARIABLE_LEN | ||
| 49 | |||
| 50 | #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) | ||
| 51 | |||
| 52 | #define DEBOUNCE 5 | ||
diff --git a/keyboards/gboards/gergoplex/gergoplex.c b/keyboards/gboards/gergoplex/gergoplex.c new file mode 100644 index 000000000..1e4458389 --- /dev/null +++ b/keyboards/gboards/gergoplex/gergoplex.c | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* Copyright 2021 Jane Bernhardt | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "gergoplex.h" | ||
| 18 | |||
| 19 | bool i2c_initialized = 0; | ||
| 20 | i2c_status_t mcp23018_status = 0x20; | ||
| 21 | |||
| 22 | void matrix_init_kb(void) { | ||
| 23 | matrix_init_user(); | ||
| 24 | } | ||
| 25 | |||
| 26 | uint8_t init_mcp23018(void) { | ||
| 27 | print("starting init"); | ||
| 28 | mcp23018_status = 0x20; | ||
| 29 | |||
| 30 | // I2C subsystem | ||
| 31 | |||
| 32 | if (i2c_initialized == 0) { | ||
| 33 | i2c_init(); // on pins D(1,0) | ||
| 34 | i2c_initialized = true; | ||
| 35 | _delay_ms(1000); | ||
| 36 | } | ||
| 37 | |||
| 38 | // set pin direction | ||
| 39 | // - unused : input : 1 | ||
| 40 | // - input : input : 1 | ||
| 41 | // - driving : output : 0 | ||
| 42 | mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); | ||
| 43 | if (mcp23018_status) goto out; | ||
| 44 | mcp23018_status = i2c_write(IODIRA, I2C_TIMEOUT); | ||
| 45 | if (mcp23018_status) goto out; | ||
| 46 | mcp23018_status = i2c_write(0b11000001, I2C_TIMEOUT); | ||
| 47 | if (mcp23018_status) goto out; | ||
| 48 | mcp23018_status = i2c_write(0b11111111, I2C_TIMEOUT); | ||
| 49 | if (mcp23018_status) goto out; | ||
| 50 | i2c_stop(); | ||
| 51 | |||
| 52 | // set pull-up | ||
| 53 | // - unused : on : 1 | ||
| 54 | // - input : on : 1 | ||
| 55 | // - driving : off : 0 | ||
| 56 | mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); | ||
| 57 | if (mcp23018_status) goto out; | ||
| 58 | mcp23018_status = i2c_write(GPPUA, I2C_TIMEOUT); | ||
| 59 | if (mcp23018_status) goto out; | ||
| 60 | mcp23018_status = i2c_write(0b11000001, I2C_TIMEOUT); | ||
| 61 | if (mcp23018_status) goto out; | ||
| 62 | mcp23018_status = i2c_write(0b11111111, I2C_TIMEOUT); | ||
| 63 | if (mcp23018_status) goto out; | ||
| 64 | |||
| 65 | out: | ||
| 66 | i2c_stop(); | ||
| 67 | return mcp23018_status; | ||
| 68 | } | ||
diff --git a/keyboards/gboards/gergoplex/gergoplex.h b/keyboards/gboards/gergoplex/gergoplex.h new file mode 100644 index 000000000..507072a37 --- /dev/null +++ b/keyboards/gboards/gergoplex/gergoplex.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* Copyright 2021 Jane Bernhardt | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include "quantum.h" | ||
| 20 | #include "i2c_master.h" | ||
| 21 | |||
| 22 | extern i2c_status_t mcp23018_status; | ||
| 23 | #define I2C_TIMEOUT 1000 | ||
| 24 | #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) | ||
| 25 | #define CPU_16MHz 0x00 | ||
| 26 | |||
| 27 | // I2C aliases and register addresses (see "mcp23018.md") | ||
| 28 | #define I2C_ADDR 0x20 // 0b0100000 | ||
| 29 | #define I2C_ADDR_WRITE ((I2C_ADDR << 1) | I2C_WRITE) | ||
| 30 | #define I2C_ADDR_READ ((I2C_ADDR << 1) | I2C_READ) | ||
| 31 | #define IODIRA 0x00 // i/o direction register | ||
| 32 | #define IODIRB 0x01 | ||
| 33 | #define GPPUA 0x0C // GPIO pull-up resistor register | ||
| 34 | #define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT) | ||
| 35 | #define OLATA 0x14 // output latch register | ||
| 36 | |||
| 37 | uint8_t init_mcp23018(void); | ||
| 38 | |||
| 39 | #define LAYOUT_split_3x5_3( \ | ||
| 40 | L00, L01, L02, L03, L04, R00, R01, R02, R03, R04, \ | ||
| 41 | L10, L11, L12, L13, L14, R10, R11, R12, R13, R14, \ | ||
| 42 | L20, L21, L22, L23, L24, R20, R21, R22, R23, R24, \ | ||
| 43 | L30, L31, L32, R30, R31, R32 \ | ||
| 44 | ) \ | ||
| 45 | { \ | ||
| 46 | {L04, L14, L24, KC_NO}, \ | ||
| 47 | {L03, L13, L23, L32}, \ | ||
| 48 | {L02, L12, L22, L31}, \ | ||
| 49 | {L01, L11, L21, L30}, \ | ||
| 50 | {L00, L10, L20, KC_NO}, \ | ||
| 51 | {R00, R10, R20, KC_NO}, \ | ||
| 52 | {R01, R11, R21, R30}, \ | ||
| 53 | {R02, R12, R22, R31}, \ | ||
| 54 | {R03, R13, R23, R32}, \ | ||
| 55 | {R04, R14, R24, KC_NO}, \ | ||
| 56 | } | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/combos.def b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/combos.def new file mode 100644 index 000000000..2aac5cb4f --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/combos.def | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | // List any combo dictionaries you want loaded to your device below! | ||
| 2 | |||
| 3 | // User includes | ||
| 4 | #include "gergoplex.def" | ||
| 5 | |||
| 6 | // QMK wide includes | ||
| 7 | #include "combos/colemakdhm-vim-helpers.def" | ||
| 8 | |||
| 9 | // Word completion | ||
| 10 | // #include "combos/eng-combos.def" | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/gergoplex.def b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/gergoplex.def new file mode 100644 index 000000000..7ed0122c4 --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/gergoplex.def | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | // Gergoplex colemak-dhm specfic combos | ||
| 2 | COMB(osBacksl, KC_BSLS, KC_Y, KC_SCLN) | ||
| 3 | COMB(mnLess, KC_LT, KC_M, KC_N) | ||
| 4 | COMB(eiGreat, KC_GT, KC_E, KC_I) | ||
| 5 | COMB(xcDash, KC_MINS, KC_X, KC_C) | ||
| 6 | COMB(hcUnds, KC_UNDS, KC_H, KC_COMM) | ||
| 7 | COMB(khQuot, KC_QUOT, KC_K, KC_H) | ||
| 8 | COMB(gvClic, KC_BTN1, KC_G, KC_V) | ||
| 9 | COMB(tdClic, KC_BTN2, KC_T, KC_D) | ||
| 10 | |||
| 11 | SUBS(pasta, "I would just like to interject for a moment.", KC_H, KC_J, KC_K, KC_L) | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c new file mode 100644 index 000000000..ec2c17f8b --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | /* Good on you for modifying your layout! if you don't have | ||
| 2 | * time to read the QMK docs, a list of keycodes can be found at | ||
| 3 | * https://github.com/qmk/qmk_firmware/blob/master/docs/keycodes.md | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include "gergoplex.h" | ||
| 7 | #include "g/keymap_combo.h" | ||
| 8 | |||
| 9 | enum { | ||
| 10 | _ALPHA, // default (Colemak DHm) | ||
| 11 | _SPECIAL, // special characters | ||
| 12 | _NUMBERS // numbers/function/motion | ||
| 13 | }; | ||
| 14 | |||
| 15 | // alpha hold modifiers | ||
| 16 | #define KC_CTL_A MT(MOD_LCTL, KC_A) // Tap for A, hold for Control | ||
| 17 | #define KC_CTL_O MT(MOD_RCTL, KC_O) // Tap for colon, hold for Control | ||
| 18 | #define KC_SFT_Z MT(MOD_LSFT, KC_Z) // Tap for Z, hold for Shift | ||
| 19 | #define KC_SFT_SL MT(MOD_RSFT, KC_SLSH) // Tap for slash, hold for Shift | ||
| 20 | |||
| 21 | // thumb modifiers/toggles | ||
| 22 | #define KC_GUI_ESC MT(MOD_LGUI, KC_ESC) // Tap for Esc, hold for GUI (Meta, Command, Win) | ||
| 23 | #define KC_ALT_ENT MT(MOD_LALT, KC_ENT) // Tap for Enter, hold for Alt (Option) | ||
| 24 | #define KC_SPE_SPC LT(_SPECIAL, KC_SPC) // Tap for Space, hold for Special layer | ||
| 25 | #define KC_NUM_SPC LT(_NUMBERS, KC_SPC) // Tap for Space, hold for Numbers layer | ||
| 26 | #define KC_SFT_TAB MT(MOD_RSFT, KC_TAB) // Tap for Tab, hold for Right Shift | ||
| 27 | |||
| 28 | /* Combomap | ||
| 29 | * | ||
| 30 | * ,-------------------------------. ,-------------------------------. | ||
| 31 | * | | ESC | | | | | ESC | \ | | ||
| 32 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 33 | * | | BSPC TAB | | | < : > | | | ||
| 34 | * |-------+-----+-----+-RMB-+-LMB-| |ENTER+-----+-----+-----+-------| | ||
| 35 | * | | - ENTER | | | ' _ | | | | ||
| 36 | * `-------------------------------' `-------------------------------' | ||
| 37 | * .-----------------. .-----------------. | ||
| 38 | * | | | | | | | | | ||
| 39 | * '-----------------' '-----------------' | ||
| 40 | */ | ||
| 41 | |||
| 42 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 43 | /* Keymap 0: Alpha layer / Colemak DHm | ||
| 44 | * | ||
| 45 | * ,-------------------------------. ,-------------------------------. | ||
| 46 | * | Q | W | F | P | B | | J | L | U | Y | ; | | ||
| 47 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 48 | * | CTRL A| R | S | T | G | | M | N | E | I | O | | ||
| 49 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 50 | * | SHFT Z| X | C | D | V | | K | H | < | > |SHFT / | | ||
| 51 | * `-------------------------------' `-------------------------------' | ||
| 52 | * .------------------------------. .----------------------. | ||
| 53 | * | ESC META | ENT ALT | SPC SPE | | SPC NUM | SHFT | TAB | | ||
| 54 | * '------------------------------' '----------------------' | ||
| 55 | */ | ||
| 56 | [_ALPHA] = LAYOUT_split_3x5_3( | ||
| 57 | KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, | ||
| 58 | KC_CTL_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_CTL_O, | ||
| 59 | KC_SFT_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMMA, KC_DOT, KC_SFT_SL, | ||
| 60 | KC_GUI_ESC, KC_ALT_ENT, KC_SPE_SPC, KC_NUM_SPC, KC_LSFT, KC_SFT_TAB), | ||
| 61 | |||
| 62 | /* Keymap 1: Special characters layer | ||
| 63 | * | ||
| 64 | * ,-------------------------------. ,-------------------------------. | ||
| 65 | * | ! | @ | { | } | | | | ` | ~ | | | \ | | ||
| 66 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 67 | * | # | $ | ( | ) | RMB | | + | - | / | * | ' | | ||
| 68 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 69 | * | % | ^ | [ | ] | LMB | | & | = | , | . | - | | ||
| 70 | * `-------------------------------' `-------------------------------' | ||
| 71 | * .-------------------------. .-----------------. | ||
| 72 | * | ComboToggle | ; | = | | = | ; | DEL | | ||
| 73 | * '-------------------------' '-----------------' | ||
| 74 | */ | ||
| 75 | [_SPECIAL] = LAYOUT_split_3x5_3( | ||
| 76 | KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, KC_TILD, KC_TRNS, KC_TRNS, KC_BSLS, | ||
| 77 | KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_BTN2, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_QUOT, | ||
| 78 | KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BTN1, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_MINS, | ||
| 79 | CMB_TOG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL), | ||
| 80 | |||
| 81 | /* Keymap 2: Numbers/Function/Motion layer | ||
| 82 | * | ||
| 83 | * ,-------------------------------. ,-------------------------------. | ||
| 84 | * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | ||
| 85 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 86 | * | F1 | F2 | F3 | F4 | F5 | | LFT | DWN | UP | RGT | VOLUP | | ||
| 87 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 88 | * | F6 | F7 | F8 | F9 | F10 | | MLFT| MDWN| MUP | MRGT| VOLDN | | ||
| 89 | * `-------------------------------' `-------------------------------' | ||
| 90 | * .-----------------. .-----------------. | ||
| 91 | * | F11 | F12 | | | | PLY | SKP | | ||
| 92 | * '-----------------' '-----------------' | ||
| 93 | */ | ||
| 94 | [_NUMBERS] = LAYOUT_split_3x5_3( | ||
| 95 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, | ||
| 96 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_VOLU, | ||
| 97 | KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_VOLD, | ||
| 98 | KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_MPLY, KC_MNXT) | ||
| 99 | }; | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk new file mode 100644 index 000000000..e882b8008 --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #---------------------------------------------------------------------------- | ||
| 2 | # make gboards/gergoplex:default:flash | ||
| 3 | # Make sure you have dfu-programmer installed! | ||
| 4 | #---------------------------------------------------------------------------- | ||
| 5 | |||
| 6 | #Debug options | ||
| 7 | VERBOSE = no | ||
| 8 | DEBUG_MATRIX_SCAN_RATE = no | ||
| 9 | DEBUG_MATRIX = no | ||
| 10 | CONSOLE_ENABLE = no | ||
| 11 | |||
| 12 | #Combos! | ||
| 13 | VPATH += keyboards/gboards/ | ||
| 14 | |||
| 15 | ifeq ($(strip $(DEBUG_MATRIX)), yes) | ||
| 16 | OPT_DEFS += -DDEBUG_MATRIX | ||
| 17 | endif | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/default/combos.def b/keyboards/gboards/gergoplex/keymaps/default/combos.def new file mode 100644 index 000000000..97ea961e6 --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/default/combos.def | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | // List any combo dictionaries you want loaded to your device below! | ||
| 2 | |||
| 3 | // QMK wide includes | ||
| 4 | #include "combos/germ-vim-helpers.def" | ||
| 5 | #include "combos/germ-mouse-keys.def" | ||
| 6 | |||
| 7 | // User includes | ||
| 8 | #include "gergoplex.def" | ||
| 9 | |||
| 10 | // Word completion | ||
| 11 | // #include "combos/eng-combos.def" | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/default/gergoplex.def b/keyboards/gboards/gergoplex/keymaps/default/gergoplex.def new file mode 100644 index 000000000..6e50571b5 --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/default/gergoplex.def | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | // Gergoplex specfic combos | ||
| 2 | |||
| 3 | COMB(opBacksl, KC_BSLS, KC_O, KC_P) | ||
| 4 | COMB(hjLess, KC_LT, KC_H, KC_J) | ||
| 5 | COMB(klGreat, KC_GT, KC_K, KC_L) | ||
| 6 | COMB(xcDash, KC_MINS, KC_X, KC_C) | ||
| 7 | COMB(mcUnds, KC_UNDS, KC_M, KC_COMM) | ||
| 8 | COMB(nmQuot, KC_QUOT, KC_N, KC_M) | ||
| 9 | |||
| 10 | SUBS(pasta, "I'd just like to interject for a moment.", KC_H, KC_J, KC_K, KC_L) | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/default/keymap.c b/keyboards/gboards/gergoplex/keymaps/default/keymap.c new file mode 100644 index 000000000..c63275120 --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/default/keymap.c | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | /* Copyright 2021 Jane Bernhardt | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* Good on you for modifying your layout! if you don't have | ||
| 18 | * time to read the QMK docs, a list of keycodes can be found at | ||
| 19 | * https://github.com/qmk/qmk_firmware/blob/master/docs/keycodes.md | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include QMK_KEYBOARD_H | ||
| 23 | #include "g/keymap_combo.h" | ||
| 24 | |||
| 25 | enum { | ||
| 26 | _ALPHA, // default | ||
| 27 | _SPECIAL, // special characters | ||
| 28 | _NUMBERS // numbers/function/motion | ||
| 29 | }; | ||
| 30 | |||
| 31 | #define KC_CTL_A MT(MOD_LCTL, KC_A) // Tap for A, hold for Control | ||
| 32 | #define KC_CTL_CL MT(MOD_LCTL, KC_SCLN) // Tap for colon, hold for Control | ||
| 33 | #define KC_SFT_Z MT(MOD_RSFT, KC_Z) // Tap for Z, hold for Shift | ||
| 34 | #define KC_SFT_SL MT(MOD_RSFT, KC_SLSH) // Tap for slash, hold for Shift | ||
| 35 | |||
| 36 | #define KC_GUI_ESC MT(MOD_LGUI, KC_ESC) // Tap for Esc, hold for GUI (Meta, Command, Win) | ||
| 37 | #define KC_ALT_ENT MT(MOD_LALT, KC_ENT) // Tap for Enter, hold for Alt (Option) | ||
| 38 | #define KC_SPE_SPC LT(_SPECIAL, KC_SPC) // Tap for Space, hold for Special layer | ||
| 39 | #define KC_NUM_SPC LT(_NUMBERS, KC_SPC) // Tap for Space, hold for Numbers layer | ||
| 40 | #define KC_SFT_TAB MT(MOD_RSFT, KC_TAB) // Tap for Tab, hold for Right Shift | ||
| 41 | |||
| 42 | /* Combomap | ||
| 43 | * | ||
| 44 | * ,-------------------------------. ,-------------------------------. | ||
| 45 | * | | ESC | | | | | ESC | \ | | ||
| 46 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 47 | * | | BSPC TAB | | | < : > | | | ||
| 48 | * |-------+-----+-----+-RMB-+-LMB-| |ENTER+-----+-----+-----+-------| | ||
| 49 | * | | - ENTER | | | ' _ | | | | ||
| 50 | * `-------------------------------' `-------------------------------' | ||
| 51 | * .-----------------. .-----------------. | ||
| 52 | * | | | | | | | | | ||
| 53 | * '-----------------' '-----------------' | ||
| 54 | */ | ||
| 55 | |||
| 56 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 57 | /* Keymap 0: Alpha layer | ||
| 58 | * | ||
| 59 | * ,-------------------------------. ,-------------------------------. | ||
| 60 | * | Q | W | E | R | T | | Y | U | I | O | P | | ||
| 61 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 62 | * | CTRL A| S | D | F | G | | H | J | K | L |CTRL ; | | ||
| 63 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 64 | * | SHFT Z| X | C | V | B | | N | M | < | > |SHFT / | | ||
| 65 | * `-------------------------------' `-------------------------------' | ||
| 66 | * .------------------------------. .----------------------. | ||
| 67 | * | ESC META | ENT ALT | SPC SPE | | SPC NUM | SHFT | TAB | | ||
| 68 | * '------------------------------' '----------------------' | ||
| 69 | */ | ||
| 70 | [_ALPHA] = LAYOUT_split_3x5_3( | ||
| 71 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, | ||
| 72 | KC_CTL_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_CTL_CL, | ||
| 73 | KC_SFT_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SFT_SL, | ||
| 74 | KC_GUI_ESC, KC_ALT_ENT, KC_SPE_SPC, KC_NUM_SPC, KC_LSFT, KC_SFT_TAB), | ||
| 75 | |||
| 76 | /* Keymap 1: Special characters layer | ||
| 77 | * | ||
| 78 | * ,-------------------------------. ,-------------------------------. | ||
| 79 | * | ! | @ | { | } | | | | ` | ~ | | | \ | | ||
| 80 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 81 | * | # | $ | ( | ) | RMB | | + | - | / | * | ' | | ||
| 82 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 83 | * | % | ^ | [ | ] | LMB | | & | = | , | . | - | | ||
| 84 | * `-------------------------------' `-------------------------------' | ||
| 85 | * .-------------------------. .-----------------. | ||
| 86 | * | ComboToggle | ; | = | | = | ; | DEL | | ||
| 87 | * '-------------------------' '-----------------' | ||
| 88 | */ | ||
| 89 | [_SPECIAL] = LAYOUT_split_3x5_3( | ||
| 90 | KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, KC_TILD, KC_TRNS, KC_TRNS, KC_BSLS, | ||
| 91 | KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_BTN2, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_QUOT, | ||
| 92 | KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BTN1, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_MINS, | ||
| 93 | CMB_TOG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL), | ||
| 94 | |||
| 95 | /* Keymap 2: Numbers/Function/Motion layer | ||
| 96 | * | ||
| 97 | * ,-------------------------------. ,-------------------------------. | ||
| 98 | * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | ||
| 99 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 100 | * | F1 | F2 | F3 | F4 | F5 | | LFT | DWN | UP | RGT | VOLUP | | ||
| 101 | * |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------| | ||
| 102 | * | F6 | F7 | F8 | F9 | F10 | | MLFT| MDWN| MUP | MRGT| VOLDN | | ||
| 103 | * `-------------------------------' `-------------------------------' | ||
| 104 | * .-----------------. .-----------------. | ||
| 105 | * | F11 | F12 | | | | PLY | SKP | | ||
| 106 | * '-----------------' '-----------------' | ||
| 107 | */ | ||
| 108 | [_NUMBERS] = LAYOUT_split_3x5_3( | ||
| 109 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, | ||
| 110 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_VOLU, | ||
| 111 | KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_VOLD, | ||
| 112 | KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_MPLY, KC_MNXT) | ||
| 113 | }; | ||
diff --git a/keyboards/gboards/gergoplex/keymaps/default/rules.mk b/keyboards/gboards/gergoplex/keymaps/default/rules.mk new file mode 100644 index 000000000..e882b8008 --- /dev/null +++ b/keyboards/gboards/gergoplex/keymaps/default/rules.mk | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #---------------------------------------------------------------------------- | ||
| 2 | # make gboards/gergoplex:default:flash | ||
| 3 | # Make sure you have dfu-programmer installed! | ||
| 4 | #---------------------------------------------------------------------------- | ||
| 5 | |||
| 6 | #Debug options | ||
| 7 | VERBOSE = no | ||
| 8 | DEBUG_MATRIX_SCAN_RATE = no | ||
| 9 | DEBUG_MATRIX = no | ||
| 10 | CONSOLE_ENABLE = no | ||
| 11 | |||
| 12 | #Combos! | ||
| 13 | VPATH += keyboards/gboards/ | ||
| 14 | |||
| 15 | ifeq ($(strip $(DEBUG_MATRIX)), yes) | ||
| 16 | OPT_DEFS += -DDEBUG_MATRIX | ||
| 17 | endif | ||
diff --git a/keyboards/gboards/gergoplex/matrix.c b/keyboards/gboards/gergoplex/matrix.c new file mode 100644 index 000000000..716390241 --- /dev/null +++ b/keyboards/gboards/gergoplex/matrix.c | |||
| @@ -0,0 +1,241 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com> | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include "matrix.h" | ||
| 20 | #include <stdint.h> | ||
| 21 | #include <stdbool.h> | ||
| 22 | #include <avr/io.h> | ||
| 23 | #include "wait.h" | ||
| 24 | #include "action_layer.h" | ||
| 25 | #include "print.h" | ||
| 26 | #include "debug.h" | ||
| 27 | #include "util.h" | ||
| 28 | #include "debounce.h" | ||
| 29 | #include "gergoplex.h" | ||
| 30 | |||
| 31 | #ifdef BALLER | ||
| 32 | # include <avr/interrupt.h> | ||
| 33 | # include "pointing_device.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #ifndef DEBOUNCE | ||
| 37 | # define DEBOUNCE 5 | ||
| 38 | #endif | ||
| 39 | |||
| 40 | // ATmega pin defs | ||
| 41 | #define ROW1 (1 << 6) | ||
| 42 | #define ROW2 (1 << 5) | ||
| 43 | #define ROW3 (1 << 4) | ||
| 44 | #define ROW4 (1 << 1) | ||
| 45 | |||
| 46 | /* matrix state(1:on, 0:off) */ | ||
| 47 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 48 | /* | ||
| 49 | * matrix state(1:on, 0:off) | ||
| 50 | * contains the raw values without debounce filtering of the last read cycle. | ||
| 51 | */ | ||
| 52 | static matrix_row_t raw_matrix[MATRIX_ROWS]; | ||
| 53 | |||
| 54 | static const pin_t row_pins[MATRIX_COLS] = MATRIX_ROW_PINS; | ||
| 55 | // Right-hand side only pins, the left side is controlled my MCP | ||
| 56 | static const pin_t col_pins[MATRIX_ROWS_PER_SIDE] = MATRIX_COL_PINS; | ||
| 57 | |||
| 58 | // Debouncing: store for each key the number of scans until it's eligible to | ||
| 59 | // change. When scanning the matrix, ignore any changes in keys that have | ||
| 60 | // already changed in the last DEBOUNCE scans. | ||
| 61 | |||
| 62 | static matrix_row_t read_cols(uint8_t row); | ||
| 63 | static void init_cols(void); | ||
| 64 | static void unselect_rows(void); | ||
| 65 | static void select_row(uint8_t row); | ||
| 66 | |||
| 67 | static uint8_t mcp23018_reset_loop; | ||
| 68 | |||
| 69 | __attribute__((weak)) void matrix_init_user(void) {} | ||
| 70 | __attribute__((weak)) void matrix_scan_user(void) {} | ||
| 71 | __attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } | ||
| 72 | |||
| 73 | void matrix_init(void) { | ||
| 74 | // initialize row and col | ||
| 75 | mcp23018_status = init_mcp23018(); | ||
| 76 | unselect_rows(); | ||
| 77 | init_cols(); | ||
| 78 | |||
| 79 | // initialize matrix state: all keys off | ||
| 80 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 81 | matrix[i] = 0; | ||
| 82 | raw_matrix[i] = 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | debounce_init(MATRIX_ROWS); | ||
| 86 | matrix_init_quantum(); | ||
| 87 | } | ||
| 88 | void matrix_power_up(void) { | ||
| 89 | mcp23018_status = init_mcp23018(); | ||
| 90 | |||
| 91 | unselect_rows(); | ||
| 92 | init_cols(); | ||
| 93 | |||
| 94 | // initialize matrix state: all keys off | ||
| 95 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 96 | matrix[i] = 0; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | // Reads and stores a row, returning | ||
| 101 | // whether a change occurred. | ||
| 102 | static inline bool store_raw_matrix_row(uint8_t index) { | ||
| 103 | matrix_row_t temp = read_cols(index); | ||
| 104 | if (raw_matrix[index] != temp) { | ||
| 105 | raw_matrix[index] = temp; | ||
| 106 | return true; | ||
| 107 | } | ||
| 108 | return false; | ||
| 109 | } | ||
| 110 | uint8_t matrix_scan(void) { | ||
| 111 | if (mcp23018_status) { // if there was an error | ||
| 112 | if (++mcp23018_reset_loop == 0) { | ||
| 113 | // if (++mcp23018_reset_loop >= 1300) { | ||
| 114 | // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans | ||
| 115 | // this will be approx bit more frequent than once per second | ||
| 116 | print("trying to reset mcp23018\n"); | ||
| 117 | mcp23018_status = init_mcp23018(); | ||
| 118 | if (mcp23018_status) { | ||
| 119 | print("left side not responding\n"); | ||
| 120 | } else { | ||
| 121 | print("left side attached\n"); | ||
| 122 | } | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | bool changed = false; | ||
| 127 | for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) { | ||
| 128 | // select rows from left and right hands | ||
| 129 | uint8_t left_index = i; | ||
| 130 | uint8_t right_index = i + MATRIX_ROWS_PER_SIDE; | ||
| 131 | select_row(left_index); | ||
| 132 | select_row(right_index); | ||
| 133 | |||
| 134 | // we don't need a 30us delay anymore, because selecting a | ||
| 135 | // left-hand row requires more than 30us for i2c. | ||
| 136 | |||
| 137 | changed |= store_raw_matrix_row(left_index); | ||
| 138 | changed |= store_raw_matrix_row(right_index); | ||
| 139 | |||
| 140 | unselect_rows(); | ||
| 141 | } | ||
| 142 | |||
| 143 | debounce(raw_matrix, matrix, MATRIX_ROWS, changed); | ||
| 144 | matrix_scan_quantum(); | ||
| 145 | |||
| 146 | #ifdef DEBUG_MATRIX | ||
| 147 | for (uint8_t c = 0; c < MATRIX_COLS; c++) | ||
| 148 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) | ||
| 149 | if (matrix_is_on(r, c)) xprintf("r:%d c:%d \n", r, c); | ||
| 150 | #endif | ||
| 151 | |||
| 152 | return 1; | ||
| 153 | } | ||
| 154 | |||
| 155 | bool matrix_is_modified(void) // deprecated and evidently not called. | ||
| 156 | { | ||
| 157 | return true; | ||
| 158 | } | ||
| 159 | |||
| 160 | inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); } | ||
| 161 | inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } | ||
| 162 | |||
| 163 | void matrix_print(void) { | ||
| 164 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 165 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 166 | print_hex8(row); | ||
| 167 | print(": "); | ||
| 168 | print_bin_reverse16(matrix_get_row(row)); | ||
| 169 | print("\n"); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | uint8_t matrix_key_count(void) { | ||
| 173 | uint8_t count = 0; | ||
| 174 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 175 | count += bitpop16(matrix[i]); | ||
| 176 | } | ||
| 177 | return count; | ||
| 178 | } | ||
| 179 | |||
| 180 | // Remember this means ROWS | ||
| 181 | static void init_cols(void) { | ||
| 182 | for (uint8_t row = 0; row < MATRIX_COLS; row++) { | ||
| 183 | setPinInputHigh(row_pins[row]); | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | static matrix_row_t read_cols(uint8_t row) { | ||
| 188 | if (row < 5) { | ||
| 189 | if (mcp23018_status) { // if there was an error | ||
| 190 | return 0; | ||
| 191 | } else { | ||
| 192 | uint8_t data = 0; | ||
| 193 | mcp23018_status = i2c_start(I2C_ADDR_READ, I2C_TIMEOUT); | ||
| 194 | if (mcp23018_status) goto out; | ||
| 195 | mcp23018_status = i2c_read_nack(I2C_TIMEOUT); | ||
| 196 | if (mcp23018_status < 0) goto out; | ||
| 197 | data = ~((uint8_t)mcp23018_status); | ||
| 198 | mcp23018_status = I2C_STATUS_SUCCESS; | ||
| 199 | out: | ||
| 200 | i2c_stop(); | ||
| 201 | |||
| 202 | #ifdef DEBUG_MATRIX | ||
| 203 | if (data != 0x00) xprintf("I2C: %d\n", data); | ||
| 204 | #endif | ||
| 205 | return data; | ||
| 206 | } | ||
| 207 | } else { | ||
| 208 | return ~((((PINF & ROW4) >> 1) | ((PINF & (ROW1 | ROW2 | ROW3)) >> 3)) & 0xF); | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | // Row pin configuration | ||
| 213 | static void unselect_rows(void) { | ||
| 214 | // no need to unselect on mcp23018, because the select step sets all | ||
| 215 | // the other row bits high, and it's not changing to a different direction | ||
| 216 | |||
| 217 | for (uint8_t col = 0; col < MATRIX_ROWS_PER_SIDE; col++) { | ||
| 218 | setPinInput(col_pins[col]); | ||
| 219 | writePinLow(col_pins[col]); | ||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 223 | static void select_row(uint8_t row) { | ||
| 224 | if (row < 5) { | ||
| 225 | // select on mcp23018 | ||
| 226 | if (mcp23018_status) { // do nothing on error | ||
| 227 | } else { // set active row low : 0 // set other rows hi-Z : 1 | ||
| 228 | mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); | ||
| 229 | if (mcp23018_status) goto out; | ||
| 230 | mcp23018_status = i2c_write(GPIOA, I2C_TIMEOUT); | ||
| 231 | if (mcp23018_status) goto out; | ||
| 232 | mcp23018_status = i2c_write(0xFF & ~(1 << (row + 1)), I2C_TIMEOUT); | ||
| 233 | if (mcp23018_status) goto out; | ||
| 234 | out: | ||
| 235 | i2c_stop(); | ||
| 236 | } | ||
| 237 | } else { | ||
| 238 | setPinOutput(col_pins[row - MATRIX_ROWS_PER_SIDE]); | ||
| 239 | writePinLow(col_pins[row - MATRIX_ROWS_PER_SIDE]); | ||
| 240 | } | ||
| 241 | } | ||
diff --git a/keyboards/gboards/gergoplex/readme.md b/keyboards/gboards/gergoplex/readme.md new file mode 100644 index 000000000..7728d90d4 --- /dev/null +++ b/keyboards/gboards/gergoplex/readme.md | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | # GergoPlex | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | A compact 30% (5x3+3) Split Keyboard from g Heavy Industries | ||
| 6 | |||
| 7 | * Keyboard Maintainer: [Jane Bernhardt](https://github.com/germ) | ||
| 8 | * Hardware Supported: GergoPlex (Kit, Partial, Ready) | ||
| 9 | * Hardware Availability: [gboards.ca](http://gboards.ca) | ||
| 10 | |||
| 11 | ## Firmware building | ||
| 12 | |||
| 13 | Build using the following command (after setting up your build environment): | ||
| 14 | |||
| 15 | ``` | ||
| 16 | make gboards/gergoplex:default | ||
| 17 | ``` | ||
| 18 | |||
| 19 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
| 20 | |||
| 21 | Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
| 22 | |||
| 23 | Switch `default` with `colemak-dhm` if you prefer to use [Colemak Mod-DH layout](https://colemakmods.github.io/mod-dh/). | ||
| 24 | |||
| 25 | ## Flashing | ||
| 26 | |||
| 27 | Press the small SMD button on the right side board, and run: | ||
| 28 | |||
| 29 | ``` | ||
| 30 | make gboards/gergoplex:default:flash | ||
| 31 | ``` | ||
| 32 | |||
| 33 | ### Troubleshooting | ||
| 34 | |||
| 35 | See [this issue](https://github.com/qmk/qmk_toolbox/issues/58) for solutions if you're seeing: | ||
| 36 | ``` | ||
| 37 | dfu-programmer: no device present. | ||
| 38 | ERROR: Bootloader not found. Trying again in 5s. | ||
| 39 | ``` | ||
| 40 | |||
| 41 | ## Have an idea for a gadget or a keymap? | ||
| 42 | |||
| 43 | [Reach out to me!](mailto:jane@gboards.ca) or submit a PR! | ||
diff --git a/keyboards/gboards/gergoplex/rules.mk b/keyboards/gboards/gergoplex/rules.mk new file mode 100644 index 000000000..1d0ba8cae --- /dev/null +++ b/keyboards/gboards/gergoplex/rules.mk | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | MCU = atmega32u4 | ||
| 2 | |||
| 3 | BOOTLOADER = atmel-dfu | ||
| 4 | |||
| 5 | CUSTOM_MATRIX = yes | ||
| 6 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 7 | COMBO_ENABLE = yes | ||
| 8 | EXTRAKEY_ENABLE = yes | ||
| 9 | CONSOLE_ENABLE = no | ||
| 10 | NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 11 | COMMAND_ENABLE = yes | ||
| 12 | BOOTMAGIC_ENABLE = lite | ||
| 13 | |||
| 14 | LAYOUTS = split_3x5_3 | ||
| 15 | |||
| 16 | DEBOUNCE_TYPE = sym_eager_pr | ||
| 17 | SRC += matrix.c | ||
| 18 | QUANTUM_LIB_SRC += i2c_master.c | ||
