Go to the documentation of this file.
42 #ifdef PREINIT_SUPPORTED
46 #ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52 #include "drv_digital_in.h"
53 #include "drv_i2c_master.h"
65 #define COLOR7_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
67 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
68 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
75 #define COLOR7_RETVAL uint8_t
77 #define COLOR7_OK 0x00
78 #define COLOR7_INIT_ERROR 0xFF
85 #define COLOR7_REG_ENABLE 0x00
86 #define COLOR7_REG_RGBC_TIME 0x01
87 #define COLOR7_REG_WAIT_TIME 0x02
88 #define COLOR7_REG_AILTL 0x03
89 #define COLOR7_REG_AILTH 0x04
90 #define COLOR7_REG_AIHTL 0x05
91 #define COLOR7_REG_AIHTH 0x06
92 #define COLOR7_REG_PERS 0x0C
93 #define COLOR7_REG_CONFIGURATION 0x0D
94 #define COLOR7_REG_CONTROL 0x0F
95 #define COLOR7_REG_DEVICE_ID 0x12
96 #define COLOR7_REG_DEVICE_STATUS 0x13
97 #define COLOR7_REG_CLEAR_DATA_LOW 0x14
98 #define COLOR7_REG_CLEAR_DATA_HIGH 0x15
99 #define COLOR7_REG_RED_DATA_LOW 0x16
100 #define COLOR7_REG_RED_DATA_HIGH 0x17
101 #define COLOR7_REG_GREEN_DATA_LOW 0x18
102 #define COLOR7_REG_GREEN_DATA_HIGH 0x19
103 #define COLOR7_REG_BLUE_DATA_LOW 0x1A
104 #define COLOR7_REG_BLUE_DATA_HIGH 0x1B
111 #define COLOR7_CMD_SELECT 0x80
112 #define COLOR7_CMD_REPEATED_BYTE_PROTOCOL 0x00
113 #define COLOR7_CMD_AUTO_INCREMENT_PROTOCOL 0x20
120 #define COLOR7_ENABLE_RGBC_INTERRUPT 0x10
121 #define COLOR7_ENABLE_WAIT 0x08
122 #define COLOR7_ENABLE_RGBC 0x02
123 #define COLOR7_POWER_ON 0x01
130 #define COLOR7_RGBC_TIME_2_4ms 0xFF
131 #define COLOR7_RGBC_TIME_24ms 0xF6
132 #define COLOR7_RGBC_TIME_101ms 0xD5
133 #define COLOR7_RGBC_TIME_154ms 0xC0
134 #define COLOR7_RGBC_TIME_700ms 0x00
141 #define COLOR7_WAIT_TIME_W0_2_4ms 0xFF
142 #define COLOR7_WAIT_TIME_W0_204ms 0xAB
143 #define COLOR7_WAIT_TIME_W0_614ms 0xFF
144 #define COLOR7_WAIT_TIME_W1_0_029sec 0xFF
145 #define COLOR7_WAIT_TIME_W1_2_45sec 0xAB
146 #define COLOR7_WAIT_TIME_W1_7_4sec 0xFF
153 #define COLOR7_PERS_EVERY_RGBC 0x00
154 #define COLOR7_PERS_CLEAR_CH_1 0x01
155 #define COLOR7_PERS_CLEAR_CH_2 0x02
156 #define COLOR7_PERS_CLEAR_CH_3 0x03
157 #define COLOR7_PERS_CLEAR_CH_5 0x04
158 #define COLOR7_PERS_CLEAR_CH_10 0x05
159 #define COLOR7_PERS_CLEAR_CH_15 0x06
160 #define COLOR7_PERS_CLEAR_CH_20 0x07
161 #define COLOR7_PERS_CLEAR_CH_25 0x08
162 #define COLOR7_PERS_CLEAR_CH_30 0x09
163 #define COLOR7_PERS_CLEAR_CH_35 0x0A
164 #define COLOR7_PERS_CLEAR_CH_40 0x0B
165 #define COLOR7_PERS_CLEAR_CH_45 0x0C
166 #define COLOR7_PERS_CLEAR_CH_50 0x0D
167 #define COLOR7_PERS_CLEAR_CH_55 0x0E
168 #define COLOR7_PERS_CLEAR_CH_60 0x0F
175 #define COLOR7_CFG_WAIT_LONG 0x01
182 #define COLOR7_CTRL_GAIN_x1 0x00
183 #define COLOR7_CTRL_GAIN_x4 0x01
184 #define COLOR7_CTRL_GAIN_x16 0x02
185 #define COLOR7_CTRL_GAIN_x60 0x03
192 #define COLOR7_COLOR_DATA_CLEAR 0x14
193 #define COLOR7_COLOR_DATA_RED 0x16
194 #define COLOR7_COLOR_DATA_GREEN 0x18
195 #define COLOR7_COLOR_DATA_BLUE 0x1A
Click configuration structure definition.
Definition: color7.h:228
pin_name_t sda
Definition: color7.h:232
float color7_get_color_value(color7_t *ctx)
Functions for read color value.
COLOR7_RETVAL color7_init(color7_t *ctx, color7_cfg_t *cfg)
Initialization function.
void color7_cfg_setup(color7_cfg_t *cfg)
Config Object Initialization function.
uint8_t slave_address
Definition: color7.h:220
uint8_t i2c_address
Definition: color7.h:241
i2c_master_t i2c
Definition: color7.h:216
uint8_t color7_get_color(color7_t *ctx)
Functions for detect colors.
void color7_generic_write(color7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
pin_name_t int_pin
Definition: color7.h:236
void color7_generic_read(color7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
float color7_read_color_ratio(color7_t *ctx, uint8_t color)
Functions for read color ratio.
#define COLOR7_RETVAL
Definition: color7.h:75
digital_in_t int_pin
Definition: color7.h:212
Click ctx object definition.
Definition: color7.h:209
uint8_t color7_get_interrupt_state(color7_t *ctx)
Get interrut pin state.
uint32_t i2c_speed
Definition: color7.h:240
void color7_default_cfg(color7_t *ctx)
Click Default Configuration function.
pin_name_t scl
Definition: color7.h:231