mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-04 12:55:44 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
e62252fbf6
@ -28,8 +28,7 @@
|
||||
# define IS31FL3218_I2C_PERSISTENCE 0
|
||||
#endif
|
||||
|
||||
// Reusable buffer for transfers
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
|
||||
uint8_t g_pwm_buffer[IS31FL3218_PWM_REGISTER_COUNT];
|
||||
@ -39,27 +38,27 @@ uint8_t g_led_control_registers[IS31FL3218_LED_CONTROL_REGISTER_COUNT] = {0};
|
||||
bool g_led_control_registers_update_required = false;
|
||||
|
||||
void is31fl3218_write_register(uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
#if IS31FL3218_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT);
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) {
|
||||
g_twi_transfer_buffer[0] = IS31FL3218_REG_PWM;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer, 18);
|
||||
i2c_transfer_buffer[0] = IS31FL3218_REG_PWM;
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer, 18);
|
||||
|
||||
#if IS31FL3218_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
}
|
||||
#else
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,7 @@
|
||||
# define IS31FL3218_I2C_PERSISTENCE 0
|
||||
#endif
|
||||
|
||||
// Reusable buffer for transfers
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
|
||||
uint8_t g_pwm_buffer[IS31FL3218_PWM_REGISTER_COUNT];
|
||||
@ -39,27 +38,27 @@ uint8_t g_led_control_registers[IS31FL3218_LED_CONTROL_REGISTER_COUNT] = {0};
|
||||
bool g_led_control_registers_update_required = false;
|
||||
|
||||
void is31fl3218_write_register(uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
#if IS31FL3218_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT);
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 2, IS31FL3218_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) {
|
||||
g_twi_transfer_buffer[0] = IS31FL3218_REG_PWM;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer, 18);
|
||||
i2c_transfer_buffer[0] = IS31FL3218_REG_PWM;
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer, 18);
|
||||
|
||||
#if IS31FL3218_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
}
|
||||
#else
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, g_twi_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
i2c_transmit(IS31FL3218_I2C_ADDRESS << 1, i2c_transfer_buffer, 19, IS31FL3218_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,7 @@
|
||||
# define IS31FL3731_I2C_PERSISTENCE 0
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
|
||||
// Storing them like this is optimal for I2C transfers to the registers.
|
||||
@ -48,17 +47,17 @@ uint8_t g_led_control_registers[IS31FL3731_DRIVER_COUNT][IS31FL3731_LED_CONTROL_
|
||||
bool g_led_control_registers_update_required[IS31FL3731_DRIVER_COUNT] = {false};
|
||||
|
||||
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3731_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3731_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT) == 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -70,23 +69,23 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// assumes page 0 is already selected
|
||||
|
||||
// transmit PWM registers in 9 transfers of 16 bytes
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// iterate over the pwm_buffer contents at 16 byte intervals
|
||||
for (int i = 0; i < IS31FL3731_PWM_REGISTER_COUNT; i += 16) {
|
||||
// set the first register, e.g. 0x24, 0x34, 0x44, etc.
|
||||
g_twi_transfer_buffer[0] = 0x24 + i;
|
||||
i2c_transfer_buffer[0] = 0x24 + i;
|
||||
// copy the data from i to i+15
|
||||
// device will auto-increment register for data after the first byte
|
||||
// thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3731_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3731_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@
|
||||
# define IS31FL3731_I2C_PERSISTENCE 0
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
|
||||
// Storing them like this is optimal for I2C transfers to the registers.
|
||||
@ -47,15 +46,15 @@ uint8_t g_led_control_registers[IS31FL3731_DRIVER_COUNT][IS31FL3731_LED_CONTROL_
|
||||
bool g_led_control_registers_update_required[IS31FL3731_DRIVER_COUNT] = {false};
|
||||
|
||||
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3731_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3731_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3731_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -67,23 +66,23 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// assumes page 0 is already selected
|
||||
|
||||
// transmit PWM registers in 9 transfers of 16 bytes
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// iterate over the pwm_buffer contents at 16 byte intervals
|
||||
for (int i = 0; i < IS31FL3731_PWM_REGISTER_COUNT; i += 16) {
|
||||
// set the first register, e.g. 0x24, 0x34, 0x44, etc.
|
||||
g_twi_transfer_buffer[0] = 0x24 + i;
|
||||
i2c_transfer_buffer[0] = 0x24 + i;
|
||||
// copy the data from i to i+15
|
||||
// device will auto-increment register for data after the first byte
|
||||
// thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3731_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3731_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3731_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -63,8 +63,7 @@
|
||||
# define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3733 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -80,17 +79,17 @@ bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT]
|
||||
|
||||
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
// If the transaction fails function returns false.
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = 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(addr << 1, g_twi_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -106,24 +105,24 @@ bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// Assumes page 1 is already selected.
|
||||
// If any of the transactions fails function returns false.
|
||||
// Transmit PWM registers in 12 transfers of 16 bytes.
|
||||
// g_twi_transfer_buffer[] is 20 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) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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.
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3733_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -62,8 +62,7 @@
|
||||
# define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3733 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -79,17 +78,17 @@ bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT]
|
||||
|
||||
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
// If the transaction fails function returns false.
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = 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(addr << 1, g_twi_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -105,24 +104,24 @@ bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// Assumes page 1 is already selected.
|
||||
// If any of the transactions fails function returns false.
|
||||
// Transmit PWM registers in 12 transfers of 16 bytes.
|
||||
// g_twi_transfer_buffer[] is 20 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) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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.
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3733_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -47,8 +47,7 @@
|
||||
# define IS31FL3736_GLOBAL_CURRENT 0xFF
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3736 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -63,15 +62,15 @@ uint8_t g_led_control_registers[IS31FL3736_DRIVER_COUNT][IS31FL3736_LED_CONTROL_
|
||||
bool g_led_control_registers_update_required[IS31FL3736_DRIVER_COUNT] = {false};
|
||||
|
||||
void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3736_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3736_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -84,22 +83,22 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// assumes page 1 is already selected
|
||||
|
||||
// transmit PWM registers in 12 transfers of 16 bytes
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// iterate over the pwm_buffer contents at 16 byte intervals
|
||||
for (int i = 0; i < IS31FL3736_PWM_REGISTER_COUNT; i += 16) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3736_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3736_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,7 @@
|
||||
# define IS31FL3736_GLOBAL_CURRENT 0xFF
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3736 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -63,15 +62,15 @@ uint8_t g_led_control_registers[IS31FL3736_DRIVER_COUNT][IS31FL3736_LED_CONTROL_
|
||||
bool g_led_control_registers_update_required[IS31FL3736_DRIVER_COUNT] = {false};
|
||||
|
||||
void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3736_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3736_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3736_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -84,22 +83,22 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// assumes page 1 is already selected
|
||||
|
||||
// transmit PWM registers in 12 transfers of 16 bytes
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// iterate over the pwm_buffer contents at 16 byte intervals
|
||||
for (int i = 0; i < IS31FL3736_PWM_REGISTER_COUNT; i += 16) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3736_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3736_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3736_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,7 @@
|
||||
# define IS31FL3737_GLOBAL_CURRENT 0xFF
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3737 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -66,15 +65,15 @@ uint8_t g_led_control_registers[IS31FL3737_DRIVER_COUNT][IS31FL3737_LED_CONTROL_
|
||||
bool g_led_control_registers_update_required[IS31FL3737_DRIVER_COUNT] = {false};
|
||||
|
||||
void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3737_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -87,22 +86,22 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// assumes page 1 is already selected
|
||||
|
||||
// transmit PWM registers in 12 transfers of 16 bytes
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// iterate over the pwm_buffer contents at 16 byte intervals
|
||||
for (int i = 0; i < IS31FL3737_PWM_REGISTER_COUNT; i += 16) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3737_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,7 @@
|
||||
# define IS31FL3737_GLOBAL_CURRENT 0xFF
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3737 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -66,15 +65,15 @@ uint8_t g_led_control_registers[IS31FL3737_DRIVER_COUNT][IS31FL3737_LED_CONTROL_
|
||||
bool g_led_control_registers_update_required[IS31FL3737_DRIVER_COUNT] = {false};
|
||||
|
||||
void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3737_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -87,22 +86,22 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// assumes page 1 is already selected
|
||||
|
||||
// transmit PWM registers in 12 transfers of 16 bytes
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// iterate over the pwm_buffer contents at 16 byte intervals
|
||||
for (int i = 0; i < IS31FL3737_PWM_REGISTER_COUNT; i += 16) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 16);
|
||||
|
||||
#if IS31FL3737_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -52,8 +52,7 @@
|
||||
# define IS31FL3741_GLOBAL_CURRENT 0xFF
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20] = {0xFF};
|
||||
uint8_t i2c_transfer_buffer[20] = {0xFF};
|
||||
|
||||
// These buffers match the IS31FL3741 and IS31FL3741A PWM registers.
|
||||
// The scaling buffers match the page 2 and 3 LED On/Off registers.
|
||||
@ -68,15 +67,15 @@ bool g_scaling_registers_update_required[IS31FL3741_DRIVER_COUNT] = {false};
|
||||
uint8_t g_scaling_registers[IS31FL3741_DRIVER_COUNT][IS31FL3741_PWM_REGISTER_COUNT];
|
||||
|
||||
void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3741_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -93,34 +92,34 @@ bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_1);
|
||||
}
|
||||
|
||||
g_twi_transfer_buffer[0] = i % 180;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 18);
|
||||
i2c_transfer_buffer[0] = i % 180;
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 18);
|
||||
|
||||
#if IS31FL3741_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// transfer the left cause the total number is 351
|
||||
g_twi_transfer_buffer[0] = 162;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + 342, 9);
|
||||
i2c_transfer_buffer[0] = 162;
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + 342, 9);
|
||||
|
||||
#if IS31FL3741_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -52,8 +52,7 @@
|
||||
# define IS31FL3741_GLOBAL_CURRENT 0xFF
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20] = {0xFF};
|
||||
uint8_t i2c_transfer_buffer[20] = {0xFF};
|
||||
|
||||
// These buffers match the IS31FL3741 and IS31FL3741A PWM registers.
|
||||
// The scaling buffers match the page 2 and 3 LED On/Off registers.
|
||||
@ -68,15 +67,15 @@ bool g_scaling_registers_update_required[IS31FL3741_DRIVER_COUNT] = {false};
|
||||
uint8_t g_scaling_registers[IS31FL3741_DRIVER_COUNT][IS31FL3741_PWM_REGISTER_COUNT];
|
||||
|
||||
void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if IS31FL3741_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3741_I2C_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -93,34 +92,34 @@ bool is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_1);
|
||||
}
|
||||
|
||||
g_twi_transfer_buffer[0] = i % 180;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 18);
|
||||
i2c_transfer_buffer[0] = i % 180;
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + i, 18);
|
||||
|
||||
#if IS31FL3741_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 19, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// transfer the left cause the total number is 351
|
||||
g_twi_transfer_buffer[0] = 162;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + 342, 9);
|
||||
i2c_transfer_buffer[0] = 162;
|
||||
memcpy(i2c_transfer_buffer + 1, pwm_buffer + 342, 9);
|
||||
|
||||
#if IS31FL3741_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 10, IS31FL3741_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -31,8 +31,7 @@
|
||||
# define ISSI_PERSISTENCE 0
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the PWM & scaling registers.
|
||||
// Storing them like this is optimal for I2C transfers to the registers.
|
||||
@ -45,15 +44,15 @@ bool g_scaling_buffer_update_required[DRIVER_COUNT] = {false};
|
||||
// For writing of single register entry
|
||||
void IS31FL_write_single_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
// Set register address and register data ready to write
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if ISSI_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
|
||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, ISSI_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -64,18 +63,18 @@ bool IS31FL_write_multi_registers(uint8_t addr, uint8_t *source_buffer, uint8_t
|
||||
// Split the buffer into chunks to transfer
|
||||
for (int i = 0; i < buffer_size; i += transfer_size) {
|
||||
// Set the first entry of transfer buffer to the first register we want to write
|
||||
g_twi_transfer_buffer[0] = i + start_reg_addr;
|
||||
i2c_transfer_buffer[0] = i + start_reg_addr;
|
||||
// Copy the section of our source buffer into the transfer buffer after first register address
|
||||
memcpy(g_twi_transfer_buffer + 1, source_buffer + i, transfer_size);
|
||||
memcpy(i2c_transfer_buffer + 1, source_buffer + i, transfer_size);
|
||||
|
||||
#if ISSI_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, transfer_size + 1, ISSI_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, transfer_size + 1, ISSI_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, transfer_size + 1, ISSI_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, transfer_size + 1, ISSI_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -37,8 +37,7 @@
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the SNLED27351 PWM registers.
|
||||
// The control buffers match the PG0 LED On/Off registers.
|
||||
@ -54,17 +53,17 @@ bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT]
|
||||
|
||||
bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
// If the transaction fails function returns false.
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if SNLED27351_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -79,26 +78,26 @@ bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// Assumes PG1 is already selected.
|
||||
// If any of the transactions fails function returns false.
|
||||
// Transmit PWM registers in 12 transfers of 16 bytes.
|
||||
// g_twi_transfer_buffer[] is 20 bytes
|
||||
// i2c_transfer_buffer[] is 20 bytes
|
||||
|
||||
// Iterate over the pwm_buffer contents at 16 byte intervals.
|
||||
for (int i = 0; i < SNLED27351_PWM_REGISTER_COUNT; i += 16) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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++) {
|
||||
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
|
||||
i2c_transfer_buffer[1 + j] = pwm_buffer[i + j];
|
||||
}
|
||||
|
||||
#if SNLED27351_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 17, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -37,8 +37,7 @@
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[65];
|
||||
uint8_t i2c_transfer_buffer[65];
|
||||
|
||||
// These buffers match the SNLED27351 PWM registers.
|
||||
// The control buffers match the PG0 LED On/Off registers.
|
||||
@ -54,17 +53,17 @@ bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT]
|
||||
|
||||
bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
// If the transaction fails function returns false.
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
i2c_transfer_buffer[0] = reg;
|
||||
i2c_transfer_buffer[1] = data;
|
||||
|
||||
#if SNLED27351_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -82,22 +81,22 @@ bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
|
||||
// Iterate over the pwm_buffer contents at 64 byte intervals.
|
||||
for (uint8_t i = 0; i < SNLED27351_PWM_REGISTER_COUNT; i += 64) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
i2c_transfer_buffer[0] = i;
|
||||
// Copy the data from i to i+63.
|
||||
// Device will auto-increment register for data after the first byte
|
||||
// Thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer.
|
||||
for (uint8_t j = 0; j < 64; j++) {
|
||||
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
|
||||
i2c_transfer_buffer[1 + j] = pwm_buffer[i + j];
|
||||
}
|
||||
|
||||
#if SNLED27351_I2C_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 65, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 65, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 65, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 65, SNLED27351_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
37
keyboards/fruitykeeb/fruitbar/r1/elite_c/info.json
Normal file
37
keyboards/fruitykeeb/fruitbar/r1/elite_c/info.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"development_board": "elite_c",
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "F0", "pin_b": "F1"}
|
||||
]
|
||||
},
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"encoder": true,
|
||||
"extrakey": true,
|
||||
"mousekey": true,
|
||||
"nkro": true,
|
||||
"oled": true,
|
||||
"rgblight": true
|
||||
},
|
||||
"rgblight": {
|
||||
"animations": {
|
||||
"alternating": true,
|
||||
"breathing": true,
|
||||
"christmas": true,
|
||||
"knight": true,
|
||||
"rainbow_mood": true,
|
||||
"rainbow_swirl": true,
|
||||
"rgb_test": true,
|
||||
"snake": true,
|
||||
"static_gradient": true,
|
||||
"twinkle": true
|
||||
},
|
||||
"led_count": 8,
|
||||
"max_brightness": 175,
|
||||
"sleep": true
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "C7"
|
||||
}
|
||||
}
|
1
keyboards/fruitykeeb/fruitbar/r1/elite_c/rules.mk
Normal file
1
keyboards/fruitykeeb/fruitbar/r1/elite_c/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
# This file intentionally left blank
|
256
keyboards/fruitykeeb/fruitbar/r1/info.json
Normal file
256
keyboards/fruitykeeb/fruitbar/r1/info.json
Normal file
@ -0,0 +1,256 @@
|
||||
{
|
||||
"keyboard_name": "Fruitbar",
|
||||
"maintainer": "blewis308",
|
||||
"diode_direction": "COL2ROW",
|
||||
"matrix_pins": {
|
||||
"cols": ["D3", "D2", "D4", "C6", "D7", "E6", "B4", "B5", "B6", "B2", "B3"],
|
||||
"rows": ["F4", "F5", "F6", "F7", "B1"]
|
||||
},
|
||||
"qmk": {
|
||||
"locking": {
|
||||
"enabled": true,
|
||||
"resync": true
|
||||
}
|
||||
},
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x6661"
|
||||
},
|
||||
"layout_aliases": {
|
||||
"LAYOUT": "LAYOUT_all"
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_625u": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 1], "x": 1.5, "y": 0},
|
||||
{"matrix": [1, 1], "x": 2.5, "y": 0},
|
||||
{"matrix": [0, 2], "x": 3.5, "y": 0},
|
||||
{"matrix": [0, 3], "x": 4.5, "y": 0},
|
||||
{"matrix": [0, 4], "x": 5.5, "y": 0},
|
||||
{"matrix": [0, 5], "x": 6.5, "y": 0},
|
||||
{"matrix": [1, 5], "x": 7.5, "y": 0},
|
||||
{"matrix": [0, 6], "x": 8.5, "y": 0},
|
||||
{"matrix": [1, 6], "x": 9.5, "y": 0},
|
||||
{"matrix": [0, 7], "x": 10.5, "y": 0},
|
||||
{"matrix": [0, 8], "x": 11.5, "y": 0},
|
||||
{"matrix": [1, 8], "x": 12.5, "y": 0},
|
||||
{"matrix": [0, 9], "x": 13.5, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 10], "x": 15.5, "y": 0},
|
||||
{"matrix": [1, 10], "x": 16.5, "y": 0},
|
||||
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.75},
|
||||
{"matrix": [2, 1], "x": 1.75, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2.75, "y": 1},
|
||||
{"matrix": [2, 2], "x": 3.75, "y": 1},
|
||||
{"matrix": [1, 3], "x": 4.75, "y": 1},
|
||||
{"matrix": [1, 4], "x": 5.75, "y": 1},
|
||||
{"matrix": [2, 5], "x": 6.75, "y": 1},
|
||||
{"matrix": [3, 5], "x": 7.75, "y": 1},
|
||||
{"matrix": [2, 6], "x": 8.75, "y": 1},
|
||||
{"matrix": [1, 7], "x": 9.75, "y": 1},
|
||||
{"matrix": [2, 7], "x": 10.75, "y": 1},
|
||||
{"matrix": [2, 8], "x": 11.75, "y": 1},
|
||||
{"matrix": [2, 9], "x": 12.75, "y": 1, "w": 2.25},
|
||||
{"matrix": [2, 0], "x": 0, "y": 2, "w": 2.25},
|
||||
{"matrix": [3, 1], "x": 2.25, "y": 2},
|
||||
{"matrix": [3, 2], "x": 3.25, "y": 2},
|
||||
{"matrix": [2, 3], "x": 4.25, "y": 2},
|
||||
{"matrix": [3, 3], "x": 5.25, "y": 2},
|
||||
{"matrix": [2, 4], "x": 6.25, "y": 2},
|
||||
{"matrix": [3, 4], "x": 7.25, "y": 2},
|
||||
{"matrix": [4, 5], "x": 8.25, "y": 2},
|
||||
{"matrix": [3, 6], "x": 9.25, "y": 2},
|
||||
{"matrix": [3, 7], "x": 10.25, "y": 2},
|
||||
{"matrix": [3, 8], "x": 11.25, "y": 2},
|
||||
{"matrix": [3, 9], "x": 12.25, "y": 2, "w": 2.25},
|
||||
{"matrix": [2, 10], "x": 15.5, "y": 2},
|
||||
{"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 0], "x": 1.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 1], "x": 2.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 2], "x": 3.75, "y": 3, "w": 2.25},
|
||||
{"matrix": [4, 3], "x": 6, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 4], "x": 7.25, "y": 3, "w": 2.75},
|
||||
{"matrix": [4, 6], "x": 10, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 7], "x": 11.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 8], "x": 12.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 9], "x": 14.5, "y": 3},
|
||||
{"matrix": [3, 10], "x": 15.5, "y": 3},
|
||||
{"matrix": [4, 10], "x": 16.5, "y": 3}
|
||||
]
|
||||
},
|
||||
"LAYOUT_625u_split_enter": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 1], "x": 1.5, "y": 0},
|
||||
{"matrix": [1, 1], "x": 2.5, "y": 0},
|
||||
{"matrix": [0, 2], "x": 3.5, "y": 0},
|
||||
{"matrix": [0, 3], "x": 4.5, "y": 0},
|
||||
{"matrix": [0, 4], "x": 5.5, "y": 0},
|
||||
{"matrix": [0, 5], "x": 6.5, "y": 0},
|
||||
{"matrix": [1, 5], "x": 7.5, "y": 0},
|
||||
{"matrix": [0, 6], "x": 8.5, "y": 0},
|
||||
{"matrix": [1, 6], "x": 9.5, "y": 0},
|
||||
{"matrix": [0, 7], "x": 10.5, "y": 0},
|
||||
{"matrix": [0, 8], "x": 11.5, "y": 0},
|
||||
{"matrix": [1, 8], "x": 12.5, "y": 0},
|
||||
{"matrix": [0, 9], "x": 13.5, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 10], "x": 15.5, "y": 0},
|
||||
{"matrix": [1, 10], "x": 16.5, "y": 0},
|
||||
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.75},
|
||||
{"matrix": [2, 1], "x": 1.75, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2.75, "y": 1},
|
||||
{"matrix": [2, 2], "x": 3.75, "y": 1},
|
||||
{"matrix": [1, 3], "x": 4.75, "y": 1},
|
||||
{"matrix": [1, 4], "x": 5.75, "y": 1},
|
||||
{"matrix": [2, 5], "x": 6.75, "y": 1},
|
||||
{"matrix": [3, 5], "x": 7.75, "y": 1},
|
||||
{"matrix": [2, 6], "x": 8.75, "y": 1},
|
||||
{"matrix": [1, 7], "x": 9.75, "y": 1},
|
||||
{"matrix": [2, 7], "x": 10.75, "y": 1},
|
||||
{"matrix": [2, 8], "x": 11.75, "y": 1},
|
||||
{"matrix": [1, 9], "x": 12.75, "y": 1},
|
||||
{"matrix": [2, 9], "x": 13.75, "y": 1, "w": 1.25},
|
||||
{"matrix": [2, 0], "x": 0, "y": 2, "w": 2.25},
|
||||
{"matrix": [3, 1], "x": 2.25, "y": 2},
|
||||
{"matrix": [3, 2], "x": 3.25, "y": 2},
|
||||
{"matrix": [2, 3], "x": 4.25, "y": 2},
|
||||
{"matrix": [3, 3], "x": 5.25, "y": 2},
|
||||
{"matrix": [2, 4], "x": 6.25, "y": 2},
|
||||
{"matrix": [3, 4], "x": 7.25, "y": 2},
|
||||
{"matrix": [4, 5], "x": 8.25, "y": 2},
|
||||
{"matrix": [3, 6], "x": 9.25, "y": 2},
|
||||
{"matrix": [3, 7], "x": 10.25, "y": 2},
|
||||
{"matrix": [3, 8], "x": 11.25, "y": 2},
|
||||
{"matrix": [3, 9], "x": 12.25, "y": 2, "w": 2.25},
|
||||
{"matrix": [2, 10], "x": 15.5, "y": 2},
|
||||
{"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 0], "x": 1.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 1], "x": 2.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 3], "x": 3.75, "y": 3, "w": 6.25},
|
||||
{"matrix": [4, 6], "x": 10, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 7], "x": 11.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 8], "x": 12.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 9], "x": 14.5, "y": 3},
|
||||
{"matrix": [3, 10], "x": 15.5, "y": 3},
|
||||
{"matrix": [4, 10], "x": 16.5, "y": 3}
|
||||
]
|
||||
},
|
||||
"LAYOUT_all": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 1], "x": 1.5, "y": 0},
|
||||
{"matrix": [1, 1], "x": 2.5, "y": 0},
|
||||
{"matrix": [0, 2], "x": 3.5, "y": 0},
|
||||
{"matrix": [0, 3], "x": 4.5, "y": 0},
|
||||
{"matrix": [0, 4], "x": 5.5, "y": 0},
|
||||
{"matrix": [0, 5], "x": 6.5, "y": 0},
|
||||
{"matrix": [1, 5], "x": 7.5, "y": 0},
|
||||
{"matrix": [0, 6], "x": 8.5, "y": 0},
|
||||
{"matrix": [1, 6], "x": 9.5, "y": 0},
|
||||
{"matrix": [0, 7], "x": 10.5, "y": 0},
|
||||
{"matrix": [0, 8], "x": 11.5, "y": 0},
|
||||
{"matrix": [1, 8], "x": 12.5, "y": 0},
|
||||
{"matrix": [0, 9], "x": 13.5, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 10], "x": 15.5, "y": 0},
|
||||
{"matrix": [1, 10], "x": 16.5, "y": 0},
|
||||
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.75},
|
||||
{"matrix": [2, 1], "x": 1.75, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2.75, "y": 1},
|
||||
{"matrix": [2, 2], "x": 3.75, "y": 1},
|
||||
{"matrix": [1, 3], "x": 4.75, "y": 1},
|
||||
{"matrix": [1, 4], "x": 5.75, "y": 1},
|
||||
{"matrix": [2, 5], "x": 6.75, "y": 1},
|
||||
{"matrix": [3, 5], "x": 7.75, "y": 1},
|
||||
{"matrix": [2, 6], "x": 8.75, "y": 1},
|
||||
{"matrix": [1, 7], "x": 9.75, "y": 1},
|
||||
{"matrix": [2, 7], "x": 10.75, "y": 1},
|
||||
{"matrix": [2, 8], "x": 11.75, "y": 1},
|
||||
{"matrix": [1, 9], "x": 12.75, "y": 1},
|
||||
{"matrix": [2, 9], "x": 13.75, "y": 1, "w": 1.25},
|
||||
{"matrix": [2, 0], "x": 0, "y": 2, "w": 2.25},
|
||||
{"matrix": [3, 1], "x": 2.25, "y": 2},
|
||||
{"matrix": [3, 2], "x": 3.25, "y": 2},
|
||||
{"matrix": [2, 3], "x": 4.25, "y": 2},
|
||||
{"matrix": [3, 3], "x": 5.25, "y": 2},
|
||||
{"matrix": [2, 4], "x": 6.25, "y": 2},
|
||||
{"matrix": [3, 4], "x": 7.25, "y": 2},
|
||||
{"matrix": [4, 5], "x": 8.25, "y": 2},
|
||||
{"matrix": [3, 6], "x": 9.25, "y": 2},
|
||||
{"matrix": [3, 7], "x": 10.25, "y": 2},
|
||||
{"matrix": [3, 8], "x": 11.25, "y": 2},
|
||||
{"matrix": [3, 9], "x": 12.25, "y": 2, "w": 2.25},
|
||||
{"matrix": [2, 10], "x": 15.5, "y": 2},
|
||||
{"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 0], "x": 1.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 1], "x": 2.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 2], "x": 3.75, "y": 3, "w": 2.25},
|
||||
{"matrix": [4, 3], "x": 6, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 4], "x": 7.25, "y": 3, "w": 2.75},
|
||||
{"matrix": [4, 6], "x": 10, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 7], "x": 11.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 8], "x": 12.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 9], "x": 14.5, "y": 3},
|
||||
{"matrix": [3, 10], "x": 15.5, "y": 3},
|
||||
{"matrix": [4, 10], "x": 16.5, "y": 3}
|
||||
]
|
||||
},
|
||||
"LAYOUT_split_space": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 1], "x": 1.5, "y": 0},
|
||||
{"matrix": [1, 1], "x": 2.5, "y": 0},
|
||||
{"matrix": [0, 2], "x": 3.5, "y": 0},
|
||||
{"matrix": [0, 3], "x": 4.5, "y": 0},
|
||||
{"matrix": [0, 4], "x": 5.5, "y": 0},
|
||||
{"matrix": [0, 5], "x": 6.5, "y": 0},
|
||||
{"matrix": [1, 5], "x": 7.5, "y": 0},
|
||||
{"matrix": [0, 6], "x": 8.5, "y": 0},
|
||||
{"matrix": [1, 6], "x": 9.5, "y": 0},
|
||||
{"matrix": [0, 7], "x": 10.5, "y": 0},
|
||||
{"matrix": [0, 8], "x": 11.5, "y": 0},
|
||||
{"matrix": [1, 8], "x": 12.5, "y": 0},
|
||||
{"matrix": [0, 9], "x": 13.5, "y": 0, "w": 1.5},
|
||||
{"matrix": [0, 10], "x": 15.5, "y": 0},
|
||||
{"matrix": [1, 10], "x": 16.5, "y": 0},
|
||||
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.75},
|
||||
{"matrix": [2, 1], "x": 1.75, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2.75, "y": 1},
|
||||
{"matrix": [2, 2], "x": 3.75, "y": 1},
|
||||
{"matrix": [1, 3], "x": 4.75, "y": 1},
|
||||
{"matrix": [1, 4], "x": 5.75, "y": 1},
|
||||
{"matrix": [2, 5], "x": 6.75, "y": 1},
|
||||
{"matrix": [3, 5], "x": 7.75, "y": 1},
|
||||
{"matrix": [2, 6], "x": 8.75, "y": 1},
|
||||
{"matrix": [1, 7], "x": 9.75, "y": 1},
|
||||
{"matrix": [2, 7], "x": 10.75, "y": 1},
|
||||
{"matrix": [2, 8], "x": 11.75, "y": 1},
|
||||
{"matrix": [2, 9], "x": 12.75, "y": 1, "w": 2.25},
|
||||
{"matrix": [2, 0], "x": 0, "y": 2, "w": 2.25},
|
||||
{"matrix": [3, 1], "x": 2.25, "y": 2},
|
||||
{"matrix": [3, 2], "x": 3.25, "y": 2},
|
||||
{"matrix": [2, 3], "x": 4.25, "y": 2},
|
||||
{"matrix": [3, 3], "x": 5.25, "y": 2},
|
||||
{"matrix": [2, 4], "x": 6.25, "y": 2},
|
||||
{"matrix": [3, 4], "x": 7.25, "y": 2},
|
||||
{"matrix": [4, 5], "x": 8.25, "y": 2},
|
||||
{"matrix": [3, 6], "x": 9.25, "y": 2},
|
||||
{"matrix": [3, 7], "x": 10.25, "y": 2},
|
||||
{"matrix": [3, 8], "x": 11.25, "y": 2},
|
||||
{"matrix": [3, 9], "x": 12.25, "y": 2, "w": 2.25},
|
||||
{"matrix": [2, 10], "x": 15.5, "y": 2},
|
||||
{"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 0], "x": 1.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 1], "x": 2.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 2], "x": 3.75, "y": 3, "w": 2.25},
|
||||
{"matrix": [4, 3], "x": 6, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 4], "x": 7.25, "y": 3, "w": 2.75},
|
||||
{"matrix": [4, 6], "x": 10, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 7], "x": 11.25, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 8], "x": 12.5, "y": 3, "w": 1.25},
|
||||
{"matrix": [4, 9], "x": 14.5, "y": 3},
|
||||
{"matrix": [3, 10], "x": 15.5, "y": 3},
|
||||
{"matrix": [4, 10], "x": 16.5, "y": 3}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
20
keyboards/fruitykeeb/fruitbar/r1/keymaps/default/keymap.json
Normal file
20
keyboards/fruitykeeb/fruitbar/r1/keymaps/default/keymap.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"keyboard": "fruitykeeb/fruitbar/r1",
|
||||
"keymap": "default",
|
||||
"version": 1,
|
||||
"layout": "LAYOUT_all",
|
||||
"layers": [
|
||||
[
|
||||
"KC_ESC", "KC_Q", "KC_W", "KC_E", "KC_R", "KC_T", "KC_Y", "KC_U", "KC_I", "KC_O", "KC_P", "KC_LBRC", "KC_RBRC", "KC_BSPC", "KC_HOME", "KC_END",
|
||||
"KC_TAB", "KC_A", "KC_S", "KC_D", "KC_F", "KC_G", "KC_H", "KC_J", "KC_K", "KC_L", "KC_SCLN", "KC_QUOT", "KC_NUBS", "KC_ENT",
|
||||
"KC_LSFT", "KC_Z", "KC_X", "KC_C", "KC_V", "KC_B", "KC_N", "KC_M", "KC_COMM", "KC_DOT", "KC_SLSH", "KC_RSFT", "KC_UP",
|
||||
"KC_LCTL", "KC_LGUI", "KC_LALT", "KC_SPC", "KC_SPC", "KC_SPC", "KC_RALT", "MO(1)", "KC_RCTL", "KC_LEFT", "KC_DOWN", "KC_RIGHT"
|
||||
],
|
||||
[
|
||||
"KC_GRV", "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", "KC_MINS", "KC_EQL", "KC_DEL", "KC_PGDN", "KC_PGUP",
|
||||
"KC_CAPS", "KC_F1", "KC_F2", "KC_F3", "KC_F4", "KC_F5", "KC_F6", "KC_F7", "KC_F8", "KC_F9", "KC_F10", "KC_F11", "KC_TRNS", "KC_F12",
|
||||
"KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS",
|
||||
"QK_BOOT", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"
|
||||
]
|
||||
]
|
||||
}
|
10
keyboards/fruitykeeb/fruitbar/r1/promicro/info.json
Normal file
10
keyboards/fruitykeeb/fruitbar/r1/promicro/info.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"development_board": "promicro",
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"extrakey": true,
|
||||
"mousekey": true,
|
||||
"nkro": true,
|
||||
"oled": true
|
||||
}
|
||||
}
|
1
keyboards/fruitykeeb/fruitbar/r1/promicro/rules.mk
Normal file
1
keyboards/fruitykeeb/fruitbar/r1/promicro/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
# This file intentionally left blank
|
1
keyboards/fruitykeeb/fruitbar/r1/rules.mk
Normal file
1
keyboards/fruitykeeb/fruitbar/r1/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
DEFAULT_FOLDER = fruitykeeb/fruitbar/r1/promicro
|
@ -6,6 +6,8 @@ A budget-oriented 40% with base kit compatibility. Perfect for those who have al
|
||||
|
||||
* Keyboard Maintainer: [The QMK Community](https://github.com/qmk)
|
||||
* Hardware Supported:
|
||||
* Fruitbar PCB R1 (atmega32u4)
|
||||
* If the keyboard was built with an Elite-C, use the `fruitykeeb/fruitbar/r1/elite_c` firmware for RGB and encoder support.
|
||||
* Fruitbar PCB R2 (RP2040, rp2040)
|
||||
* Hardware Availability:
|
||||
* R1 Group Buy took place between 2021-10-01 and 2021-10-24 on [FruityKeeb](https://fruitykeeb.xyz/).
|
||||
@ -13,10 +15,12 @@ A budget-oriented 40% with base kit compatibility. Perfect for those who have al
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make fruitykeeb/fruitbar/r1:default
|
||||
make fruitykeeb/fruitbar/r2:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make fruitykeeb/fruitbar/r1:default:flash
|
||||
make fruitykeeb/fruitbar/r2:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
@ -60,8 +60,7 @@
|
||||
# define IS31FL3733_SYNC_4 IS31FL3733_SYNC_NONE
|
||||
#endif
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t i2c_transfer_buffer[20];
|
||||
|
||||
// These buffers match the IS31FL3733 PWM registers.
|
||||
// The control buffers match the page 0 LED On/Off registers.
|
||||
@ -77,17 +76,17 @@ bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT]
|
||||
|
||||
bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
// If the transaction fails function returns false.
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = 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, g_twi_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(index, addr << 1, g_twi_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -103,26 +102,26 @@ bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffe
|
||||
// Assumes page 1 is already selected.
|
||||
// If any of the transactions fails function returns false.
|
||||
// Transmit PWM registers in 12 transfers of 16 bytes.
|
||||
// g_twi_transfer_buffer[] is 20 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) {
|
||||
g_twi_transfer_buffer[0] = i;
|
||||
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++) {
|
||||
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + 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, g_twi_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(index, addr << 1, g_twi_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 17, IS31FL3733_I2C_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user