diff options
| author | Len Trigg <lenbok@gmail.com> | 2019-03-16 09:46:49 +1300 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-03-15 13:46:49 -0700 |
| commit | 9c4424ae2cd86002cd2f4140eff7108212ef884e (patch) | |
| tree | 02885c02070df4a3f7ee0feb36a28123faf425f0 /quantum/split_common | |
| parent | fabdb3c4e8ce4659539a2b0fa4cafc56a07d6c2d (diff) | |
| download | qmk_firmware-9c4424ae2cd86002cd2f4140eff7108212ef884e.tar.gz qmk_firmware-9c4424ae2cd86002cd2f4140eff7108212ef884e.zip | |
rgblight split transfer non-eeprom config (#5396)
* Make rgblight_update_dword not update eeprom (we already have
eeconfig_update_rgblight for that).
Make split i2c keyboards transfer active rgblight config rather than
eeprom saved version of rgblight config, enabling runtime changes
that aren't persisted to eeprom.
* prev_level and prev_rgb only store successfully transmitted values
Diffstat (limited to 'quantum/split_common')
| -rw-r--r-- | quantum/split_common/transport.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index b16852bc1..3696a2aba 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c | |||
| @@ -39,17 +39,19 @@ bool transport_master(matrix_row_t matrix[]) { | |||
| 39 | static uint8_t prev_level = ~0; | 39 | static uint8_t prev_level = ~0; |
| 40 | uint8_t level = get_backlight_level(); | 40 | uint8_t level = get_backlight_level(); |
| 41 | if (level != prev_level) { | 41 | if (level != prev_level) { |
| 42 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIT_START, (void *)&level, sizeof(level), TIMEOUT); | 42 | if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) { |
| 43 | prev_level = level; | 43 | prev_level = level; |
| 44 | } | ||
| 44 | } | 45 | } |
| 45 | # endif | 46 | # endif |
| 46 | 47 | ||
| 47 | # ifdef RGBLIGHT_ENABLE | 48 | # ifdef RGBLIGHT_ENABLE |
| 48 | static uint32_t prev_rgb = ~0; | 49 | static uint32_t prev_rgb = ~0; |
| 49 | uint32_t rgb = eeconfig_read_rgblight(); | 50 | uint32_t rgb = rgblight_read_dword(); |
| 50 | if (rgb != prev_rgb) { | 51 | if (rgb != prev_rgb) { |
| 51 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgb, sizeof(rgb), TIMEOUT); | 52 | if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgb, sizeof(rgb), TIMEOUT) >= 0) { |
| 52 | prev_rgb = rgb; | 53 | prev_rgb = rgb; |
| 54 | } | ||
| 53 | } | 55 | } |
| 54 | # endif | 56 | # endif |
| 55 | 57 | ||
