summaryrefslogtreecommitdiff
path: root/keyboards/input_club
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-01-10 17:25:34 +1100
committerGitHub <noreply@github.com>2024-01-10 17:25:34 +1100
commit58696a3937c6c2ec2fd1401c7a76d740981afc5c (patch)
tree76dd7e36b6d10280f9579e5ea8c2902b0f20265a /keyboards/input_club
parent7a3183b8c825650fd635b16852166868651041ab (diff)
LED drivers: switch to i2c_writeReg() (#22878)
Diffstat (limited to 'keyboards/input_club')
-rw-r--r--keyboards/input_club/k_type/is31fl3733-dual.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/keyboards/input_club/k_type/is31fl3733-dual.c b/keyboards/input_club/k_type/is31fl3733-dual.c
index b4528b5a6f..ade8af802f 100644
--- a/keyboards/input_club/k_type/is31fl3733-dual.c
+++ b/keyboards/input_club/k_type/is31fl3733-dual.c
@@ -60,8 +60,6 @@
# define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE
#endif
-uint8_t i2c_transfer_buffer[20];
-
// These buffers match the IS31FL3733 PWM registers.
// The control buffers match the page 0 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers.
@@ -75,15 +73,12 @@ uint8_t g_led_control_registers[IS31FL3733_DRIVER_COUNT][IS31FL3733_LED_CONTROL_
bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT] = {false};
void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
- i2c_transfer_buffer[0] = reg;
- i2c_transfer_buffer[1] = data;
-
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
- if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
+ if (i2c_writeReg(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == 0) break;
}
#else
- i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
+ i2c_writeReg(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
#endif
}
@@ -95,24 +90,15 @@ void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page) {
void is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer) {
// Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes.
- // i2c_transfer_buffer[] is 20 bytes
// Iterate over the pwm_buffer contents at 16 byte intervals.
for (int i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) {
- i2c_transfer_buffer[0] = i;
- // Copy the data from i to i+15.
- // Device will auto-increment register for data after the first byte
- // Thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer.
- for (int j = 0; j < 16; j++) {
- i2c_transfer_buffer[1 + j] = pwm_buffer[i + j];
- }
-
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
- if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) == 0) break;
+ if (i2c_writeReg(index, addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT) == 0) break;
}
#else
- i2c_transmit(index, addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT);
+ i2c_writeReg(index, addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT);
#endif
}
}