summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez
diff options
context:
space:
mode:
authorErez Zukerman <bulk@ezuk.org>2018-05-24 09:18:36 -0400
committerErez Zukerman <bulk@ezuk.org>2018-05-24 09:18:36 -0400
commitc0095710a7c7e9bd94aa9f4dd814dc28d718c731 (patch)
treef5fc14eacf5b61f7ad103272578c757a171b78a6 /keyboards/ergodox_ez
parent682555faac8a67deff5688b956165cd1c39389cb (diff)
a failed attempt at hot-plugging
Diffstat (limited to 'keyboards/ergodox_ez')
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.c13
-rw-r--r--keyboards/ergodox_ez/matrix.c6
2 files changed, 12 insertions, 7 deletions
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
index 36eb58a3c7..b393d73d7e 100644
--- a/keyboards/ergodox_ez/ergodox_ez.c
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -112,11 +112,14 @@ uint8_t init_mcp23018(void) {
// uint8_t sreg_prev;
// sreg_prev=SREG;
// cli();
- if (i2c_initialized == 0) {
- i2c_init(); // on pins D(1,0)
- i2c_initialized = true;
- _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
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c
index 2aad997817..6660af46a4 100644
--- a/keyboards/ergodox_ez/matrix.c
+++ b/keyboards/ergodox_ez/matrix.c
@@ -68,7 +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 uint8_t mcp23018_reset_loop;
+static uint16_t mcp23018_reset_loop;
#ifdef DEBUG_MATRIX_SCAN_RATE
uint32_t matrix_timer;
@@ -175,7 +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 == 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");