diff options
| author | Danny <nooges@users.noreply.github.com> | 2018-05-28 18:02:41 -0400 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-05-28 15:02:41 -0700 |
| commit | 2b677ddac9aaba14f75787ab4b6d81054ad6ffd4 (patch) | |
| tree | 61079929788a447a26de38776b7eb9eacebe9a2e | |
| parent | 8ddebce2d7d42eedbafae5b92dff1af229115fac (diff) | |
| download | qmk_firmware-2b677ddac9aaba14f75787ab4b6d81054ad6ffd4.tar.gz qmk_firmware-2b677ddac9aaba14f75787ab4b6d81054ad6ffd4.zip | |
Fix nyquist (and other splits using D2 in debouncing) (#3067)
* Update default Nyquist revision
* LED slave fix
* Sync changes from lets_split
* Add needed check for debouncing
* Remove line that was setting PD2 pin and interfering with use of that pin
* Add backlight key to keymap
| -rw-r--r-- | keyboards/deltasplit75/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/ergo42/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/fourier/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/handwired/dactyl_manuform/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/iris/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/lets_split/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/levinson/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/nyquist/keymaps/hexwire/keymap.c | 3 | ||||
| -rw-r--r-- | keyboards/nyquist/matrix.c | 48 | ||||
| -rw-r--r-- | keyboards/nyquist/rules.mk | 6 | ||||
| -rw-r--r-- | keyboards/redox/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/vitamins_included/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/viterbi/matrix.c | 1 | ||||
| -rw-r--r-- | keyboards/zen/matrix.c | 1 |
14 files changed, 50 insertions, 18 deletions
diff --git a/keyboards/deltasplit75/matrix.c b/keyboards/deltasplit75/matrix.c index db84fb02c..1ac5c5039 100644 --- a/keyboards/deltasplit75/matrix.c +++ b/keyboards/deltasplit75/matrix.c | |||
| @@ -146,7 +146,6 @@ uint8_t _matrix_scan(void) | |||
| 146 | if (matrix_changed) { | 146 | if (matrix_changed) { |
| 147 | debouncing = true; | 147 | debouncing = true; |
| 148 | debouncing_time = timer_read(); | 148 | debouncing_time = timer_read(); |
| 149 | PORTD ^= (1 << 2); | ||
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | # else | 151 | # else |
diff --git a/keyboards/ergo42/matrix.c b/keyboards/ergo42/matrix.c index 80d4ce46a..fc42dd14d 100644 --- a/keyboards/ergo42/matrix.c +++ b/keyboards/ergo42/matrix.c | |||
| @@ -151,7 +151,6 @@ uint8_t _matrix_scan(void) | |||
| 151 | if (matrix_changed) { | 151 | if (matrix_changed) { |
| 152 | debouncing = true; | 152 | debouncing = true; |
| 153 | debouncing_time = timer_read(); | 153 | debouncing_time = timer_read(); |
| 154 | PORTD ^= (1 << 2); | ||
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | # else | 156 | # else |
diff --git a/keyboards/fourier/matrix.c b/keyboards/fourier/matrix.c index ed913f34b..fdeead7dc 100644 --- a/keyboards/fourier/matrix.c +++ b/keyboards/fourier/matrix.c | |||
| @@ -149,7 +149,6 @@ uint8_t _matrix_scan(void) | |||
| 149 | if (matrix_changed) { | 149 | if (matrix_changed) { |
| 150 | debouncing = true; | 150 | debouncing = true; |
| 151 | debouncing_time = timer_read(); | 151 | debouncing_time = timer_read(); |
| 152 | PORTD ^= (1 << 2); | ||
| 153 | } | 152 | } |
| 154 | 153 | ||
| 155 | # else | 154 | # else |
diff --git a/keyboards/handwired/dactyl_manuform/matrix.c b/keyboards/handwired/dactyl_manuform/matrix.c index c3bfe8042..904850d4d 100644 --- a/keyboards/handwired/dactyl_manuform/matrix.c +++ b/keyboards/handwired/dactyl_manuform/matrix.c | |||
| @@ -157,7 +157,6 @@ uint8_t _matrix_scan(void) | |||
| 157 | if (matrix_changed) { | 157 | if (matrix_changed) { |
| 158 | debouncing = true; | 158 | debouncing = true; |
| 159 | debouncing_time = timer_read(); | 159 | debouncing_time = timer_read(); |
| 160 | PORTD ^= (1 << 2); | ||
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | # else | 162 | # else |
diff --git a/keyboards/iris/matrix.c b/keyboards/iris/matrix.c index 7195fb0ea..217264f26 100644 --- a/keyboards/iris/matrix.c +++ b/keyboards/iris/matrix.c | |||
| @@ -153,7 +153,6 @@ uint8_t _matrix_scan(void) | |||
| 153 | if (matrix_changed) { | 153 | if (matrix_changed) { |
| 154 | debouncing = true; | 154 | debouncing = true; |
| 155 | debouncing_time = timer_read(); | 155 | debouncing_time = timer_read(); |
| 156 | PORTD ^= (1 << 2); | ||
| 157 | } | 156 | } |
| 158 | 157 | ||
| 159 | # else | 158 | # else |
diff --git a/keyboards/lets_split/matrix.c b/keyboards/lets_split/matrix.c index c3bfe8042..904850d4d 100644 --- a/keyboards/lets_split/matrix.c +++ b/keyboards/lets_split/matrix.c | |||
| @@ -157,7 +157,6 @@ uint8_t _matrix_scan(void) | |||
| 157 | if (matrix_changed) { | 157 | if (matrix_changed) { |
| 158 | debouncing = true; | 158 | debouncing = true; |
| 159 | debouncing_time = timer_read(); | 159 | debouncing_time = timer_read(); |
| 160 | PORTD ^= (1 << 2); | ||
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | # else | 162 | # else |
diff --git a/keyboards/levinson/matrix.c b/keyboards/levinson/matrix.c index 7195fb0ea..217264f26 100644 --- a/keyboards/levinson/matrix.c +++ b/keyboards/levinson/matrix.c | |||
| @@ -153,7 +153,6 @@ uint8_t _matrix_scan(void) | |||
| 153 | if (matrix_changed) { | 153 | if (matrix_changed) { |
| 154 | debouncing = true; | 154 | debouncing = true; |
| 155 | debouncing_time = timer_read(); | 155 | debouncing_time = timer_read(); |
| 156 | PORTD ^= (1 << 2); | ||
| 157 | } | 156 | } |
| 158 | 157 | ||
| 159 | # else | 158 | # else |
diff --git a/keyboards/nyquist/keymaps/hexwire/keymap.c b/keyboards/nyquist/keymaps/hexwire/keymap.c index 699cc3de5..40df4bcab 100644 --- a/keyboards/nyquist/keymaps/hexwire/keymap.c +++ b/keyboards/nyquist/keymaps/hexwire/keymap.c | |||
| @@ -36,6 +36,7 @@ enum custom_keycodes { | |||
| 36 | #define KC_X2 RAISE | 36 | #define KC_X2 RAISE |
| 37 | #define KC_X3 LT(_FN3, KC_GRV) | 37 | #define KC_X3 LT(_FN3, KC_GRV) |
| 38 | #define KC_X4 MT(MOD_LSFT, KC_ENT) | 38 | #define KC_X4 MT(MOD_LSFT, KC_ENT) |
| 39 | #define KC_BL_S BL_STEP | ||
| 39 | 40 | ||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 41 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 41 | 42 | ||
| @@ -91,7 +92,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 91 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 92 | //|----+----+----+----+----+----| |----+----+----+----+----+----| |
| 92 | ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, , | 93 | ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, , |
| 93 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 94 | //|----+----+----+----+----+----| |----+----+----+----+----+----| |
| 94 | , , , , , , DEL , , P0 ,PDOT, , | 95 | BL_S, , , , , , DEL , , P0 ,PDOT, , |
| 95 | //`----+----+----+----+----+----' `----+----+----+----+----+----' | 96 | //`----+----+----+----+----+----' `----+----+----+----+----+----' |
| 96 | ), | 97 | ), |
| 97 | 98 | ||
diff --git a/keyboards/nyquist/matrix.c b/keyboards/nyquist/matrix.c index 5fbae1150..3cdad4adb 100644 --- a/keyboards/nyquist/matrix.c +++ b/keyboards/nyquist/matrix.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2017 Danny Nguyen <danny@hexwire.com> | 2 | Copyright 2017 Danny Nguyen <danny@keeb.io> |
| 3 | 3 | ||
| 4 | This program is free software: you can redistribute it and/or modify | 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 | 5 | it under the terms of the GNU General Public License as published by |
| @@ -31,6 +31,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 31 | #include "config.h" | 31 | #include "config.h" |
| 32 | #include "timer.h" | 32 | #include "timer.h" |
| 33 | 33 | ||
| 34 | #ifdef BACKLIGHT_ENABLE | ||
| 35 | #include "backlight.h" | ||
| 36 | extern backlight_config_t backlight_config; | ||
| 37 | #endif | ||
| 38 | |||
| 34 | #ifdef USE_I2C | 39 | #ifdef USE_I2C |
| 35 | # include "i2c.h" | 40 | # include "i2c.h" |
| 36 | #else // USE_SERIAL | 41 | #else // USE_SERIAL |
| @@ -58,6 +63,8 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | |||
| 58 | 63 | ||
| 59 | #define ERROR_DISCONNECT_COUNT 5 | 64 | #define ERROR_DISCONNECT_COUNT 5 |
| 60 | 65 | ||
| 66 | #define SERIAL_LED_ADDR 0x00 | ||
| 67 | |||
| 61 | #define ROWS_PER_HAND (MATRIX_ROWS/2) | 68 | #define ROWS_PER_HAND (MATRIX_ROWS/2) |
| 62 | 69 | ||
| 63 | static uint8_t error_count = 0; | 70 | static uint8_t error_count = 0; |
| @@ -115,12 +122,23 @@ uint8_t matrix_cols(void) | |||
| 115 | 122 | ||
| 116 | void matrix_init(void) | 123 | void matrix_init(void) |
| 117 | { | 124 | { |
| 125 | #ifdef DISABLE_JTAG | ||
| 126 | // JTAG disable for PORT F. write JTD bit twice within four cycles. | ||
| 127 | MCUCR |= (1<<JTD); | ||
| 128 | MCUCR |= (1<<JTD); | ||
| 129 | #endif | ||
| 130 | |||
| 118 | debug_enable = true; | 131 | debug_enable = true; |
| 119 | debug_matrix = true; | 132 | debug_matrix = true; |
| 120 | debug_mouse = true; | 133 | debug_mouse = true; |
| 121 | // initialize row and col | 134 | // initialize row and col |
| 135 | #if (DIODE_DIRECTION == COL2ROW) | ||
| 122 | unselect_rows(); | 136 | unselect_rows(); |
| 123 | init_cols(); | 137 | init_cols(); |
| 138 | #elif (DIODE_DIRECTION == ROW2COL) | ||
| 139 | unselect_cols(); | ||
| 140 | init_rows(); | ||
| 141 | #endif | ||
| 124 | 142 | ||
| 125 | TX_RX_LED_INIT; | 143 | TX_RX_LED_INIT; |
| 126 | 144 | ||
| @@ -146,7 +164,6 @@ uint8_t _matrix_scan(void) | |||
| 146 | if (matrix_changed) { | 164 | if (matrix_changed) { |
| 147 | debouncing = true; | 165 | debouncing = true; |
| 148 | debouncing_time = timer_read(); | 166 | debouncing_time = timer_read(); |
| 149 | PORTD ^= (1 << 2); | ||
| 150 | } | 167 | } |
| 151 | 168 | ||
| 152 | # else | 169 | # else |
| @@ -196,6 +213,15 @@ int i2c_transaction(void) { | |||
| 196 | err = i2c_master_write(0x00); | 213 | err = i2c_master_write(0x00); |
| 197 | if (err) goto i2c_error; | 214 | if (err) goto i2c_error; |
| 198 | 215 | ||
| 216 | #ifdef BACKLIGHT_ENABLE | ||
| 217 | // Write backlight level for slave to read | ||
| 218 | err = i2c_master_write(backlight_config.enable ? backlight_config.level : 0); | ||
| 219 | #else | ||
| 220 | // Write zero, so our byte index is the same | ||
| 221 | err = i2c_master_write(0x00); | ||
| 222 | #endif | ||
| 223 | if (err) goto i2c_error; | ||
| 224 | |||
| 199 | // Start read | 225 | // Start read |
| 200 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | 226 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); |
| 201 | if (err) goto i2c_error; | 227 | if (err) goto i2c_error; |
| @@ -228,6 +254,11 @@ int serial_transaction(void) { | |||
| 228 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 254 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
| 229 | matrix[slaveOffset+i] = serial_slave_buffer[i]; | 255 | matrix[slaveOffset+i] = serial_slave_buffer[i]; |
| 230 | } | 256 | } |
| 257 | |||
| 258 | #ifdef BACKLIGHT_ENABLE | ||
| 259 | // Write backlight level for slave to read | ||
| 260 | serial_master_buffer[SERIAL_LED_ADDR] = backlight_config.enable ? backlight_config.level : 0; | ||
| 261 | #endif | ||
| 231 | return 0; | 262 | return 0; |
| 232 | } | 263 | } |
| 233 | #endif | 264 | #endif |
| @@ -268,19 +299,30 @@ void matrix_slave_scan(void) { | |||
| 268 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | 299 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; |
| 269 | 300 | ||
| 270 | #ifdef USE_I2C | 301 | #ifdef USE_I2C |
| 302 | #ifdef BACKLIGHT_ENABLE | ||
| 303 | // Read backlight level sent from master and update level on slave | ||
| 304 | backlight_set(i2c_slave_buffer[0]); | ||
| 305 | #endif | ||
| 271 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 306 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
| 272 | i2c_slave_buffer[i] = matrix[offset+i]; | 307 | i2c_slave_buffer[i+1] = matrix[offset+i]; |
| 273 | } | 308 | } |
| 274 | #else // USE_SERIAL | 309 | #else // USE_SERIAL |
| 275 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 310 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
| 276 | serial_slave_buffer[i] = matrix[offset+i]; | 311 | serial_slave_buffer[i] = matrix[offset+i]; |
| 277 | } | 312 | } |
| 313 | |||
| 314 | #ifdef BACKLIGHT_ENABLE | ||
| 315 | // Read backlight level sent from master and update level on slave | ||
| 316 | backlight_set(serial_master_buffer[SERIAL_LED_ADDR]); | ||
| 317 | #endif | ||
| 278 | #endif | 318 | #endif |
| 279 | } | 319 | } |
| 280 | 320 | ||
| 281 | bool matrix_is_modified(void) | 321 | bool matrix_is_modified(void) |
| 282 | { | 322 | { |
| 323 | #if (DEBOUNCING_DELAY > 0) | ||
| 283 | if (debouncing) return false; | 324 | if (debouncing) return false; |
| 325 | #endif | ||
| 284 | return true; | 326 | return true; |
| 285 | } | 327 | } |
| 286 | 328 | ||
diff --git a/keyboards/nyquist/rules.mk b/keyboards/nyquist/rules.mk index 840628e1c..e8f184041 100644 --- a/keyboards/nyquist/rules.mk +++ b/keyboards/nyquist/rules.mk | |||
| @@ -58,13 +58,13 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | |||
| 58 | CONSOLE_ENABLE = no # Console for debug(+400) | 58 | CONSOLE_ENABLE = no # Console for debug(+400) |
| 59 | COMMAND_ENABLE = yes # Commands for debug and configuration | 59 | COMMAND_ENABLE = yes # Commands for debug and configuration |
| 60 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 60 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
| 61 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | 61 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality |
| 62 | MIDI_ENABLE = no # MIDI controls | 62 | MIDI_ENABLE = no # MIDI controls |
| 63 | AUDIO_ENABLE = no # Audio output on port C6 | 63 | AUDIO_ENABLE = no # Audio output on port C6 |
| 64 | UNICODE_ENABLE = no # Unicode | 64 | UNICODE_ENABLE = no # Unicode |
| 65 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 65 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 66 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 67 | USE_I2C = yes | 66 | USE_I2C = yes |
| 67 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 68 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 68 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
| 69 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 69 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
| 70 | 70 | ||
| @@ -72,4 +72,4 @@ CUSTOM_MATRIX = yes | |||
| 72 | 72 | ||
| 73 | LAYOUTS = ortho_5x12 | 73 | LAYOUTS = ortho_5x12 |
| 74 | 74 | ||
| 75 | DEFAULT_FOLDER = nyquist/rev1 \ No newline at end of file | 75 | DEFAULT_FOLDER = nyquist/rev2 |
diff --git a/keyboards/redox/matrix.c b/keyboards/redox/matrix.c index 20c0f1d34..1607775bd 100644 --- a/keyboards/redox/matrix.c +++ b/keyboards/redox/matrix.c | |||
| @@ -146,7 +146,6 @@ uint8_t _matrix_scan(void) | |||
| 146 | if (matrix_changed) { | 146 | if (matrix_changed) { |
| 147 | debouncing = true; | 147 | debouncing = true; |
| 148 | debouncing_time = timer_read(); | 148 | debouncing_time = timer_read(); |
| 149 | PORTD ^= (1 << 2); | ||
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | # else | 151 | # else |
diff --git a/keyboards/vitamins_included/matrix.c b/keyboards/vitamins_included/matrix.c index 7079a8da9..cf4c1064f 100644 --- a/keyboards/vitamins_included/matrix.c +++ b/keyboards/vitamins_included/matrix.c | |||
| @@ -198,7 +198,6 @@ uint8_t _matrix_scan(void) | |||
| 198 | if (matrix_changed) { | 198 | if (matrix_changed) { |
| 199 | debouncing = true; | 199 | debouncing = true; |
| 200 | debouncing_time = timer_read(); | 200 | debouncing_time = timer_read(); |
| 201 | PORTD ^= (1 << 2); | ||
| 202 | } | 201 | } |
| 203 | 202 | ||
| 204 | # else | 203 | # else |
diff --git a/keyboards/viterbi/matrix.c b/keyboards/viterbi/matrix.c index 5fbae1150..c56b49c5f 100644 --- a/keyboards/viterbi/matrix.c +++ b/keyboards/viterbi/matrix.c | |||
| @@ -146,7 +146,6 @@ uint8_t _matrix_scan(void) | |||
| 146 | if (matrix_changed) { | 146 | if (matrix_changed) { |
| 147 | debouncing = true; | 147 | debouncing = true; |
| 148 | debouncing_time = timer_read(); | 148 | debouncing_time = timer_read(); |
| 149 | PORTD ^= (1 << 2); | ||
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | # else | 151 | # else |
diff --git a/keyboards/zen/matrix.c b/keyboards/zen/matrix.c index 12f22214e..6e274d3ba 100644 --- a/keyboards/zen/matrix.c +++ b/keyboards/zen/matrix.c | |||
| @@ -148,7 +148,6 @@ uint8_t _matrix_scan(void) | |||
| 148 | if (matrix_changed) { | 148 | if (matrix_changed) { |
| 149 | debouncing = true; | 149 | debouncing = true; |
| 150 | debouncing_time = timer_read(); | 150 | debouncing_time = timer_read(); |
| 151 | PORTD ^= (1 << 2); | ||
| 152 | } | 151 | } |
| 153 | 152 | ||
| 154 | # else | 153 | # else |
