Iris send backlight info over i2c
This commit is contained in:
parent
7d8a20b07f
commit
ac642de9d7
@ -208,6 +208,15 @@ int i2c_transaction(void) {
|
|||||||
err = i2c_master_write(0x00);
|
err = i2c_master_write(0x00);
|
||||||
if (err) goto i2c_error;
|
if (err) goto i2c_error;
|
||||||
|
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
// Write backlight level for slave to read
|
||||||
|
err = i2c_master_write(get_backlight_level());
|
||||||
|
#else
|
||||||
|
// Write zero, so our byte index is the same
|
||||||
|
err = i2c_master_write(0x00);
|
||||||
|
#endif
|
||||||
|
if (err) goto i2c_error;
|
||||||
|
|
||||||
// Start read
|
// Start read
|
||||||
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
|
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
|
||||||
if (err) goto i2c_error;
|
if (err) goto i2c_error;
|
||||||
@ -285,8 +294,12 @@ void matrix_slave_scan(void) {
|
|||||||
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
|
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
|
||||||
|
|
||||||
#ifdef USE_I2C
|
#ifdef USE_I2C
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
// Read backlight level sent from master and update level on slave
|
||||||
|
backlight_set(i2c_slave_buffer[0]);
|
||||||
|
#endif
|
||||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
i2c_slave_buffer[i] = matrix[offset+i];
|
i2c_slave_buffer[i+1] = matrix[offset+i];
|
||||||
}
|
}
|
||||||
#else // USE_SERIAL
|
#else // USE_SERIAL
|
||||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user