TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136554 times)
  2. FAT32 Library (69758 times)
  3. Network Ethernet Library (55855 times)
  4. USB Device Library (46196 times)
  5. Network WiFi Library (41817 times)
  6. FT800 Library (41013 times)
  7. GSM click (28931 times)
  8. PID Library (26386 times)
  9. mikroSDK (26297 times)
  10. microSD click (25307 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

LED Driver 9 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.13

mikroSDK Library: 2.0.0.0

Category: LED Drivers

Downloaded: 88 times

Not followed.

License: MIT license  

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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "LED Driver 9 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "LED Driver 9 click" changes.

Do you want to report abuse regarding "LED Driver 9 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


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.

led_driver_9_click.png

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 );
  • leddriver9_init Initialization function.

    LEDDRIVER9_RETVAL leddriver9_init ( leddriver9_t *ctx, leddriver9_cfg_t *cfg );
  • leddriver9_default_cfg Click Default Configuration function.

    void leddriver9_default_cfg ( leddriver9_t *ctx );

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 );
  • 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 );
  • 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 );

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;                /**< Logger config object. */
    leddriver9_cfg_t leddriver9_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    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 " );

    mode1_register_settings( );
    mode2_register_settings( );
    Delay_ms ( 100 );

    led_output_state( );
    Delay_ms ( 100 );
}

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 );
    }
}

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.


ALSO FROM THIS AUTHOR

Thumbwheel click

15

Thumbwheel click is a mikroBUS add-on board with a 10-position rotary sprocket connected to a 1-Wire 8-Channel Addressable Switch.

[Learn More]

Opto Encoder 3 click

5

Opto Encoder 3 Click is a linear incremental optical sensor/encoder click, which can be used for the movement or rotation encoding.

[Learn More]

Altitude 3 click

5

Altitude 3 click allows high-resolution barometric pressure measurement, by utilizing the ICP-10100, an integrated barometric pressure and temperature sensor.

[Learn More]