39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define COLOR4_CMD_CODE_CONF 0x00
74#define COLOR4_CMD_CODE_RED 0x08
75#define COLOR4_CMD_CODE_GREEN 0x09
76#define COLOR4_CMD_CODE_BLUE 0x0A
77#define COLOR4_CMD_CODE_WHITE 0x0B
95#define COLOR4_INTEGRATION_TIME_40MS 0x00
96#define COLOR4_INTEGRATION_TIME_80MS 0x10
97#define COLOR4_INTEGRATION_TIME_160MS 0x20
98#define COLOR4_INTEGRATION_TIME_320MS 0x30
99#define COLOR4_INTEGRATION_TIME_640MS 0x40
100#define COLOR4_INTEGRATION_TIME_1280MS 0x50
101#define COLOR4_INTEGRATION_BIT_MASK 0x70
103#define COLOR4_TRIG_DISABLE 0x00
104#define COLOR4_TRIG_ENABLE 0x04
105#define COLOR4_TRIG_BIT_MASK 0x04
107#define COLOR4_AF_AUTO 0x00
108#define COLOR4_AF_FORCE 0x02
109#define COLOR4_AF_BIT_MASK 0x02
111#define COLOR4_SD_ENABLE 0x00
112#define COLOR4_SD_DISABLE 0x01
113#define COLOR4_SD_BIT_MASK 0x01
121#define COLOR4_DEVICE_ADDRESS 0x10
139#define COLOR4_MAP_MIKROBUS( cfg, mikrobus ) \
140 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
141 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
color4_ch_color_t
Color 4 Click channel selection value data.
Definition color4.h:192
@ COLOR4_RED
Definition color4.h:193
@ COLOR4_GREEN
Definition color4.h:194
@ COLOR4_WHITE
Definition color4.h:196
@ COLOR4_BLUE
Definition color4.h:195
color4_return_value_t
Color 4 Click return value data.
Definition color4.h:181
@ COLOR4_OK
Definition color4.h:182
@ COLOR4_ERROR
Definition color4.h:183
err_t color4_init(color4_t *ctx, color4_cfg_t *cfg)
Color 4 initialization 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_default_cfg(color4_t *ctx)
Color 4 default configuration function.
err_t color4_get_ambient_light(color4_t *ctx, float *ambient_light)
Color 4 get ambient light level 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_generic_write(color4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Color 4 I2C writing function.
void color4_cfg_setup(color4_cfg_t *cfg)
Color 4 configuration object setup function.
err_t color4_get_config(color4_t *ctx, color4_config_t *config)
Color 4 get configuration function.
err_t color4_get_cct(color4_t *ctx, float *cct)
Color 4 get CCT data function.
err_t color4_set_config(color4_t *ctx, color4_config_t config)
Color 4 set configuration function.
Color 4 Click configuration object.
Definition color4.h:167
uint32_t i2c_speed
Definition color4.h:171
pin_name_t scl
Definition color4.h:168
pin_name_t sda
Definition color4.h:169
uint8_t i2c_address
Definition color4.h:172
Color 4 Click sensor configuration object.
Definition color4.h:205
uint8_t mode
Definition color4.h:208
uint8_t trig
Definition color4.h:207
uint8_t integration_time
Definition color4.h:206
uint8_t chip_shutdown
Definition color4.h:209
Color 4 Click context object.
Definition color4.h:151
float offset
Definition color4.h:158
i2c_master_t i2c
Definition color4.h:153
uint8_t slave_address
Definition color4.h:156