summaryrefslogtreecommitdiff
path: root/drivers/led/issi/is31fl3218-simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/led/issi/is31fl3218-simple.c')
-rw-r--r--drivers/led/issi/is31fl3218-simple.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/led/issi/is31fl3218-simple.c b/drivers/led/issi/is31fl3218-simple.c
index ce28c51d18..d9faa8677d 100644
--- a/drivers/led/issi/is31fl3218-simple.c
+++ b/drivers/led/issi/is31fl3218-simple.c
@@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "is31fl3218.h"
+#include "is31fl3218-simple.h"
#include <string.h>
#include "i2c_master.h"
@@ -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
}