leddriver9 2.0.0.0
Main Page

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 :

Example key functions :

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.

void application_init ( void ) {
log_cfg_t log_cfg;
leddriver9_cfg_t leddriver9_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
leddriver9_cfg_setup( &leddriver9_cfg );
LEDDRIVER9_MAP_MIKROBUS( leddriver9_cfg, MIKROBUS_1 );
err_t init_flag = leddriver9_init( &leddriver9, &leddriver9_cfg );
if ( init_flag == I2C_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
leddriver9_default_cfg( &leddriver9 );
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.

void application_task ( void ) {
float duty_cnt = min_duty;
while ( duty_cnt <= max_duty ) {
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL0, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL1, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL2, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL3, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL4, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL5, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL6, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL7, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL8, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL9, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL10, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL11, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL12, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL13, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL14, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL15, duty_cnt );
duty_cnt += duty_gradient;
Delay_ms ( breathing_speed );
}
while ( duty_cnt > min_duty ) {
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL0, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL1, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL2, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL3, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL4, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL5, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL6, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL7, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL8, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL9, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL10, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL11, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL12, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL13, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL14, duty_cnt );
leddriver9_set_pwm( &leddriver9, LEDDRIVER9_CHANNEL15, duty_cnt );
duty_cnt -= duty_gradient;
Delay_ms ( breathing_speed );
}
}
@ 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.