diff options
author | James Churchill <pelrun@gmail.com> | 2019-03-12 18:23:28 +0100 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-03-12 18:23:28 +0100 |
commit | 37932c293c15011f883a91e91ee02631ead44a2e (patch) | |
tree | f1b4b3b44f816240b06580658b42b3646f121025 /keyboards/gergo | |
parent | 25bb059e4e42ed2637202230ff3d8b765e1295cd (diff) | |
download | qmk_firmware-37932c293c15011f883a91e91ee02631ead44a2e.tar.gz qmk_firmware-37932c293c15011f883a91e91ee02631ead44a2e.tar.xz |
Next set of split_common changes (#4974)
* Update split_common to use standard i2c drivers
* Eliminate RGB_DIRTY/BACKLIT_DIRTY
* Fix avr i2c_master error handling
* Fix i2c_slave addressing
* Remove unneeded timeout on i2c_stop()
* Fix RGB I2C transfers
* Remove incorrect comment
Diffstat (limited to 'keyboards/gergo')
-rw-r--r-- | keyboards/gergo/gergo.c | 4 | ||||
-rw-r--r-- | keyboards/gergo/matrix.c | 36 |
2 files changed, 20 insertions, 20 deletions
diff --git a/keyboards/gergo/gergo.c b/keyboards/gergo/gergo.c index d32792e2a..cc0bef391 100644 --- a/keyboards/gergo/gergo.c +++ b/keyboards/gergo/gergo.c @@ -47,7 +47,7 @@ uint8_t init_mcp23018(void) { mcp23018_status = i2c_write(IODIRA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; mcp23018_status = i2c_write(0b10000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; mcp23018_status = i2c_write(0b11111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - i2c_stop(ERGODOX_EZ_I2C_TIMEOUT); + i2c_stop(); // set pull-up // - unused : on : 1 @@ -59,7 +59,7 @@ uint8_t init_mcp23018(void) { mcp23018_status = i2c_write(0b11111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; out: - i2c_stop(ERGODOX_EZ_I2C_TIMEOUT); + i2c_stop(); // SREG=sreg_prev; //uprintf("Init %x\n", mcp23018_status); return mcp23018_status; diff --git a/keyboards/gergo/matrix.c b/keyboards/gergo/matrix.c index 29fe48ccb..9886ecf15 100644 --- a/keyboards/gergo/matrix.c +++ b/keyboards/gergo/matrix.c @@ -72,14 +72,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //Trackball pin defs #define TRKUP (1<<4) #define TRKDN (1<<5) -#define TRKLT (1<<6) +#define TRKLT (1<<6) #define TRKRT (1<<7) #define TRKBTN (1<<6) // Multiple for mouse moves #ifndef TRKSTEP -#define TRKSTEP 20 +#define TRKSTEP 20 #endif // multiple for mouse scroll @@ -98,13 +98,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // Trackball interrupts accumulate over here. Processed on scan // Stores prev state of mouse, high bits store direction -uint8_t trkState = 0; -uint8_t trkBtnState = 0; +uint8_t trkState = 0; +uint8_t trkBtnState = 0; -volatile uint8_t tbUpCnt = 0; -volatile uint8_t tbDnCnt = 0; -volatile uint8_t tbLtCnt = 0; -volatile uint8_t tbRtCnt = 0; +volatile uint8_t tbUpCnt = 0; +volatile uint8_t tbDnCnt = 0; +volatile uint8_t tbLtCnt = 0; +volatile uint8_t tbRtCnt = 0; /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; @@ -240,14 +240,14 @@ uint8_t matrix_scan(void) // First we handle the mouse inputs #ifdef BALLER uint8_t pBtn = PINE & TRKBTN; - + #ifdef DEBUG_BALLER - // Compare to previous, mod report + // Compare to previous, mod report if (tbUpCnt + tbDnCnt + tbLtCnt + tbRtCnt != 0) xprintf("U: %d D: %d L: %d R: %d B: %d\n", tbUpCnt, tbDnCnt, tbLtCnt, tbRtCnt, (trkBtnState >> 6)); #endif - // Modify the report + // Modify the report report_mouse_t pRprt = pointing_device_get_report(); // Scroll by default, move on layer @@ -264,7 +264,7 @@ uint8_t matrix_scan(void) } #ifdef DEBUG_BALLER - if (pRprt.x != 0 || pRprt.y != 0) + if (pRprt.x != 0 || pRprt.y != 0) xprintf("X: %d Y: %d\n", pRprt.x, pRprt.y); #endif @@ -272,7 +272,7 @@ uint8_t matrix_scan(void) if ((pBtn != trkBtnState) && ((pBtn >> 6) == 1)) pRprt.buttons &= ~MOUSE_BTN1; // Save state, push update - if (pRprt.x != 0 || pRprt.y != 0 || pRprt.h != 0 || pRprt.v != 0 || (trkBtnState != pBtn)) + if (pRprt.x != 0 || pRprt.y != 0 || pRprt.h != 0 || pRprt.v != 0 || (trkBtnState != pBtn)) pointing_device_set_report(pRprt); trkBtnState = pBtn; @@ -325,8 +325,8 @@ uint8_t matrix_scan(void) enableInterrupts(); #ifdef DEBUG_MATRIX - for (uint8_t c = 0; c < MATRIX_COLS; c++) - for (uint8_t r = 0; r < MATRIX_ROWS; r++) + for (uint8_t c = 0; c < MATRIX_COLS; c++) + for (uint8_t r = 0; r < MATRIX_ROWS; r++) if (matrix_is_on(r, c)) xprintf("r:%d c:%d \n", r, c); #endif @@ -394,7 +394,7 @@ static matrix_row_t read_cols(uint8_t row) data = ~((uint8_t)mcp23018_status); mcp23018_status = I2C_STATUS_SUCCESS; out: - i2c_stop(ERGODOX_EZ_I2C_TIMEOUT); + i2c_stop(); #ifdef DEBUG_MATRIX if (data != 0x00) xprintf("I2C: %d\n", data); @@ -439,12 +439,12 @@ static void select_row(uint8_t row) if (row < 7) { // select on mcp23018 if (mcp23018_status) { // do nothing on error - } else { // set active row low : 0 // set other rows hi-Z : 1 + } else { // set active row low : 0 // set other rows hi-Z : 1 mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; mcp23018_status = i2c_write(GPIOA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; mcp23018_status = i2c_write(0xFF & ~(1<<row), ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; out: - i2c_stop(ERGODOX_EZ_I2C_TIMEOUT); + i2c_stop(); } } else { // Output low(DDR:1, PORT:0) to select |