leddriver19  2.1.0.0
Main Page

LED Driver 19 click

LED Driver 19 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the LED1202, a 12-channel low quiescent current LED driver from STMicroelectronics. It can output 5V, and each channel can provide up to 20mA with a headroom voltage of typically 350mW.

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Apr 2023.
  • Type : I2C type

Software Support

We provide a library for the LED Driver 19 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 LED Driver 19 Click driver.

Standard key functions :

Example key functions :

Example Description

This library contains API for LED Driver 19 Click driver.

The library initializes and defines the I2C bus drivers to write the default configuration for a PWM output value of the out pins.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs default configuration, sets the device

in output enabled mode and checks communication by reading device ID.

void application_init ( void )
{
log_cfg_t log_cfg;
leddriver19_cfg_t leddriver19_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
leddriver19_cfg_setup( &leddriver19_cfg );
LEDDRIVER19_MAP_MIKROBUS( leddriver19_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == leddriver19_init( &leddriver19, &leddriver19_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
uint8_t device_id;
leddriver19_read_reg( &leddriver19, LEDDRIVER19_REG_DEVICE_ID, &device_id );
if ( LEDDRIVER19_DEVICE_ID != device_id )
{
log_error( &logger, " Communication error." );
for ( ; ; );
}
if ( LEDDRIVER19_ERROR == leddriver19_default_cfg ( &leddriver19 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

This example demonstrates the use of the LED Driver 19 Click board by

changing PWM values of all channels from maximum to minimum turning LEDs on and off in the process.

void application_task ( void )
{
for ( uint8_t n_cnt = LEDDRIVER19_CH_SEL_0; n_cnt <= LEDDRIVER19_CH_SEL_11; n_cnt++ )
{
leddriver19_set_pattern_pwm( &leddriver19, LEDDRIVER19_PATSEL_0, n_cnt, 100 );
Delay_ms( 100 );
}
Delay_ms( 1000 );
for ( uint8_t n_cnt = LEDDRIVER19_CH_SEL_0; n_cnt <= LEDDRIVER19_CH_SEL_11; n_cnt++ )
{
Delay_ms( 100 );
}
Delay_ms( 1000 );
}

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.LEDDriver19

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.


leddriver19_cfg_setup
void leddriver19_cfg_setup(leddriver19_cfg_t *cfg)
LED Driver 19 configuration object setup function.
LEDDRIVER19_CH_SEL_11
#define LEDDRIVER19_CH_SEL_11
Definition: leddriver19.h:157
leddriver19_init
err_t leddriver19_init(leddriver19_t *ctx, leddriver19_cfg_t *cfg)
LED Driver 19 initialization function.
leddriver19_t
LED Driver 19 Click context object.
Definition: leddriver19.h:292
LEDDRIVER19_ERROR
@ LEDDRIVER19_ERROR
Definition: leddriver19.h:327
application_task
void application_task(void)
Definition: main.c:78
leddriver19_default_cfg
err_t leddriver19_default_cfg(leddriver19_t *ctx)
LED Driver 19 default configuration function.
LEDDRIVER19_CH_SEL_0
#define LEDDRIVER19_CH_SEL_0
LED Driver 19 channel enable setting.
Definition: leddriver19.h:146
leddriver19_sw_reset
err_t leddriver19_sw_reset(leddriver19_t *ctx)
LED Driver 19 software reset function.
LEDDRIVER19_PATSEL_0
#define LEDDRIVER19_PATSEL_0
LED Driver 19 pattern state setting.
Definition: leddriver19.h:132
leddriver19_set_pattern_pwm
err_t leddriver19_set_pattern_pwm(leddriver19_t *ctx, uint8_t pattern_sel, uint8_t channel_sel, float pwm_value)
LED Driver 19 set pattern PWM value function.
leddriver19_read_reg
err_t leddriver19_read_reg(leddriver19_t *ctx, uint8_t reg, uint8_t *data_out)
LED Driver 19 I2C register reading function.
LEDDRIVER19_REG_DEVICE_ID
#define LEDDRIVER19_REG_DEVICE_ID
LED Driver 19 description register.
Definition: leddriver19.h:59
leddriver19_enable_channels
err_t leddriver19_enable_channels(leddriver19_t *ctx, uint16_t channels_en)
LED Driver 19 enables channels function.
application_init
void application_init(void)
Definition: main.c:33
LEDDRIVER19_MAP_MIKROBUS
#define LEDDRIVER19_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: leddriver19.h:279
LEDDRIVER19_DEVICE_ID
#define LEDDRIVER19_DEVICE_ID
LED Driver 19 description setting.
Definition: leddriver19.h:109
leddriver19_cfg_t
LED Driver 19 Click configuration object.
Definition: leddriver19.h:309