c4x4rgb  2.0.0.0
Main Page

4x4 RGB click

4x4 RGB click is a matrix of 16 intelligent RGB elements, forming a 4x4 display screen.

click Product page


Click library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : GPIO type

Software Support

We provide a library for the 4x4Rgb 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for 4x4Rgb Click driver.

Standard key functions :

Example key functions :

  • c4x4rgb_set_diode This function allows to set color of one diode.
    err_t c4x4rgb_set_diode ( c4x4rgb_t *ctx, uint32_t diode_num, uint32_t diode_color );
  • c4x4rgb_fill_screen This function sets every diode on selected color.
    void c4x4rgb_fill_screen ( c4x4rgb_t *ctx, uint32_t fill_color );

Examples Description

This application is used for powering 4x4 RGB LED matrix.

The demo application is composed of two sections :

Application Init

Initialization driver enables - GPIO.

void application_init ( void )
{
// Click initialization.
c4x4rgb_cfg_setup( &cfg, &c4x4rgb_logic_zero, &c4x4rgb_logic_one, C4X4RGB_CTRL_PIN_IN1 );
C4X4RGB_MAP_MIKROBUS( cfg, MIKROBUS_1 );
c4x4rgb_init( &c4x4rgb, &cfg );
Delay_ms ( 100 );
c4x4rgb_color_mash();
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}

Application Task

This is an example which demonstrates the use of 4x4 RGB Click board. This simple example shows all ten numbers in different colors on 4x4 RGB click. The 4x4 RGB click carries a matrix of 16 RGB LEDs and an MCP1826 low dropout regulator. 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 )
{
c4x4rgb_snake( C4X4RGB_COLOR_BLUE );
Delay_ms ( 500 );
c4x4rgb_snake_return( C4X4RGB_COLOR_LIGHT_BLUE );
Delay_ms ( 1000 );
c4x4rgb_snake( C4X4RGB_COLOR_GREEN );
Delay_ms ( 500 );
c4x4rgb_snake_return( C4X4RGB_COLOR_YELLOW );
Delay_ms ( 1000 );
c4x4rgb_snake( C4X4RGB_COLOR_RED );
Delay_ms ( 500 );
c4x4rgb_snake_return( C4X4RGB_COLOR_PURPLE );
Delay_ms ( 1000 );
Delay_ms ( 100 );
}

Note

Make sure the logic delays are defined for your system in the c4x4rgb_delays.h file.

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.4x4Rgb

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


C4X4RGB_CTRL_PIN_IN1
#define C4X4RGB_CTRL_PIN_IN1
Definition: c4x4rgb.h:84
c4x4rgb_cfg_setup
void c4x4rgb_cfg_setup(c4x4rgb_cfg_t *cfg, drv_logic_t logic_zero, drv_logic_t logic_one, uint8_t select_ctrl_pin)
Config Object Initialization function.
c4x4rgb_set_diode
err_t c4x4rgb_set_diode(c4x4rgb_t *ctx, uint32_t diode_num, uint32_t diode_color)
Function for setting color color of one diode.
C4X4RGB_COLOR_YELLOW
#define C4X4RGB_COLOR_YELLOW
Definition: c4x4rgb.h:98
C4X4RGB_COLOR_GREEN
#define C4X4RGB_COLOR_GREEN
Definition: c4x4rgb.h:95
drv_logic_t
void(* drv_logic_t)(void)
Function pointer for logic level one and zero.
Definition: c4x4rgb.h:112
c4x4rgb_cfg_t
Click configuration structure definition.
Definition: c4x4rgb.h:138
application_task
void application_task(void)
Definition: main.c:73
c4x4rgb_init
err_t c4x4rgb_init(c4x4rgb_t *ctx, c4x4rgb_cfg_t *cfg)
Initialization function.
c4x4rgb_fill_screen
void c4x4rgb_fill_screen(c4x4rgb_t *ctx, uint32_t fill_color)
Function for filling color of ever diode.
C4X4RGB_COLOR_PURPLE
#define C4X4RGB_COLOR_PURPLE
Definition: c4x4rgb.h:99
application_init
void application_init(void)
Definition: main.c:56
c4x4rgb_t
Click ctx object definition.
Definition: c4x4rgb.h:118
C4X4RGB_COLOR_WHITE
#define C4X4RGB_COLOR_WHITE
Definition: c4x4rgb.h:93
C4X4RGB_COLOR_LIGHT_BLUE
#define C4X4RGB_COLOR_LIGHT_BLUE
Definition: c4x4rgb.h:97
C4X4RGB_COLOR_BLUE
#define C4X4RGB_COLOR_BLUE
Definition: c4x4rgb.h:96
C4X4RGB_MAP_MIKROBUS
#define C4X4RGB_MAP_MIKROBUS(cfg, mikrobus)
Definition: c4x4rgb.h:65
C4X4RGB_COLOR_RED
#define C4X4RGB_COLOR_RED
Definition: c4x4rgb.h:94