color4 2.1.0.0
color4.h File Reference

This file contains API for Color 4 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  color4_t
 Color 4 Click context object. More...
 
struct  color4_cfg_t
 Color 4 Click configuration object. More...
 
struct  color4_config_t
 Color 4 Click sensor configuration object. More...
 

Macros

#define COLOR4_CMD_CODE_CONF   0x00
 Color 4 description register.
 
#define COLOR4_CMD_CODE_RED   0x08
 
#define COLOR4_CMD_CODE_GREEN   0x09
 
#define COLOR4_CMD_CODE_BLUE   0x0A
 
#define COLOR4_CMD_CODE_WHITE   0x0B
 
#define COLOR4_INTEGRATION_TIME_40MS   0x00
 Color 4 description setting.
 
#define COLOR4_INTEGRATION_TIME_80MS   0x10
 
#define COLOR4_INTEGRATION_TIME_160MS   0x20
 
#define COLOR4_INTEGRATION_TIME_320MS   0x30
 
#define COLOR4_INTEGRATION_TIME_640MS   0x40
 
#define COLOR4_INTEGRATION_TIME_1280MS   0x50
 
#define COLOR4_INTEGRATION_BIT_MASK   0x70
 
#define COLOR4_TRIG_DISABLE   0x00
 
#define COLOR4_TRIG_ENABLE   0x04
 
#define COLOR4_TRIG_BIT_MASK   0x04
 
#define COLOR4_AF_AUTO   0x00
 
#define COLOR4_AF_FORCE   0x02
 
#define COLOR4_AF_BIT_MASK   0x02
 
#define COLOR4_SD_ENABLE   0x00
 
#define COLOR4_SD_DISABLE   0x01
 
#define COLOR4_SD_BIT_MASK   0x01
 
#define COLOR4_DEVICE_ADDRESS   0x10
 Color 4 device address setting.
 
#define COLOR4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  color4_return_value_t { COLOR4_OK = 0 , COLOR4_ERROR = -1 }
 Color 4 Click return value data. More...
 
enum  color4_ch_color_t { COLOR4_RED = 0 , COLOR4_GREEN , COLOR4_BLUE , COLOR4_WHITE }
 Color 4 Click channel selection value data. More...
 

Functions

void color4_cfg_setup (color4_cfg_t *cfg)
 Color 4 configuration object setup function.
 
err_t color4_init (color4_t *ctx, color4_cfg_t *cfg)
 Color 4 initialization function.
 
err_t color4_default_cfg (color4_t *ctx)
 Color 4 default configuration function.
 
err_t color4_generic_write (color4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 4 I2C writing function.
 
err_t color4_generic_read (color4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 4 I2C reading function.
 
err_t color4_set_config (color4_t *ctx, color4_config_t config)
 Color 4 set configuration function.
 
err_t color4_get_config (color4_t *ctx, color4_config_t *config)
 Color 4 get configuration function.
 
err_t color4_get_color_data (color4_t *ctx, color4_ch_color_t ch_color, uint16_t *color_data)
 Color 4 get color data function.
 
err_t color4_get_ambient_light (color4_t *ctx, float *ambient_light)
 Color 4 get ambient light level function.
 
err_t color4_get_cct (color4_t *ctx, float *cct)
 Color 4 get CCT data function.
 

Detailed Description

This file contains API for Color 4 Click Driver.

Enumeration Type Documentation

◆ color4_ch_color_t

Color 4 Click channel selection value data.

Predefined enum values for driver channel selection values.

Enumerator
COLOR4_RED 
COLOR4_GREEN 
COLOR4_BLUE 
COLOR4_WHITE 

◆ color4_return_value_t

Color 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
COLOR4_OK 
COLOR4_ERROR