summaryrefslogtreecommitdiff
path: root/keyboards/dc01/left
diff options
context:
space:
mode:
authorAlex Ong <the.onga@gmail.com>2019-01-04 19:39:14 +1100
committerAlex Ong <the.onga@gmail.com>2019-01-04 19:39:14 +1100
commit47c91fc7f75ae0a477e55b687aa0fc30da0a283c (patch)
tree65ad39452748ff2e6d4a83ce54ede6ca22c9ada9 /keyboards/dc01/left
parentac9b88e8ccbbf38762871504cd827ff0d941c426 (diff)
parent563ce3f225d981ce460c12ca5130dfe47af41df0 (diff)
Merge branch 'master' of https://github.com/qmk/qmk_firmware
Diffstat (limited to 'keyboards/dc01/left')
-rw-r--r--keyboards/dc01/left/config.h2
-rw-r--r--keyboards/dc01/left/matrix.c41
2 files changed, 15 insertions, 28 deletions
diff --git a/keyboards/dc01/left/config.h b/keyboards/dc01/left/config.h
index 68484d8355..e3d49404ea 100644
--- a/keyboards/dc01/left/config.h
+++ b/keyboards/dc01/left/config.h
@@ -46,6 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { F4, F1, F0, F7, F6, F5 }
#define UNUSED_PINS
+#define F_SCL 300000UL
+
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/dc01/left/matrix.c b/keyboards/dc01/left/matrix.c
index 7923766359..806583580d 100644
--- a/keyboards/dc01/left/matrix.c
+++ b/keyboards/dc01/left/matrix.c
@@ -43,7 +43,7 @@ static uint8_t error_count_arrow = 0;
/* Set 0 if debouncing isn't needed */
#ifndef DEBOUNCING_DELAY
-# define DEBOUNCING_DELAY 5
+# define DEBOUNCING_DELAY 5
#endif
#if (DEBOUNCING_DELAY > 0)
@@ -135,10 +135,7 @@ uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
-
i2c_status_t i2c_transaction(uint8_t address, uint32_t mask, uint8_t col_offset);
-//uint8_t i2c_transaction_numpad(void);
-//uint8_t i2c_transaction_arrow(void);
//this replases tmk code
void matrix_setup(void){
@@ -220,7 +217,7 @@ uint8_t matrix_scan(void)
matrix[i] &= 0x3F; //mask bits to keep
}
}
- }else{ //no error
+ }else{ //no error
error_count_right = 0;
}
@@ -440,40 +437,28 @@ static void unselect_cols(void)
// Complete rows from other modules over i2c
i2c_status_t i2c_transaction(uint8_t address, uint32_t mask, uint8_t col_offset) {
i2c_status_t err = i2c_start((address << 1) | I2C_WRITE, 10);
- if (err) return err;
- i2c_write(0x01, 10);
- if (err) return err;
+ i2c_write(0x01, 10); //request data in address 1
- i2c_start((address << 1) | I2C_READ, 10);
- if (err) return err;
+ i2c_start((address << 1) | I2C_READ, 5);
err = i2c_read_ack(10);
if (err == 0x55) { //synchronization byte
- for (uint8_t i = 0; i < MATRIX_ROWS-1 ; i++) { //assemble slave matrix in main matrix
- matrix[i] &= mask; //mask bits to keep
- err = i2c_read_ack(10);
- if (err >= 0) {
- matrix[i] |= ((uint32_t)err << (MATRIX_COLS_SCANNED + col_offset)); //add new bits at the end
- } else {
- return err;
- }
- }
- //last read request must be followed by a NACK
- matrix[MATRIX_ROWS - 1] &= mask; //mask bits to keep
- err = i2c_read_nack(10);
- if (err >= 0) {
+ for (uint8_t i = 0; i < MATRIX_ROWS-1 ; i++) { //assemble slave matrix in main matrix
+ matrix[i] &= mask; //mask bits to keep
+ err = i2c_read_ack(10);
+ matrix[i] |= ((uint32_t)err << (MATRIX_COLS_SCANNED + col_offset)); //add new bits at the end
+ }
+ //last read request must be followed by a NACK
+ matrix[MATRIX_ROWS - 1] &= mask; //mask bits to keep
+ err = i2c_read_nack(10);
matrix[MATRIX_ROWS - 1] |= ((uint32_t)err << (MATRIX_COLS_SCANNED + col_offset)); //add new bits at the end
- } else {
- return err;
- }
+
} else {
i2c_stop(10);
return 1;
}
i2c_stop(10);
- if (err) return err;
-
return 0;
} \ No newline at end of file