c2x2rgb 2.1.0.0
2x2 RGB Click Driver

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

Topics

 2x2 RGB Registers List
 List of registers of 2x2 RGB Click driver.
 
 2x2 RGB Registers Settings
 Settings for registers of 2x2 RGB Click driver.
 
 2x2 RGB MikroBUS Map
 MikroBUS pin mapping of 2x2 RGB Click driver.
 

Functions

void c2x2rgb_cfg_setup (c2x2rgb_cfg_t *cfg)
 2x2 RGB configuration object setup function.
 
err_t c2x2rgb_init (c2x2rgb_t *ctx, c2x2rgb_cfg_t *cfg)
 2x2 RGB initialization function.
 
err_t c2x2rgb_default_cfg (c2x2rgb_t *ctx)
 2x2 RGB default configuration function.
 
err_t c2x2rgb_generic_write (c2x2rgb_t *ctx, uint8_t reg, uint8_t data_in)
 2x2 RGB I2C writing function.
 
err_t c2x2rgb_generic_read (c2x2rgb_t *ctx, uint8_t reg, uint8_t *data_out)
 2x2 RGB I2C reading function.
 
err_t c2x2rgb_get_device_id (c2x2rgb_t *ctx, uint8_t *vendor_id, uint8_t *device_id)
 2x2 RGB get device ID function.
 
err_t c2x2rgb_get_monitor_status (c2x2rgb_t *ctx, uint8_t *sc_stat, uint8_t *be_stat, uint8_t *cool_stat, uint8_t *uv_ot_stat)
 2x2 RGB get monitor status 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)
 2x2 RGB set control function.
 
err_t c2x2rgb_set_normal_mode (c2x2rgb_t *ctx)
 2x2 RGB set normal mode function.
 
err_t c2x2rgb_sw_reset (c2x2rgb_t *ctx)
 2x2 RGB set soft reset function.
 
err_t c2x2rgb_set_rgb_led (c2x2rgb_t *ctx, uint8_t led_num, uint16_t ired, uint16_t igrn, uint16_t iblu)
 2x2 RGB set RGB LED function.
 
err_t c2x2rgb_set_all_rgb_led (c2x2rgb_t *ctx, c2x2rgb_rgb_led_t cfg_rgb_led)
 2x2 RGB set all RGB LED function.
 
err_t c2x2rgb_set_pg_ctrl (c2x2rgb_t *ctx, uint8_t pg_mode, uint8_t pg_time, uint8_t fade_rate)
 2x2 RGB set PG control function.
 
err_t c2x2rgb_set_pg_fade (c2x2rgb_t *ctx, uint8_t pg_fade)
 2x2 RGB set PG fade function.
 
err_t c2x2rgb_set_pg_rgb (c2x2rgb_t *ctx, uint8_t led_num, uint8_t pg_rgb)
 2x2 RGB set PG fade function.
 
err_t c2x2rgb_set_pg_wd (c2x2rgb_t *ctx, uint8_t wd_pcr)
 2x2 RGB set pattern watchdog counter function.
 

Detailed Description

API for configuring and manipulating 2x2 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

◆ c2x2rgb_cfg_setup()

void c2x2rgb_cfg_setup ( c2x2rgb_cfg_t * cfg)

2x2 RGB configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ c2x2rgb_default_cfg()

err_t c2x2rgb_default_cfg ( c2x2rgb_t * ctx)

2x2 RGB default configuration function.

This function executes a default configuration of 2x2 RGB click board.

Parameters
[in]ctx: Click context object. See c2x2rgb_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.

◆ c2x2rgb_generic_read()

err_t c2x2rgb_generic_read ( c2x2rgb_t * ctx,
uint8_t reg,
uint8_t * data_out )

2x2 RGB I2C reading function.

This function reads a data bytes from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_generic_write()

err_t c2x2rgb_generic_write ( c2x2rgb_t * ctx,
uint8_t reg,
uint8_t data_in )

2x2 RGB I2C writing function.

This function writes a data bytes to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_get_device_id()

err_t c2x2rgb_get_device_id ( c2x2rgb_t * ctx,
uint8_t * vendor_id,
uint8_t * device_id )

2x2 RGB get device ID function.

This function reads vendor ID and device ID by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]reg: Register address.
[out]vendor_id: Vendor ID.
[out]device_id: Device ID.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_get_monitor_status()

err_t c2x2rgb_get_monitor_status ( c2x2rgb_t * ctx,
uint8_t * sc_stat,
uint8_t * be_stat,
uint8_t * cool_stat,
uint8_t * uv_ot_stat )

2x2 RGB get monitor status function.

This function reads monitor status by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[out]sc_stat: Short-Circuit Protection Status.
[out]be_stat: BrightExtend™ Dropout Status.
[out]cool_stat: CoolExtend™ Die Temperature Status.
[out]uv_ot_stat: VIN Under-Voltage Lockout or Over Temperature Shutdown Status.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_init()

err_t c2x2rgb_init ( c2x2rgb_t * ctx,
c2x2rgb_cfg_t * cfg )

2x2 RGB initialization function.

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

Parameters
[out]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See c2x2rgb_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_set_all_rgb_led()

err_t c2x2rgb_set_all_rgb_led ( c2x2rgb_t * ctx,
c2x2rgb_rgb_led_t cfg_rgb_led )

2x2 RGB set all RGB LED function.

This function sets all RGB LED data by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]cfg_rgb_led: LED current setting object. See c2x2rgb_rgb_led_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_set_control()

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

2x2 RGB set control function.

This function sets control by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]en_mode: Enable Mode and Reset.
[in]be_en: BrightExtend™ Enable.
[in]ce_temp: CoolExtend™ Temperature Setting.
[in]fade_rate: Fade-Rate 0 Exponential Time-Constant Setting.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_set_normal_mode()

err_t c2x2rgb_set_normal_mode ( c2x2rgb_t * ctx)

2x2 RGB set normal mode function.

This function sets normal mode by using I2C serial interface.

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

◆ c2x2rgb_set_pg_ctrl()

err_t c2x2rgb_set_pg_ctrl ( c2x2rgb_t * ctx,
uint8_t pg_mode,
uint8_t pg_time,
uint8_t fade_rate )

2x2 RGB set PG control function.

This function sets PG control by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]pg_mode: Pattern Generator Enable and Mode.
[in]pg_time: Pattern-Slot Duration.
[in]fade_rate: Fade-Rate 1 Exponential Time-Constant Setting.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_set_pg_fade()

err_t c2x2rgb_set_pg_fade ( c2x2rgb_t * ctx,
uint8_t pg_fade )

2x2 RGB set PG fade function.

This function sets PG fade by using I2C serial interface.

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

◆ c2x2rgb_set_pg_rgb()

err_t c2x2rgb_set_pg_rgb ( c2x2rgb_t * ctx,
uint8_t led_num,
uint8_t pg_rgb )

2x2 RGB set PG fade function.

This function sets PG fade by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]led_num: LED selectino [1-4].
[in]pg_rgb: Pattern-Slot 7 RGB On/Off Selection.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_set_pg_wd()

err_t c2x2rgb_set_pg_wd ( c2x2rgb_t * ctx,
uint8_t wd_pcr )

2x2 RGB set pattern watchdog counter function.

This function sets pattern watchdog counter by using I2C serial interface.

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

◆ c2x2rgb_set_rgb_led()

err_t c2x2rgb_set_rgb_led ( c2x2rgb_t * ctx,
uint8_t led_num,
uint16_t ired,
uint16_t igrn,
uint16_t iblu )

2x2 RGB set RGB LED function.

This function sets RGB LED data by using I2C serial interface.

Parameters
[in]ctx: Click context object. See c2x2rgb_t object definition for detailed explanation.
[in]led_num: LED selectino [1-4].
[in]ired: Red Current Setting for RGB.
[in]igrn: Green Current Setting for RGB.
[in]iblu: Blue Current Setting for RGB.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c2x2rgb_sw_reset()

err_t c2x2rgb_sw_reset ( c2x2rgb_t * ctx)

2x2 RGB set soft reset function.

This function performs the software reset of the device.

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