]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Fix nyquist (and other splits using D2 in debouncing) (#3067)
authorDanny <nooges@users.noreply.github.com>
Mon, 28 May 2018 22:02:41 +0000 (18:02 -0400)
committerDrashna Jaelre <drashna@live.com>
Mon, 28 May 2018 22:02:41 +0000 (15:02 -0700)
* 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

14 files changed:
keyboards/deltasplit75/matrix.c
keyboards/ergo42/matrix.c
keyboards/fourier/matrix.c
keyboards/handwired/dactyl_manuform/matrix.c
keyboards/iris/matrix.c
keyboards/lets_split/matrix.c
keyboards/levinson/matrix.c
keyboards/nyquist/keymaps/hexwire/keymap.c
keyboards/nyquist/matrix.c
keyboards/nyquist/rules.mk
keyboards/redox/matrix.c
keyboards/vitamins_included/matrix.c
keyboards/viterbi/matrix.c
keyboards/zen/matrix.c

index db84fb02ce57feeefae766c975b072d9e4719ec0..1ac5c5039d86560290b2b70db70000d265cfba5a 100644 (file)
@@ -146,7 +146,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 80d4ce46a85324b2674c6973468255146860d7a3..fc42dd14d9dbd5507405ebe1780adf622de54133 100644 (file)
@@ -151,7 +151,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index ed913f34b4d9200775a4da2502c9dbf6bd640fbe..fdeead7dc70e5def6bdecf647cf8aafd4d5f9b1f 100644 (file)
@@ -149,7 +149,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index c3bfe80423aa77762b3ed12c2db2ed9daea58bc2..904850d4d3cbaa473ba32bb78bb283be94de2507 100644 (file)
@@ -157,7 +157,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 7195fb0eadebaaa11395a34574e5d9650485a56a..217264f2631c4d353a60ca6b5192b2e224f544c8 100644 (file)
@@ -153,7 +153,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index c3bfe80423aa77762b3ed12c2db2ed9daea58bc2..904850d4d3cbaa473ba32bb78bb283be94de2507 100644 (file)
@@ -157,7 +157,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 7195fb0eadebaaa11395a34574e5d9650485a56a..217264f2631c4d353a60ca6b5192b2e224f544c8 100644 (file)
@@ -153,7 +153,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 699cc3de5b6f7ae367b222323a52a1ca1d78f598..40df4bcab4eeea1340a53dfe86614db1a32c9182 100644 (file)
@@ -36,6 +36,7 @@ enum custom_keycodes {
 #define KC_X2 RAISE
 #define KC_X3 LT(_FN3, KC_GRV)
 #define KC_X4 MT(MOD_LSFT, KC_ENT)
+#define KC_BL_S BL_STEP
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
@@ -91,7 +92,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
   //|----+----+----+----+----+----|    |----+----+----+----+----+----|
          ,CPYP,    ,    ,DOWN,LCBR,     RCBR, P1 , P2 , P3 ,MINS,    ,
   //|----+----+----+----+----+----|    |----+----+----+----+----+----|
-         ,    ,    ,    ,    ,    ,     DEL ,    , P0 ,PDOT,    ,
+     BL_S,    ,    ,    ,    ,    ,     DEL ,    , P0 ,PDOT,    ,
   //`----+----+----+----+----+----'    `----+----+----+----+----+----'
   ),
 
index 5fbae1150e75987add1e953aec6fbf9810194734..3cdad4adb8ef24ce74f2ccf556f6435e57c7b2ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright 2017 Danny Nguyen <danny@hexwire.com>
+Copyright 2017 Danny Nguyen <danny@keeb.io>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -31,6 +31,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "config.h"
 #include "timer.h"
 
+#ifdef BACKLIGHT_ENABLE 
+    #include "backlight.h"
+    extern backlight_config_t backlight_config;
+#endif
+
 #ifdef USE_I2C
 #  include "i2c.h"
 #else // USE_SERIAL
@@ -58,6 +63,8 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
 
 #define ERROR_DISCONNECT_COUNT 5
 
+#define SERIAL_LED_ADDR 0x00
+
 #define ROWS_PER_HAND (MATRIX_ROWS/2)
 
 static uint8_t error_count = 0;
@@ -115,12 +122,23 @@ uint8_t matrix_cols(void)
 
 void matrix_init(void)
 {
+#ifdef DISABLE_JTAG
+    // JTAG disable for PORT F. write JTD bit twice within four cycles.
+    MCUCR |= (1<<JTD);
+    MCUCR |= (1<<JTD);
+#endif
+  
     debug_enable = true;
     debug_matrix = true;
     debug_mouse = true;
     // initialize row and col
+#if (DIODE_DIRECTION == COL2ROW)
     unselect_rows();
     init_cols();
+#elif (DIODE_DIRECTION == ROW2COL)
+    unselect_cols();
+    init_rows();
+#endif
 
     TX_RX_LED_INIT;
 
@@ -146,7 +164,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
@@ -196,6 +213,15 @@ int i2c_transaction(void) {
     err = i2c_master_write(0x00);
     if (err) goto i2c_error;
 
+#ifdef BACKLIGHT_ENABLE
+    // Write backlight level for slave to read
+    err = i2c_master_write(backlight_config.enable ? backlight_config.level : 0);
+#else
+    // Write zero, so our byte index is the same
+    err = i2c_master_write(0x00);
+#endif
+    if (err) goto i2c_error;
+
     // Start read
     err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
     if (err) goto i2c_error;
@@ -228,6 +254,11 @@ int serial_transaction(void) {
     for (int i = 0; i < ROWS_PER_HAND; ++i) {
         matrix[slaveOffset+i] = serial_slave_buffer[i];
     }
+
+#ifdef BACKLIGHT_ENABLE
+    // Write backlight level for slave to read
+    serial_master_buffer[SERIAL_LED_ADDR] = backlight_config.enable ? backlight_config.level : 0;
+#endif
     return 0;
 }
 #endif
@@ -268,19 +299,30 @@ void matrix_slave_scan(void) {
     int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
 
 #ifdef USE_I2C
+#ifdef BACKLIGHT_ENABLE
+    // Read backlight level sent from master and update level on slave
+    backlight_set(i2c_slave_buffer[0]);
+#endif
     for (int i = 0; i < ROWS_PER_HAND; ++i) {
-        i2c_slave_buffer[i] = matrix[offset+i];
+        i2c_slave_buffer[i+1] = matrix[offset+i];
     }
 #else // USE_SERIAL
     for (int i = 0; i < ROWS_PER_HAND; ++i) {
         serial_slave_buffer[i] = matrix[offset+i];
     }
+
+#ifdef BACKLIGHT_ENABLE
+    // Read backlight level sent from master and update level on slave
+    backlight_set(serial_master_buffer[SERIAL_LED_ADDR]);
+#endif
 #endif
 }
 
 bool matrix_is_modified(void)
 {
+#if (DEBOUNCING_DELAY > 0)
     if (debouncing) return false;
+#endif
     return true;
 }
 
index 840628e1c5f44259e037216e2610acaa658a52ed..e8f1840418b4fd43e28ff96b244a60728e11eb39 100644 (file)
@@ -58,13 +58,13 @@ EXTRAKEY_ENABLE = yes       # Audio control and System control(+450)
 CONSOLE_ENABLE = no         # Console for debug(+400)
 COMMAND_ENABLE = yes        # Commands for debug and configuration
 NKRO_ENABLE = no            # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE = no      # Enable keyboard backlight functionality
+BACKLIGHT_ENABLE = yes      # Enable keyboard backlight functionality
 MIDI_ENABLE = no            # MIDI controls
 AUDIO_ENABLE = no           # Audio output on port C6
 UNICODE_ENABLE = no         # Unicode
 BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
-RGBLIGHT_ENABLE = no       # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
 USE_I2C = yes
+RGBLIGHT_ENABLE = yes       # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
 # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
 SLEEP_LED_ENABLE = no    # Breathing sleep LED during USB suspend
 
@@ -72,4 +72,4 @@ CUSTOM_MATRIX = yes
 
 LAYOUTS = ortho_5x12
 
-DEFAULT_FOLDER = nyquist/rev1
\ No newline at end of file
+DEFAULT_FOLDER = nyquist/rev2
index 20c0f1d349359de262b33954df6f0e226cb4aef8..1607775bd6c9e10d53ff15fc0606f922888113c4 100644 (file)
@@ -146,7 +146,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 7079a8da93e0065ed7e9fdbe39aaf7a7079e9912..cf4c1064f83ea012437f9db65d9c97fa5ad045b8 100644 (file)
@@ -198,7 +198,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 5fbae1150e75987add1e953aec6fbf9810194734..c56b49c5ff591688242a951ca4faf9bab7494ea2 100644 (file)
@@ -146,7 +146,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else
index 12f22214e1e858a7a731d7ef947caefe92fa3db5..6e274d3bac06ae55b801469fd6c3ae6b3f889010 100644 (file)
@@ -148,7 +148,6 @@ uint8_t _matrix_scan(void)
             if (matrix_changed) {
                 debouncing = true;
                 debouncing_time = timer_read();
-                PORTD ^= (1 << 2);
             }
 
 #       else