]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
revert some attempts, update i2c
authorJack Humbert <jack.humb@gmail.com>
Tue, 12 Jun 2018 18:27:22 +0000 (14:27 -0400)
committerJack Humbert <jack.humb@gmail.com>
Tue, 12 Jun 2018 18:27:22 +0000 (14:27 -0400)
drivers/avr/i2c_master.c
keyboards/ergodox_ez/config.h
keyboards/ergodox_ez/ergodox_ez.c
keyboards/ergodox_ez/matrix.c

index bcf92153c5c89399e4a05e51f67f1bcdaa56e90f..cd3c2e1c810fff513502c8836a8255eb78b1425c 100755 (executable)
@@ -21,7 +21,7 @@ void i2c_init(void)
 uint8_t i2c_start(uint8_t address)
 {
        // reset TWI control register
-       //TWCR = 0;
+       TWCR = 0;
        // transmit START condition
        TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
        // wait for end of transmission
index 3dfe8733cb71815fe97b9682c10860e87643500c..1285cbe1c9752c8cc76fda9ff173766ad909d9d8 100644 (file)
@@ -81,10 +81,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* fix space cadet rollover issue */
 #define DISABLE_SPACE_CADET_ROLLOVER
 
-// #define RGB_MIDI
-#define RGBW_BB_TWI
+// #define RGBW_BB_TWI
 
-#define RGBW 1
+// #define RGBW 1
 
 /* "debounce" is measured in keyboard scans. Some users reported
  * needing values as high as 15, which was at the time around 50ms.
index b393d73d7e854b1aba504111a5d6ab18219efd1a..3a2d1273fabe0ce0cff028286a88fd71faaff0c5 100644 (file)
@@ -113,13 +113,13 @@ uint8_t init_mcp23018(void) {
     // sreg_prev=SREG;
     // cli();
 
-    // if (i2c_initialized == 0) {
-    //     i2c_init();  // on pins D(1,0)
-    //     i2c_initialized = true;
-    //     _delay_ms(1000);
-    // }
-    i2c_init(); // on pins D(1,0)
-    _delay_ms(1000);
+    if (i2c_initialized == 0) {
+        i2c_init();  // on pins D(1,0)
+        i2c_initialized = true;
+        _delay_ms(1000);
+    }
+    // i2c_init(); // on pins D(1,0)
+    // _delay_ms(1000);
 
     // set pin direction
     // - unused  : input  : 1
index 6660af46a438476431bc9034a6f9bd35dc3380a3..8b117166fb366b9d835f426f1b466a3cbca494bf 100644 (file)
@@ -68,8 +68,8 @@ static void init_cols(void);
 static void unselect_rows(void);
 static void select_row(uint8_t row);
 
-// static uint8_t mcp23018_reset_loop;
-static uint16_t mcp23018_reset_loop;
+static uint8_t mcp23018_reset_loop;
+// static uint16_t mcp23018_reset_loop;
 
 #ifdef DEBUG_MATRIX_SCAN_RATE
 uint32_t matrix_timer;
@@ -176,8 +176,8 @@ void debounce_report(matrix_row_t change, uint8_t row) {
 uint8_t matrix_scan(void)
 {
     if (mcp23018_status) { // if there was an error
-        // if (++mcp23018_reset_loop == 0) {
-        if (++mcp23018_reset_loop >= 1300) {
+        if (++mcp23018_reset_loop == 0) {
+        // if (++mcp23018_reset_loop >= 1300) {
             // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans
             // this will be approx bit more frequent than once per second
             print("trying to reset mcp23018\n");