c2x2rgb 2.1.0.0
c2x2rgb.h File Reference

This file contains API for 2x2 RGB Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  c2x2rgb_t
 2x2 RGB Click context object. More...
 
struct  c2x2rgb_cfg_t
 2x2 RGB Click configuration object. More...
 
struct  c2x2rgb_rgb_led_t
 2x2 RGB Click LED current setting object. More...
 

Macros

#define C2X2RGB_REG_ID   0x00
 2x2 RGB description register.
 
#define C2X2RGB_REG_MONITOR   0x01
 
#define C2X2RGB_REG_CONTROL   0x02
 
#define C2X2RGB_REG_IRED1   0x03
 
#define C2X2RGB_REG_IGRN1   0x04
 
#define C2X2RGB_REG_IBLU1   0x05
 
#define C2X2RGB_REG_IRED2   0x06
 
#define C2X2RGB_REG_IGRN2   0x07
 
#define C2X2RGB_REG_IBLU2   0x08
 
#define C2X2RGB_REG_IRED3   0x09
 
#define C2X2RGB_REG_IGRN3   0x0A
 
#define C2X2RGB_REG_IBLU3   0x0B
 
#define C2X2RGB_REG_IRED4   0x0C
 
#define C2X2RGB_REG_IGRN4   0x0D
 
#define C2X2RGB_REG_IBLU4   0x0E
 
#define C2X2RGB_REG_PG_CNTL   0x0F
 
#define C2X2RGB_REG_PG_FADE   0x10
 
#define C2X2RGB_REG_PG_RGB1   0x11
 
#define C2X2RGB_REG_PG_RGB2   0x12
 
#define C2X2RGB_REG_PG_RGB3   0x13
 
#define C2X2RGB_REG_PG_RGB4   0x14
 
#define C2X2RGB_REG_PG_WD   0x15
 
#define C2X2RGB_SET_LD1   1
 2x2 RGB LED selection data values.
 
#define C2X2RGB_SET_LD2   2
 
#define C2X2RGB_SET_LD3   3
 
#define C2X2RGB_SET_LD4   4
 
#define C2X2RGB_DEV_ID   0x06
 2x2 RGB device ID data values.
 
#define C2X2RGB_DEV_ID_BIT_MASK   0x0F
 
#define C2X2RGB_VEN_ID   0x05
 
#define C2X2RGB_VEN_ID_BIT_MASK   0x07
 
#define C2X2RGB_MONITOR_UV_OT_STAT   0x01
 2x2 RGB device ID data values.
 
#define C2X2RGB_MONITOR_COOL_STAT   0x02
 
#define C2X2RGB_MONITOR_BE_STAT   0x04
 
#define C2X2RGB_MONITOR_SC_STAT   0x08
 
#define C2X2RGB_LED_CURRENT_OFF   0
 2x2 RGB LED current setting data values.
 
#define C2X2RGB_LED_CURRENT_3MA   3000
 
#define C2X2RGB_LED_CURRENT_MAX   24000
 
#define C2X2RGB_LED_CURRENT_STEP   125
 
#define C2X2RGB_EN_MODE_SHUTDOWN   0x00
 2x2 RGB control configuration data values.
 
#define C2X2RGB_EN_MODE_NIGHT   0x01
 
#define C2X2RGB_EN_MODE_NORMAL   0x02
 
#define C2X2RGB_EN_MODE_SW_RESET   0x03
 
#define C2X2RGB_EN_MODE_BIT_MASK   0xC0
 
#define C2X2RGB_BE_DISABLE   0x00
 
#define C2X2RGB_BE_ENABLE   0x01
 
#define C2X2RGB_BE_BIT_MASK   0x20
 
#define C2X2RGB_CE_TEMP_135C   0x00
 
#define C2X2RGB_CE_TEMP_120C   0x01
 
#define C2X2RGB_CE_TEMP_105C   0x02
 
#define C2X2RGB_CE_TEMP_90C   0x03
 
#define C2X2RGB_CE_TEMP_BIT_MASK   0x18
 
#define C2X2RGB_FADE_RATE0_32_MS   0x00
 
#define C2X2RGB_FADE_RATE0_63_MS   0x01
 
#define C2X2RGB_FADE_RATE0_125_MS   0x02
 
#define C2X2RGB_FADE_RATE0_250_MS   0x03
 
#define C2X2RGB_FADE_RATE0_500_MS   0x04
 
#define C2X2RGB_FADE_RATE0_1_S   0x05
 
#define C2X2RGB_FADE_RATE0_2_S   0x06
 
#define C2X2RGB_FADE_RATE0_4_S   0x07
 
#define C2X2RGB_FADE_RATE0_BIT_MASK   0x07
 
#define C2X2RGB_PG_MODE_OFF   0x00
 2x2 RGB pattern configuration data values.
 
#define C2X2RGB_PG_MODE_4P_EN   0x01
 
#define C2X2RGB_PG_MODE_6P_EN   0x02
 
#define C2X2RGB_PG_MODE_8P_EN   0x03
 
#define C2X2RGB_PG_MODE_BIT_MASK   0xC0
 
#define C2X2RGB_PG_TIME_188_MS   0x00
 
#define C2X2RGB_PG_TIME_2_S   0x0F
 
#define C2X2RGB_PG_TIME_BIT_MASK   0x3C
 
#define C2X2RGB_FADE_RATE1_32_MS   0x00
 
#define C2X2RGB_FADE_RATE1_4_S   0x07
 
#define C2X2RGB_FADE_RATE1_BIT_MASK   0x07
 
#define C2X2RGB_DEVICE_ADDRESS   0x74
 2x2 RGB device address setting.
 
#define C2X2RGB_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  c2x2rgb_return_value_t { C2X2RGB_OK = 0 , C2X2RGB_ERROR = -1 }
 2x2 RGB Click return value data. More...
 

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

This file contains API for 2x2 RGB Click Driver.

Enumeration Type Documentation

◆ c2x2rgb_return_value_t

2x2 RGB Click return value data.

Predefined enum values for driver return values.

Enumerator
C2X2RGB_OK 
C2X2RGB_ERROR