TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 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 (137089 times)
  2. FAT32 Library (70232 times)
  3. Network Ethernet Library (56102 times)
  4. USB Device Library (46434 times)
  5. Network WiFi Library (42053 times)
  6. FT800 Library (41384 times)
  7. GSM click (29111 times)
  8. mikroSDK (26560 times)
  9. PID Library (26489 times)
  10. microSD click (25486 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

2x2 RGB click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.4

mikroSDK Library: 2.0.0.0

Category: LED matrix

Downloaded: 27 times

Not followed.

License: MIT license  

2x2 RGB Click is a compact add-on board that contains a matrix of 4 “intelligent” RGB elements, forming a 2x2 display screen. This board features the KTD2052A, a 12-channel RGB LED driver from Kinetic Technologies. It is a fully programmable current regulator for up to four RGB LEDs (12 LEDs in total). The LED matrix consists of four LRTB GFTG, a 6-lead in-line MULTILEDs, from ams OSRAM. The LEDs have a 120-degree viewing angle.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "2x2 RGB click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "2x2 RGB click" changes.

Do you want to report abuse regarding "2x2 RGB click".

  • Information
  • Comments (0)

mikroSDK Library Blog


2x2 RGB click

2x2 RGB Click is a compact add-on board that contains a matrix of 4 “intelligent” RGB elements, forming a 2x2 display screen. This board features the KTD2052A, a 12-channel RGB LED driver from Kinetic Technologies. It is a fully programmable current regulator for up to four RGB LEDs (12 LEDs in total). The LED matrix consists of four LRTB GFTG, a 6-lead in-line MULTILEDs, from ams OSRAM. The LEDs have a 120-degree viewing angle.

2x2rgb_click.png

click Product page


Click library

  • Author : Mikroe Team
  • Date : Sep 2023.
  • Type : I2C type

Software Support

We provide a library for the 2x2 RGB 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 2x2 RGB Click driver.

Standard key functions :

  • c2x2rgb_cfg_setup Config Object Initialization function.

    void c2x2rgb_cfg_setup ( c2x2rgb_cfg_t *cfg );
  • c2x2rgb_init Initialization function.

    err_t c2x2rgb_init ( c2x2rgb_t *ctx, c2x2rgb_cfg_t *cfg );
  • c2x2rgb_default_cfg Click Default Configuration function.

    err_t c2x2rgb_default_cfg ( c2x2rgb_t *ctx );

Example key functions :

  • c2x2rgb_set_rgb_led 2x2 RGB set RGB LED function.

    err_t c2x2rgb_set_rgb_led ( c2x2rgb_t *ctx, uint8_t led_num, uint16_t ired, uint16_t igrn, uint16_t iblu );
  • c2x2rgb_set_control 2x2 RGB set control function.

    err_t c2x2rgb_set_control ( c2x2rgb_t *ctx, uint8_t en_mode, uint8_t be_en, 
                                              uint8_t ce_temp, uint8_t fade_rate );

Example Description

This example demonstrates the use of the 2x2 RGB Click board™ by controlling the color of the LEDs [1-4].

The demo application is composed of two sections :

Application Init

Initialization of SPI module and log UART. After driver initialization, the app executes a default configuration.

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    c2x2rgb_cfg_t c2x2rgb_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.
    c2x2rgb_cfg_setup( &c2x2rgb_cfg );
    C2X2RGB_MAP_MIKROBUS( c2x2rgb_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == c2x2rgb_init( &c2x2rgb, &c2x2rgb_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( C2X2RGB_ERROR == c2x2rgb_default_cfg ( &c2x2rgb ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
    log_printf( &logger, "----------------" );
    Delay_ms ( 100 );
}

Application Task

This simple example shows all LEDs in different colors. These LEDs actually consist of three single-colored LEDs (Red, Green and Blue) in a single package. Various colors can be reproduced by mixing the intensity of each LED.

void application_task ( void ) 
{
    log_printf( &logger, "\r\nRED: " );
    for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
    {
        if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, DEMO_LED_CURRENT,
                                                                   C2X2RGB_LED_CURRENT_OFF, 
                                                                   C2X2RGB_LED_CURRENT_OFF ) )
        {
            log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
        }
        Delay_ms ( 200 );
    }

    log_printf( &logger, "\r\nGREEN: " );
    for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
    {
        if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, C2X2RGB_LED_CURRENT_OFF, 
                                                                   DEMO_LED_CURRENT, 
                                                                   C2X2RGB_LED_CURRENT_OFF ) )
        {
            log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
        }
        Delay_ms ( 200 );
    }

    log_printf( &logger, "\r\nBLUE: " );
    for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
    {
        if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, C2X2RGB_LED_CURRENT_OFF, 
                                                                   C2X2RGB_LED_CURRENT_OFF, 
                                                                   DEMO_LED_CURRENT ) )
        {
            log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
        }
        Delay_ms ( 200 );
    }

    log_printf( &logger, "\r\nWHITE: " );
    for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
    {
        if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, DEMO_LED_CURRENT, 
                                                                   DEMO_LED_CURRENT, 
                                                                   DEMO_LED_CURRENT ) )
        {
            log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
        }
        Delay_ms ( 200 );
    }
    log_printf( &logger, "\r\n----------------" );
}

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.2x2RGB

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

A5000 Plug n Trust click

0

A5000 Plug&Trust Click is a compact add-on board representing a ready-to-use secure IoT authenticator. This board features the A5000, an Edge Lock® Secure Authenticator from NXP Semiconductors. The A5000 provides a root of trust at the IC level, giving an IoT authentication system state-of-the-art security capability. It allows for securely storing and provisioning credentials and performing cryptographic operations for security-critical communication and authentication functions. It has an independent Common Criteria EAL 6+ security certification up to OS level and supports ECC asymmetric cryptographic and AES/3DES symmetric algorithms.

[Learn More]

DC Motor 21 click

0

DC Motor 21 Click is a compact add-on board that contains a brushed DC motor driver. This board features the A3910, a DC motor driver designed for low voltage power applications from Allegro Microsystems. It is controlled via several GPIO pins and has a wide operating voltage range with an output current capacity of 500mA. In addition to the possibility to be used in the full-bridge configuration to drive a single bidirectional DC motor, it can also be used as a dual half-bridge to drive dual DC motors.

[Learn More]

IrThermo 5V click

0

IrThermo click 5V is a contactless temperature measurement device that relies on the accurate thermopile sensor chip, which encompasses both the thermopile sensor element and the ASSP. The ASSP - signal conditioning circuitry features 17bit ADC and powerful DSP which allow high degree of accuracy and wide temperature measurement range. The IrThermo click is equipped with both the 10bit PWM interface and the SMBus/I2C interface.

[Learn More]