c2x4rgb  2.1.0.0
Modules | Functions
2x4 RGB Click Driver

API for configuring and manipulating 2x4 RGB Click driver. More...

Modules

 2x4 RGB Settings
 Settings of 2x4 RGB Click driver.
 
 2x4 RGB MikroBUS Map
 MikroBUS pin mapping of 2x4 RGB Click driver.
 

Functions

void c2x4rgb_cfg_setup (c2x4rgb_cfg_t *cfg)
 2x4 RGB configuration object setup function. More...
 
err_t c2x4rgb_init (c2x4rgb_t *ctx, c2x4rgb_logic_t logic_zero, c2x4rgb_logic_t logic_one, c2x4rgb_cfg_t *cfg)
 2x4 RGB initialization function. More...
 
err_t c2x4rgb_default_cfg (c2x4rgb_t *ctx)
 2x4 RGB default configuration function. More...
 
err_t c2x4rgb_write_leds (c2x4rgb_t *ctx, c2x4rgb_led_t *leds, uint8_t num_leds)
 2x4 RGB write LEDs function. More...
 
err_t c2x4rgb_write_led_matrix (c2x4rgb_t *ctx)
 2x4 RGB write LED matrix function. More...
 
void c2x4rgb_set_led_intensity (c2x4rgb_t *ctx, uint8_t led_num, uint8_t brightness, uint8_t gain)
 2x4 RGB set LED intensity function. More...
 
void c2x4rgb_set_leds_intensity (c2x4rgb_t *ctx, uint8_t brightness, uint8_t gain)
 2x4 RGB set LEDs intensity function. More...
 
void c2x4rgb_set_led_color (c2x4rgb_t *ctx, uint8_t led_num, uint32_t rgb)
 2x4 RGB set LED color function. More...
 
void c2x4rgb_set_leds_color (c2x4rgb_t *ctx, uint32_t rgb)
 2x4 RGB set LEDs color function. More...
 

Detailed Description

API for configuring and manipulating 2x4 RGB Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ c2x4rgb_cfg_setup()

void c2x4rgb_cfg_setup ( c2x4rgb_cfg_t cfg)

2x4 RGB configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See c2x4rgb_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ c2x4rgb_default_cfg()

err_t c2x4rgb_default_cfg ( c2x4rgb_t ctx)

2x4 RGB default configuration function.

This function executes a default configuration of 2x4 RGB Click board.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ c2x4rgb_init()

err_t c2x4rgb_init ( c2x4rgb_t ctx,
c2x4rgb_logic_t  logic_zero,
c2x4rgb_logic_t  logic_one,
c2x4rgb_cfg_t cfg 
)

2x4 RGB initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
[in]logic_zero: Function pointer for logic zero.
[in]logic_one: Function pointer for logic one.
[in]cfg: Click configuration structure. See c2x4rgb_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x4rgb_set_led_color()

void c2x4rgb_set_led_color ( c2x4rgb_t ctx,
uint8_t  led_num,
uint32_t  rgb 
)

2x4 RGB set LED color function.

This function sets the color of the selected LED in the LED matrix.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
[in]led_num: LED number (0 to 7).
[in]rgb: 24-bit RGB color (in a format RRGGBB).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function doesn't write the LED matrix to the Click board. In order for this change to take effect you will need to call the c2x4rgb_write_led_matrix function afterward.

◆ c2x4rgb_set_led_intensity()

void c2x4rgb_set_led_intensity ( c2x4rgb_t ctx,
uint8_t  led_num,
uint8_t  brightness,
uint8_t  gain 
)

2x4 RGB set LED intensity function.

This function sets the brightness and current gain level of the selected LED in the LED matrix.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
[in]led_num: LED number (0 to 7).
[in]brightness: Brightness level (0 to 15).
[in]gain: Current gain level (0 to 15).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function doesn't write the LED matrix to the Click board. In order for this change to take effect you will need to call the c2x4rgb_write_led_matrix function afterward.

◆ c2x4rgb_set_leds_color()

void c2x4rgb_set_leds_color ( c2x4rgb_t ctx,
uint32_t  rgb 
)

2x4 RGB set LEDs color function.

This function sets the color of all LEDs in the LED matrix to the selected level.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
[in]rgb: 24-bit RGB color (in a format RRGGBB).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function doesn't write the LED matrix to the Click board. In order for this change to take effect you will need to call the c2x4rgb_write_led_matrix function afterward.

◆ c2x4rgb_set_leds_intensity()

void c2x4rgb_set_leds_intensity ( c2x4rgb_t ctx,
uint8_t  brightness,
uint8_t  gain 
)

2x4 RGB set LEDs intensity function.

This function sets the brightness and current gain level of all LEDs in the led matrix.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
[in]brightness: Brightness level (0 to 15).
[in]gain: Current gain level (0 to 15).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function doesn't write the LED matrix to the Click board. In order for this change to take effect you will need to call the c2x4rgb_write_led_matrix function afterward.

◆ c2x4rgb_write_led_matrix()

err_t c2x4rgb_write_led_matrix ( c2x4rgb_t ctx)

2x4 RGB write LED matrix function.

This function writes the LED matrix data from the Click context object.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x4rgb_write_leds()

err_t c2x4rgb_write_leds ( c2x4rgb_t ctx,
c2x4rgb_led_t leds,
uint8_t  num_leds 
)

2x4 RGB write LEDs function.

This function writes data to a desired number of LEDs starting from the LED 0 by using DIN pin.

Parameters
[in]ctx: Click context object. See c2x4rgb_t object definition for detailed explanation.
[in]leds: LEDs data to be written. See c2x4rgb_led_t object definition for detailed explanation.
[in]num_leds: Number of LEDs to be written (up to 8 leds).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.