]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - keyboards/ergodox_ez/matrix.c
i2c fix
[qmk_firmware.git] / keyboards / ergodox_ez / matrix.c
index f0550e9b885e67858ba9558a8f640aea078dd690..2aad997817901105dd71108df5e9798564c6fe3f 100644 (file)
@@ -34,7 +34,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "util.h"
 #include "matrix.h"
 #include QMK_KEYBOARD_H
-#include "i2cmaster.h"
 #ifdef DEBUG_MATRIX_SCAN_RATE
 #include  "timer.h"
 #endif
@@ -297,7 +296,7 @@ static matrix_row_t read_cols(uint8_t row)
             mcp23018_status = i2c_start(I2C_ADDR_WRITE);    if (mcp23018_status) goto out;
             mcp23018_status = i2c_write(GPIOB);             if (mcp23018_status) goto out;
             mcp23018_status = i2c_start(I2C_ADDR_READ);     if (mcp23018_status) goto out;
-            data = i2c_readNak();
+            data = i2c_read_nack();
             data = ~data;
         out:
             i2c_stop();
@@ -326,17 +325,9 @@ static matrix_row_t read_cols(uint8_t row)
  */
 static void unselect_rows(void)
 {
-    // unselect on mcp23018
-    if (mcp23018_status) { // if there was an error
-        // do nothing
-    } else {
-        // set all rows hi-Z : 1
-        mcp23018_status = i2c_start(I2C_ADDR_WRITE);    if (mcp23018_status) goto out;
-        mcp23018_status = i2c_write(GPIOA);             if (mcp23018_status) goto out;
-        mcp23018_status = i2c_write(0xFF);              if (mcp23018_status) goto out;
-    out:
-        i2c_stop();
-    }
+    // no need to unselect on mcp23018, because the select step sets all
+    // the other row bits high, and it's not changing to a different
+    // direction
 
     // unselect on teensy
     // Hi-Z(DDR:0, PORT:0) to unselect