diff options
author | Joe DeVivo <joe@devivo.com> | 2017-12-29 09:09:54 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-01-23 14:29:13 -0500 |
commit | ac642de9d7560fdd994790288a81163a410a601e (patch) | |
tree | 9ba2a7f84bc77a69087f0ddfdfb6ffe0daf682c7 | |
parent | 7d8a20b07f31309bc41de69583839058040c55b9 (diff) | |
download | qmk_firmware-ac642de9d7560fdd994790288a81163a410a601e.tar.gz qmk_firmware-ac642de9d7560fdd994790288a81163a410a601e.zip |
Iris send backlight info over i2c
-rw-r--r-- | keyboards/iris/matrix.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/keyboards/iris/matrix.c b/keyboards/iris/matrix.c index b83311ce1..3d8d2adb8 100644 --- a/keyboards/iris/matrix.c +++ b/keyboards/iris/matrix.c | |||
@@ -208,6 +208,15 @@ int i2c_transaction(void) { | |||
208 | err = i2c_master_write(0x00); | 208 | err = i2c_master_write(0x00); |
209 | if (err) goto i2c_error; | 209 | if (err) goto i2c_error; |
210 | 210 | ||
211 | #ifdef BACKLIGHT_ENABLE | ||
212 | // Write backlight level for slave to read | ||
213 | err = i2c_master_write(get_backlight_level()); | ||
214 | #else | ||
215 | // Write zero, so our byte index is the same | ||
216 | err = i2c_master_write(0x00); | ||
217 | #endif | ||
218 | if (err) goto i2c_error; | ||
219 | |||
211 | // Start read | 220 | // Start read |
212 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | 221 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); |
213 | if (err) goto i2c_error; | 222 | if (err) goto i2c_error; |
@@ -285,8 +294,12 @@ void matrix_slave_scan(void) { | |||
285 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | 294 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; |
286 | 295 | ||
287 | #ifdef USE_I2C | 296 | #ifdef USE_I2C |
297 | #ifdef BACKLIGHT_ENABLE | ||
298 | // Read backlight level sent from master and update level on slave | ||
299 | backlight_set(i2c_slave_buffer[0]); | ||
300 | #endif | ||
288 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 301 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
289 | i2c_slave_buffer[i] = matrix[offset+i]; | 302 | i2c_slave_buffer[i+1] = matrix[offset+i]; |
290 | } | 303 | } |
291 | #else // USE_SERIAL | 304 | #else // USE_SERIAL |
292 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 305 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |