import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js"; const __pageData = JSON.parse('{"title":"IS31FL3218 Driver","description":"","frontmatter":{},"headers":[],"relativePath":"drivers/is31fl3218.md","filePath":"drivers/is31fl3218.md"}'); const _sfc_main = { name: "drivers/is31fl3218.md" }; const _hoisted_1 = /* @__PURE__ */ createStaticVNode('
I²C LED driver by Lumissil. Supports up to 18 single-color LEDs, or 6 RGB LEDs.
The IS31FL3218 driver code is automatically included if you are using the LED Matrix or RGB Matrix feature with the is31fl3218
driver set, and you would use those APIs instead.
However, if you need to use the driver standalone, add this to your rules.mk
:
COMMON_VPATH += $(DRIVER_PATH)/led/issi\nSRC += is31fl3218-mono.c # For single-color\nSRC += is31fl3218.c # For RGB\nI2C_DRIVER_REQUIRED = yes
Add the following to your config.h
:
Define | Default | Description |
---|---|---|
IS31FL3218_SDB_PIN | Not defined | The GPIO pin connected to the driver's shutdown pin |
IS31FL3218_I2C_TIMEOUT | 100 | The I²C timeout in milliseconds |
IS31FL3218_I2C_PERSISTENCE | 0 | The number of times to retry I²C transmissions |
The IS31FL3218's 7-bit I²C address is 0x54
, available as IS31FL3218_I2C_ADDRESS
.
Depending on the ChibiOS board configuration, you may need to enable and configure I²C at the keyboard level.
In order to use this driver, each output must be mapped to an LED index, by adding the following to your <keyboardname>.c
:
const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT] = {\n/* R G B */\n {OUT1, OUT2, OUT3},\n // etc...\n};
In this example, the red, green and blue channels for the first LED index all have their anodes connected to VCC
, and their cathodes on the OUT1
, OUT2
and OUT3
pins respectively.
For the single-color driver, the principle is the same, but there is only one channel:
const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT] = {\n/* V */\n {OUT1},\n // etc...\n};
struct is31fl3218_led_t
Contains the PWM register addresses for a single RGB LED.
uint8_t r
uint8_t g
uint8_t b
uint8_t v
void is31fl3218_init(void)
Initialize the LED driver. This function should be called first.
void is31fl3218_write_register(uint8_t reg, uint8_t data)
Set the value of the given register.
uint8_t reg
uint8_t data
void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue)
Set the color of a single LED (RGB driver only). This function does not immediately update the LEDs; call is31fl3218_update_pwm_buffers()
after you are finished.
int index
g_is31fl3218_leds
array).uint8_t red
uint8_t green
uint8_t blue
void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue)
Set the color of all LEDs (RGB driver only).
uint8_t red
uint8_t green
uint8_t blue
void is31fl3218_set_value(int index, uint8_t value)
Set the brightness of a single LED (single-color driver only). This function does not immediately update the LEDs; call is31fl3218_update_pwm_buffers()
after you are finished.
int index
g_is31fl3218_leds
array).uint8_t value
void is31fl3218_set_value_all(uint8_t value)
Set the brightness of all LEDs (single-color driver only).
uint8_t value
void is31fl3218_set_led_control_register(uint8_t index, bool red, bool green, bool blue)
Configure the LED control registers for a single LED (RGB driver only). This function does not immediately update the LEDs; call is31fl3218_update_led_control_registers()
after you are finished.
uint8_t index
g_is31fl3218_leds
array).bool red
bool green
bool blue
void is31fl3218_set_led_control_register(uint8_t index, bool value)
Configure the LED control registers for a single LED (single-color driver only). This function does not immediately update the LEDs; call is31fl3218_update_led_control_registers()
after you are finished.
uint8_t index
g_is31fl3218_leds
array).bool value
void is31fl3218_update_pwm_buffers(void)
Flush the PWM values to the LED driver.
void is31fl3218_update_led_control_registers(void)
Flush the LED control register values to the LED driver.
', 69); const _hoisted_70 = [ _hoisted_1 ]; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", null, _hoisted_70); } const is31fl3218 = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { __pageData, is31fl3218 as default };