import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js"; const __pageData = JSON.parse('{"title":"IS31FL3742A Driver","description":"","frontmatter":{},"headers":[],"relativePath":"drivers/is31fl3742a.md","filePath":"drivers/is31fl3742a.md"}'); const _sfc_main = { name: "drivers/is31fl3742a.md" }; const _hoisted_1 = /* @__PURE__ */ createStaticVNode('
I²C 30x6 LED matrix driver by Lumissil. Supports a maximum of four drivers, each controlling up to 180 single-color LEDs, or 60 RGB LEDs.
The IS31FL3742A driver code is automatically included if you are using the LED Matrix or RGB Matrix feature with the is31fl3742a
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 += is31fl3742a-mono.c # For single-color\nSRC += is31fl3742a.c # For RGB\nI2C_DRIVER_REQUIRED = yes
Add the following to your config.h
:
Define | Default | Description |
---|---|---|
IS31FL3742A_SDB_PIN | Not defined | The GPIO pin connected to the drivers' shutdown pins |
IS31FL3742A_I2C_TIMEOUT | 100 | The I²C timeout in milliseconds |
IS31FL3742A_I2C_PERSISTENCE | 0 | The number of times to retry I²C transmissions |
IS31FL3742A_I2C_ADDRESS_1 | Not defined | The I²C address of driver 0 |
IS31FL3742A_I2C_ADDRESS_2 | Not defined | The I²C address of driver 1 |
IS31FL3742A_I2C_ADDRESS_3 | Not defined | The I²C address of driver 2 |
IS31FL3742A_I2C_ADDRESS_4 | Not defined | The I²C address of driver 3 |
IS31FL3742A_CONFIGURATION | 0x31 | The value of the configuration register |
IS31FL3742A_PWM_FREQUENCY | IS31FL3742A_PWM_FREQUENCY_29K_HZ | The PWM frequency of the LEDs |
IS31FL3742A_SW_PULLDOWN | IS31FL3742A_PDR_8K_OHM | The SWx pulldown resistor value |
IS31FL3742A_CS_PULLUP | IS31FL3742A_PUR_8K_OHM | The CSx pullup resistor value |
IS31FL3742A_GLOBAL_CURRENT | 0xFF | The global current control value |
The IS31FL3742A has four possible 7-bit I²C addresses, depending on how the ADDR
pin is connected.
To configure this, set the IS31FL3742A_I2C_ADDRESS_n
defines to one of the following in your config.h
, where n denotes the driver index:
Define | Value |
---|---|
IS31FL3742A_I2C_ADDRESS_GND | 0x30 |
IS31FL3742A_I2C_ADDRESS_SCL | 0x31 |
IS31FL3742A_I2C_ADDRESS_SDA | 0x32 |
IS31FL3742A_I2C_ADDRESS_VCC | 0x33 |
The PWM frequency can be adjusted by adding the following to your config.h
:
#define IS31FL3742A_PWM_FREQUENCY IS31FL3742A_PWM_FREQUENCY_29K_HZ
Valid values are:
Define | Frequency |
---|---|
IS31FL3742A_PWM_FREQUENCY_29K_HZ | 29 kHz (default) |
IS31FL3742A_PWM_FREQUENCY_3K6_HZ | 3.6 kHz |
IS31FL3742A_PWM_FREQUENCY_1K8_HZ | 1.8 kHz |
IS31FL3742A_PWM_FREQUENCY_900_HZ | 900 Hz |
These settings control the pulldown and pullup resistor values on the SWy
and CSx
pins respectively, for the purposes of eliminating ghosting. Refer to the datasheet (p. 23) for more information on how and why this occurs.
To adjust the resistor values, add the following to your config.h
:
#define IS31FL3742A_SW_PULLDOWN IS31FL3742A_PDR_8K_OHM\n#define IS31FL3742A_CS_PULLUP IS31FL3742A_PUR_8K_OHM
Valid values for IS31FL3742A_SW_PULLDOWN
are:
Define | Resistance |
---|---|
IS31FL3742A_PDR_0_OHM | None |
IS31FL3742A_PDR_0K5_OHM | 0.5 kΩ |
IS31FL3742A_PDR_1K_OHM | 1 kΩ |
IS31FL3742A_PDR_2K_OHM | 2 kΩ |
IS31FL3742A_PDR_4K_OHM | 4 kΩ |
IS31FL3742A_PDR_8K_OHM | 8 kΩ (default) |
IS31FL3742A_PDR_16K_OHM | 16 kΩ |
IS31FL3742A_PDR_32K_OHM | 32 kΩ |
Valid values for IS31FL3742A_CS_PULLUP
are:
Define | Resistance |
---|---|
IS31FL3742A_PUR_0_OHM | None |
IS31FL3742A_PUR_0K5_OHM | 0.5 kΩ |
IS31FL3742A_PUR_1K_OHM | 1 kΩ |
IS31FL3742A_PUR_2K_OHM | 2 kΩ |
IS31FL3742A_PUR_4K_OHM | 4 kΩ |
IS31FL3742A_PUR_8K_OHM | 8 kΩ (default) |
IS31FL3742A_PUR_16K_OHM | 16 kΩ |
IS31FL3742A_PUR_32K_OHM | 32 kΩ |
This setting controls the current sunk by the CSx
pins, from 0 to 255. By default, the value is the maximum (255), but if you need to lower it, add the following to your config.h
:
#define IS31FL3742A_GLOBAL_CURRENT 0xFF
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 is31fl3742a_led_t PROGMEM g_is31fl3742a_leds[IS31FL3742A_LED_COUNT] = {\n/* Driver\n * | R G B */\n {0, SW1_CS1, SW1_CS2, SW1_CS3},\n // etc...\n};
In this example, the red, green and blue channels for the first LED index on driver 0 all have their anodes connected to the SW1
pin, and their cathodes on the CS1
, CS2
and CS3
pins respectively.
For the single-color driver, the principle is the same, but there is only one channel:
const is31fl3742a_led_t PROGMEM g_is31fl3742a_leds[IS31FL3742A_LED_COUNT] = {\n/* Driver\n * | V */\n {0, SW1_CS1},\n // etc...\n};
These values correspond to the register indices as shown in the datasheet on page 12, figure 8.
struct is31fl3742a_led_t
Contains the PWM register addresses for a single RGB LED.
uint8_t driver
uint8_t r
uint8_t g
uint8_t b
uint8_t v
void is31fl3742a_init(uint8_t index)
Initialize the LED driver. This function should be called first.
uint8_t index
void is31fl3742a_write_register(uint8_t index, uint8_t reg, uint8_t data)
Set the value of the given register.
uint8_t index
uint8_t reg
uint8_t data
void is31fl3742a_select_page(uint8_t index, uint8_t page)
Change the current page for configuring the LED driver.
uint8_t index
uint8_t page
void is31fl3742a_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 is31fl3742a_update_pwm_buffers()
after you are finished.
int index
g_is31fl3742a_leds
array).uint8_t red
uint8_t green
uint8_t blue
void is31fl3742a_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 is31fl3742a_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 is31fl3742a_update_pwm_buffers()
after you are finished.
int index
g_is31fl3742a_leds
array).uint8_t value
void is31fl3742a_set_value_all(uint8_t value)
Set the brightness of all LEDs (single-color driver only).
uint8_t value
void is31fl3742a_set_scaling_register(uint8_t index, uint8_t red, uint8_t green, uint8_t blue)
Configure the scaling registers for a single LED (RGB driver only). This function does not immediately update the LEDs; call is31fl3742a_update_scaling_registers()
after you are finished.
uint8_t index
g_is31fl3742a_leds
array).uint8_t red
uint8_t green
uint8_t blue
void is31fl3742a_set_scaling_register(uint8_t index, uint8_t value)
Configure the scaling register for a single LED (single-color driver only). This function does not immediately update the LEDs; call is31fl3742a_update_scaling_registers()
after you are finished.
uint8_t index
g_is31fl3742a_leds
array).uint8_t value
void is31fl3742a_update_pwm_buffers(uint8_t index)
Flush the PWM values to the LED driver.
uint8_t index
void is31fl3742a_update_scaling_registers(uint8_t index)
Flush the scaling register values to the LED driver.
uint8_t index