diff options
| author | QMK Bot <hello@qmk.fm> | 2021-01-12 12:34:34 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2021-01-12 12:34:34 +0000 |
| commit | d96463ce12d148262bc6351b173ca8ffcbf98ee5 (patch) | |
| tree | cdb92ef00f97fe88234bd3f1500d0f3ecf9f1f14 /keyboards/moonlander | |
| parent | 9b9012767c20fe107d44d9c1b858e97cc243f344 (diff) | |
| parent | 16d43af49392e4cd26b4399042da54e62baaf6ff (diff) | |
| download | qmk_firmware-d96463ce12d148262bc6351b173ca8ffcbf98ee5.tar.gz qmk_firmware-d96463ce12d148262bc6351b173ca8ffcbf98ee5.zip | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/moonlander')
| -rw-r--r-- | keyboards/moonlander/matrix.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/keyboards/moonlander/matrix.c b/keyboards/moonlander/matrix.c index f5c49b4d5..566f8bb1b 100644 --- a/keyboards/moonlander/matrix.c +++ b/keyboards/moonlander/matrix.c | |||
| @@ -82,14 +82,14 @@ void mcp23018_init(void) { | |||
| 82 | mcp23018_tx[2] = 0b00111111; // B is inputs | 82 | mcp23018_tx[2] = 0b00111111; // B is inputs |
| 83 | 83 | ||
| 84 | if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { | 84 | if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { |
| 85 | printf("error hori\n"); | 85 | dprintf("error hori\n"); |
| 86 | } else { | 86 | } else { |
| 87 | mcp23018_tx[0] = 0x0C; // GPPUA | 87 | mcp23018_tx[0] = 0x0C; // GPPUA |
| 88 | mcp23018_tx[1] = 0b10000000; // A is not pulled-up | 88 | mcp23018_tx[1] = 0b10000000; // A is not pulled-up |
| 89 | mcp23018_tx[2] = 0b11111111; // B is pulled-up | 89 | mcp23018_tx[2] = 0b11111111; // B is pulled-up |
| 90 | 90 | ||
| 91 | if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { | 91 | if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { |
| 92 | printf("error hori\n"); | 92 | dprintf("error hori\n"); |
| 93 | } else { | 93 | } else { |
| 94 | mcp23018_initd = is_launching = true; | 94 | mcp23018_initd = is_launching = true; |
| 95 | } | 95 | } |
| @@ -97,7 +97,7 @@ void mcp23018_init(void) { | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | void matrix_init(void) { | 99 | void matrix_init(void) { |
| 100 | printf("matrix init\n"); | 100 | dprintf("matrix init\n"); |
| 101 | // debug_matrix = true; | 101 | // debug_matrix = true; |
| 102 | 102 | ||
| 103 | // outputs | 103 | // outputs |
| @@ -205,7 +205,7 @@ uint8_t matrix_scan(void) { | |||
| 205 | mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row | 205 | mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row |
| 206 | 206 | ||
| 207 | if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { | 207 | if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { |
| 208 | printf("error hori\n"); | 208 | dprintf("error hori\n"); |
| 209 | mcp23018_initd = false; | 209 | mcp23018_initd = false; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| @@ -213,7 +213,7 @@ uint8_t matrix_scan(void) { | |||
| 213 | 213 | ||
| 214 | mcp23018_tx[0] = 0x13; // GPIOB | 214 | mcp23018_tx[0] = 0x13; // GPIOB |
| 215 | if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, I2C_TIMEOUT)) { | 215 | if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, I2C_TIMEOUT)) { |
| 216 | printf("error vert\n"); | 216 | dprintf("error vert\n"); |
| 217 | mcp23018_initd = false; | 217 | mcp23018_initd = false; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| @@ -255,17 +255,17 @@ bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); | |||
| 255 | matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } | 255 | matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } |
| 256 | 256 | ||
| 257 | void matrix_print(void) { | 257 | void matrix_print(void) { |
| 258 | printf("\nr/c 01234567\n"); | 258 | dprintf("\nr/c 01234567\n"); |
| 259 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | 259 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { |
| 260 | printf("%X0: ", row); | 260 | dprintf("%X0: ", row); |
| 261 | matrix_row_t data = matrix_get_row(row); | 261 | matrix_row_t data = matrix_get_row(row); |
| 262 | for (int col = 0; col < MATRIX_COLS; col++) { | 262 | for (int col = 0; col < MATRIX_COLS; col++) { |
| 263 | if (data & (1 << col)) | 263 | if (data & (1 << col)) |
| 264 | printf("1"); | 264 | dprintf("1"); |
| 265 | else | 265 | else |
| 266 | printf("0"); | 266 | dprintf("0"); |
| 267 | } | 267 | } |
| 268 | printf("\n"); | 268 | dprintf("\n"); |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| 271 | 271 | ||
