LED Driver 9 click
LED Driver 9 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the TLC59116, I2C bus-controlled 16-channel LED driver optimized for red/green/blue/amber (RGBA) color mixing and backlight application from Texas Instruments.
click Product page
Click library
- Author : Stefan Nikolic
- Date : feb 2021.
- Type : I2C type
Software Support
We provide a library for the LEDDriver9 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.
Library Description
This library contains API for LEDDriver9 Click driver.
Standard key functions :
leddriver9_cfg_setup
Config Object Initialization function.
void leddriver9_cfg_setup(leddriver9_cfg_t *cfg)
LED Driver 9 configuration object setup function.
LED Driver 9 Click configuration object.
Definition leddriver9.h:323
leddriver9_init
Initialization function.
err_t leddriver9_init(leddriver9_t *ctx, leddriver9_cfg_t *cfg)
LED Driver 9 initialization function.
LED Driver 9 Click context object.
Definition leddriver9.h:303
leddriver9_default_cfg
Click Default Configuration function.
void leddriver9_default_cfg(leddriver9_t *ctx)
LED Driver 9 default configuration function.
Example key functions :
leddriver9_ledout_state
This function configures the LEDOUTx registers from the defined config structure.
err_t leddriver9_ledout_state(leddriver9_t *ctx, leddriver9_output_state_t *output_state)
LED Driver 9 LEDOUT state function.
LED Driver 9 Click LED output state registers.
Definition leddriver9.h:429
leddriver9_set_pwm
This function sets the PWM duty cycle on selected ledout channel.
err_t leddriver9_set_pwm(leddriver9_t *ctx, leddriver9_channel_sel_t ch_out, float duty_cycle)
LED Driver 9 set PWM function.
leddriver9_channel_sel_t
LED Driver 9 Click channel select options.
Definition leddriver9.h:351
leddriver9_set_dimmer_pwm
This function sets the group PWM duty cycle ( GRPPWM ) which can be used for dimming already set PWM channels.
err_t leddriver9_set_dimmer_pwm(leddriver9_t *ctx, float duty_cycle)
LED Driver 9 set dimmer PWM function.
Example Description
This app demonstrates the configuration and control of the LED Driver 9 click board resulting in a nice breathing effect.
The demo application is composed of two sections :
Application Init
The initialization configures the UART LOG and I2C drivers and adjusts the Led Driver 9 click general register settings.
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( init_flag == I2C_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
Delay_ms ( 100 );
}
#define LEDDRIVER9_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition leddriver9.h:290
void led_output_state(void)
Definition main.c:162
void application_init(void)
Definition main.c:44
void mode1_register_settings(void)
Definition main.c:146
void mode2_register_settings(void)
Definition main.c:155
Application Task
The application task is a simple breathing effect on all LED out channels.
float duty_cnt = min_duty;
while ( duty_cnt <= max_duty ) {
duty_cnt += duty_gradient;
}
while ( duty_cnt > min_duty ) {
duty_cnt -= duty_gradient;
}
}
@ LEDDRIVER9_CHANNEL11
Definition leddriver9.h:363
@ LEDDRIVER9_CHANNEL15
Definition leddriver9.h:367
@ LEDDRIVER9_CHANNEL12
Definition leddriver9.h:364
@ LEDDRIVER9_CHANNEL6
Definition leddriver9.h:358
@ LEDDRIVER9_CHANNEL3
Definition leddriver9.h:355
@ LEDDRIVER9_CHANNEL14
Definition leddriver9.h:366
@ LEDDRIVER9_CHANNEL7
Definition leddriver9.h:359
@ LEDDRIVER9_CHANNEL0
Definition leddriver9.h:352
@ LEDDRIVER9_CHANNEL1
Definition leddriver9.h:353
@ LEDDRIVER9_CHANNEL2
Definition leddriver9.h:354
@ LEDDRIVER9_CHANNEL8
Definition leddriver9.h:360
@ LEDDRIVER9_CHANNEL9
Definition leddriver9.h:361
@ LEDDRIVER9_CHANNEL10
Definition leddriver9.h:362
@ LEDDRIVER9_CHANNEL5
Definition leddriver9.h:357
@ LEDDRIVER9_CHANNEL13
Definition leddriver9.h:365
@ LEDDRIVER9_CHANNEL4
Definition leddriver9.h:356
const uint8_t breathing_speed
Definition main.c:38
void application_task(void)
Definition main.c:84
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.
Other mikroE Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.LEDDriver9
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all Mikroelektronika compilers.