Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define COLOR15_REG_SYSM_CTRL 0x00
60 #define COLOR15_REG_INT_CTRL 0x01
61 #define COLOR15_REG_INT_FLAG 0x02
62 #define COLOR15_REG_WAIT_TIME 0x03
63 #define COLOR15_REG_CLS_GAIN 0x04
64 #define COLOR15_REG_CLS_TIME 0x05
65 #define COLOR15_REG_PERSISTENCE 0x0B
66 #define COLOR15_REG_CLS_THRES_LL 0x0C
67 #define COLOR15_REG_CLS_THRES_LH 0x0D
68 #define COLOR15_REG_CLS_THRES_HL 0x0E
69 #define COLOR15_REG_CLS_THRES_HH 0x0F
70 #define COLOR15_REG_INT_SOURCE 0x16
71 #define COLOR15_REG_ERROR_FLAG 0x17
72 #define COLOR15_REG_RCH_DATA_L 0x1C
73 #define COLOR15_REG_RCH_DATA_H 0x1D
74 #define COLOR15_REG_GCH_DATA_L 0x1E
75 #define COLOR15_REG_GCH_DATA_H 0x1F
76 #define COLOR15_REG_BCH_DATA_L 0x20
77 #define COLOR15_REG_BCH_DATA_H 0x21
78 #define COLOR15_REG_WCH_DATA_L 0x22
79 #define COLOR15_REG_WCH_DATA_H 0x23
80 #define COLOR15_REG_IRCH_DATA_L 0x24
81 #define COLOR15_REG_IRCH_DATA_H 0x25
82 #define COLOR15_REG_PROD_ID_L 0xBC
83 #define COLOR15_REG_PROD_ID_H 0xBD
101 #define COLOR15_SYSM_CTRL_SWRST 0x80
102 #define COLOR15_SYSM_CTRL_EN_WAIT 0x40
103 #define COLOR15_SYSM_CTRL_EN_IR 0x02
104 #define COLOR15_SYSM_CTRL_EN_CLS 0x01
110 #define COLOR15_INT_CTRL_CLS_SYNC 0x10
111 #define COLOR15_INT_CTRL_EN_CINT 0x01
117 #define COLOR15_INT_FLAG_POR 0x80
118 #define COLOR15_INT_FLAG_DATA_FLAG 0x40
119 #define COLOR15_INT_FLAG_CLS 0x01
120 #define COLOR15_INT_FLAG_CLEAR_ALL 0x00
126 #define COLOR15_WAIT_TIME_MS_MAX 2560
127 #define COLOR15_WAIT_TIME_MS_DEFAULT 100
128 #define COLOR15_WAIT_TIME_MS_MIN 10
129 #define COLOR15_WAIT_TIME_MS_LSB 10
130 #define COLOR15_WAIT_TIME_RES 0xFF
136 #define COLOR15_CLSCONV_1 0x00
137 #define COLOR15_CLSCONV_2 0x01
138 #define COLOR15_CLSCONV_3 0x02
139 #define COLOR15_CLSCONV_4 0x03
140 #define COLOR15_CLSCONV_5 0x04
141 #define COLOR15_CLSCONV_6 0x05
142 #define COLOR15_CLSCONV_7 0x06
143 #define COLOR15_CLSCONV_8 0x07
144 #define COLOR15_CLSCONV_9 0x08
145 #define COLOR15_CLSCONV_10 0x09
146 #define COLOR15_CLSCONV_11 0x0A
147 #define COLOR15_CLSCONV_12 0x0B
148 #define COLOR15_CLSCONV_13 0x0C
149 #define COLOR15_CLSCONV_14 0x0D
150 #define COLOR15_CLSCONV_15 0x0E
151 #define COLOR15_INT_TIME_1 0x00
152 #define COLOR15_INT_TIME_4 0x01
153 #define COLOR15_INT_TIME_16 0x02
154 #define COLOR15_INT_TIME_64 0x03
155 #define COLOR15_MAX_COUNT_LSB 1024
156 #define COLOR15_MAX_COUNT_RES 0xFFFF
162 #define COLOR15_CLS_GAIN_DIOD_SELT_X1 0x00
163 #define COLOR15_CLS_GAIN_DIOD_SELT_X2 0x80
164 #define COLOR15_CLS_GAIN_PGA_CLS_X1 0x01
165 #define COLOR15_CLS_GAIN_PGA_CLS_X4 0x02
166 #define COLOR15_CLS_GAIN_PGA_CLS_X8 0x04
167 #define COLOR15_CLS_GAIN_PGA_CLS_X32 0x08
168 #define COLOR15_CLS_GAIN_PGA_CLS_X96 0x10
174 #define COLOR15_PRS_CLS_INDEPENDENT 0x00
175 #define COLOR15_PRS_CLS_1_CLS 0x01
176 #define COLOR15_PRS_CLS_2_CLS 0x02
177 #define COLOR15_PRS_CLS_3_CLS 0x03
178 #define COLOR15_PRS_CLS_4_CLS 0x04
179 #define COLOR15_PRS_CLS_5_CLS 0x05
180 #define COLOR15_PRS_CLS_6_CLS 0x06
181 #define COLOR15_PRS_CLS_7_CLS 0x07
182 #define COLOR15_PRS_CLS_8_CLS 0x08
183 #define COLOR15_PRS_CLS_9_CLS 0x09
184 #define COLOR15_PRS_CLS_10_CLS 0x0A
185 #define COLOR15_PRS_CLS_11_CLS 0x0B
186 #define COLOR15_PRS_CLS_12_CLS 0x0C
187 #define COLOR15_PRS_CLS_13_CLS 0x0D
188 #define COLOR15_PRS_CLS_14_CLS 0x0E
189 #define COLOR15_PRS_CLS_15_CLS 0x0F
195 #define COLOR15_INT_SRC_RCH_DATA 0x01
196 #define COLOR15_INT_SRC_GCH_DATA 0x02
197 #define COLOR15_INT_SRC_BCH_DATA 0x04
198 #define COLOR15_INT_SRC_WCH_DATA 0x08
199 #define COLOR15_INT_SRC_IRCH_DATA 0x10
205 #define COLOR15_UNKNOWN_COLOR 0
206 #define COLOR15_RED_COLOR 1
207 #define COLOR15_YELLOW_COLOR 2
208 #define COLOR15_GREEN_COLOR 3
209 #define COLOR15_CYAN_COLOR 4
210 #define COLOR15_BLUE_COLOR 5
211 #define COLOR15_MAGENTA_COLOR 6
212 #define COLOR15_WHITE_COLOR 7
213 #define COLOR15_BLACK_COLOR 8
219 #define COLOR15_WHITE_COLOR_LIGHTNESS 97
220 #define COLOR15_BLACK_COLOR_LIGHTNESS 3
221 #define COLOR15_YELLOW_COLOR_HUE_ANGLE 30
222 #define COLOR15_GREEN_COLOR_HUE_ANGLE 90
223 #define COLOR15_CYAN_COLOR_HUE_ANGLE 150
224 #define COLOR15_BLUE_COLOR_HUE_ANGLE 210
225 #define COLOR15_MAGENTA_COLOR_HUE_ANGLE 270
226 #define COLOR15_RED_COLOR_HUE_ANGLE 330
232 #define COLOR15_HSL_HUE_RESOLUTION 360
233 #define COLOR15_HSL_SATURATION_RESOLUTION 100
234 #define COLOR15_HSL_LIGHTNESS_RESOLUTION 100
240 #define COLOR15_PRODUCT_ID_LSB 0x12
241 #define COLOR15_PRODUCT_ID_MSB 0x07
248 #define COLOR15_DEVICE_ADDRESS 0x38
266 #define COLOR15_MAP_MIKROBUS( cfg, mikrobus ) \
267 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
268 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
269 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
uint16_t red
Definition: color15.h:315
uint16_t resolution
Definition: color15.h:289
float lightness
Definition: color15.h:331
pin_name_t scl
Definition: color15.h:299
i2c_master_t i2c
Definition: color15.h:284
uint8_t color15_get_int_pin(color15_t *ctx)
Color 15 get int pin function.
color15_return_value_t
Color 15 Click return value data.
Definition: color15.h:340
pin_name_t sda
Definition: color15.h:300
err_t color15_set_cls_time(color15_t *ctx, uint8_t clsconv, uint8_t int_time)
Color 15 set cls time function.
err_t color15_generic_read(color15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Color 15 I2C reading function.
uint8_t slave_address
Definition: color15.h:287
err_t color15_init(color15_t *ctx, color15_cfg_t *cfg)
Color 15 initialization function.
err_t color15_get_data(color15_t *ctx, color15_channels_t *channels)
Color 15 get data function.
digital_in_t int_pin
Definition: color15.h:281
err_t color15_default_cfg(color15_t *ctx)
Color 15 default configuration function.
void color15_cfg_setup(color15_cfg_t *cfg)
Color 15 configuration object setup function.
void color15_rgbw_to_hsl(color15_t *ctx, color15_channels_t *rgbw, color15_hsl_t *hsl)
Color 15 rgbw to hsl function.
uint8_t i2c_address
Definition: color15.h:305
@ COLOR15_OK
Definition: color15.h:341
pin_name_t int_pin
Definition: color15.h:302
uint16_t blue
Definition: color15.h:317
Color 15 RGBWIR channels data object.
Definition: color15.h:314
err_t color15_generic_write(color15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Color 15 I2C writing function.
float saturation
Definition: color15.h:330
err_t color15_read_register(color15_t *ctx, uint8_t reg, uint8_t *data_out)
Color 15 read register function.
err_t color15_set_wait_time(color15_t *ctx, uint16_t wait_time)
Color 15 set wait time function.
err_t color15_clear_interrupt(color15_t *ctx)
Color 15 clear interrupt function.
uint16_t white
Definition: color15.h:318
uint16_t ir
Definition: color15.h:319
err_t color15_write_register(color15_t *ctx, uint8_t reg, uint8_t data_in)
Color 15 write register function.
uint16_t green
Definition: color15.h:316
@ COLOR15_ERROR
Definition: color15.h:342
err_t color15_check_communication(color15_t *ctx)
Color 15 check communication function.
uint8_t color15_get_color(color15_hsl_t *hsl)
Color 15 get color function.
uint32_t i2c_speed
Definition: color15.h:304
float hue
Definition: color15.h:329
Color 15 Click context object.
Definition: color15.h:279
Color 15 HSL color data object.
Definition: color15.h:328
Color 15 Click configuration object.
Definition: color15.h:298