Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define COLOR15_REG_SYSM_CTRL 0x00
70 #define COLOR15_REG_INT_CTRL 0x01
71 #define COLOR15_REG_INT_FLAG 0x02
72 #define COLOR15_REG_WAIT_TIME 0x03
73 #define COLOR15_REG_CLS_GAIN 0x04
74 #define COLOR15_REG_CLS_TIME 0x05
75 #define COLOR15_REG_PERSISTENCE 0x0B
76 #define COLOR15_REG_CLS_THRES_LL 0x0C
77 #define COLOR15_REG_CLS_THRES_LH 0x0D
78 #define COLOR15_REG_CLS_THRES_HL 0x0E
79 #define COLOR15_REG_CLS_THRES_HH 0x0F
80 #define COLOR15_REG_INT_SOURCE 0x16
81 #define COLOR15_REG_ERROR_FLAG 0x17
82 #define COLOR15_REG_RCH_DATA_L 0x1C
83 #define COLOR15_REG_RCH_DATA_H 0x1D
84 #define COLOR15_REG_GCH_DATA_L 0x1E
85 #define COLOR15_REG_GCH_DATA_H 0x1F
86 #define COLOR15_REG_BCH_DATA_L 0x20
87 #define COLOR15_REG_BCH_DATA_H 0x21
88 #define COLOR15_REG_WCH_DATA_L 0x22
89 #define COLOR15_REG_WCH_DATA_H 0x23
90 #define COLOR15_REG_IRCH_DATA_L 0x24
91 #define COLOR15_REG_IRCH_DATA_H 0x25
92 #define COLOR15_REG_PROD_ID_L 0xBC
93 #define COLOR15_REG_PROD_ID_H 0xBD
111 #define COLOR15_SYSM_CTRL_SWRST 0x80
112 #define COLOR15_SYSM_CTRL_EN_WAIT 0x40
113 #define COLOR15_SYSM_CTRL_EN_IR 0x02
114 #define COLOR15_SYSM_CTRL_EN_CLS 0x01
120 #define COLOR15_INT_CTRL_CLS_SYNC 0x10
121 #define COLOR15_INT_CTRL_EN_CINT 0x01
127 #define COLOR15_INT_FLAG_POR 0x80
128 #define COLOR15_INT_FLAG_DATA_FLAG 0x40
129 #define COLOR15_INT_FLAG_CLS 0x01
130 #define COLOR15_INT_FLAG_CLEAR_ALL 0x00
136 #define COLOR15_WAIT_TIME_MS_MAX 2560
137 #define COLOR15_WAIT_TIME_MS_DEFAULT 100
138 #define COLOR15_WAIT_TIME_MS_MIN 10
139 #define COLOR15_WAIT_TIME_MS_LSB 10
140 #define COLOR15_WAIT_TIME_RES 0xFF
146 #define COLOR15_CLSCONV_1 0x00
147 #define COLOR15_CLSCONV_2 0x01
148 #define COLOR15_CLSCONV_3 0x02
149 #define COLOR15_CLSCONV_4 0x03
150 #define COLOR15_CLSCONV_5 0x04
151 #define COLOR15_CLSCONV_6 0x05
152 #define COLOR15_CLSCONV_7 0x06
153 #define COLOR15_CLSCONV_8 0x07
154 #define COLOR15_CLSCONV_9 0x08
155 #define COLOR15_CLSCONV_10 0x09
156 #define COLOR15_CLSCONV_11 0x0A
157 #define COLOR15_CLSCONV_12 0x0B
158 #define COLOR15_CLSCONV_13 0x0C
159 #define COLOR15_CLSCONV_14 0x0D
160 #define COLOR15_CLSCONV_15 0x0E
161 #define COLOR15_INT_TIME_1 0x00
162 #define COLOR15_INT_TIME_4 0x01
163 #define COLOR15_INT_TIME_16 0x02
164 #define COLOR15_INT_TIME_64 0x03
165 #define COLOR15_MAX_COUNT_LSB 1024
166 #define COLOR15_MAX_COUNT_RES 0xFFFF
172 #define COLOR15_CLS_GAIN_DIOD_SELT_X1 0x00
173 #define COLOR15_CLS_GAIN_DIOD_SELT_X2 0x80
174 #define COLOR15_CLS_GAIN_PGA_CLS_X1 0x01
175 #define COLOR15_CLS_GAIN_PGA_CLS_X4 0x02
176 #define COLOR15_CLS_GAIN_PGA_CLS_X8 0x04
177 #define COLOR15_CLS_GAIN_PGA_CLS_X32 0x08
178 #define COLOR15_CLS_GAIN_PGA_CLS_X96 0x10
184 #define COLOR15_PRS_CLS_INDEPENDENT 0x00
185 #define COLOR15_PRS_CLS_1_CLS 0x01
186 #define COLOR15_PRS_CLS_2_CLS 0x02
187 #define COLOR15_PRS_CLS_3_CLS 0x03
188 #define COLOR15_PRS_CLS_4_CLS 0x04
189 #define COLOR15_PRS_CLS_5_CLS 0x05
190 #define COLOR15_PRS_CLS_6_CLS 0x06
191 #define COLOR15_PRS_CLS_7_CLS 0x07
192 #define COLOR15_PRS_CLS_8_CLS 0x08
193 #define COLOR15_PRS_CLS_9_CLS 0x09
194 #define COLOR15_PRS_CLS_10_CLS 0x0A
195 #define COLOR15_PRS_CLS_11_CLS 0x0B
196 #define COLOR15_PRS_CLS_12_CLS 0x0C
197 #define COLOR15_PRS_CLS_13_CLS 0x0D
198 #define COLOR15_PRS_CLS_14_CLS 0x0E
199 #define COLOR15_PRS_CLS_15_CLS 0x0F
205 #define COLOR15_INT_SRC_RCH_DATA 0x01
206 #define COLOR15_INT_SRC_GCH_DATA 0x02
207 #define COLOR15_INT_SRC_BCH_DATA 0x04
208 #define COLOR15_INT_SRC_WCH_DATA 0x08
209 #define COLOR15_INT_SRC_IRCH_DATA 0x10
215 #define COLOR15_UNKNOWN_COLOR 0
216 #define COLOR15_RED_COLOR 1
217 #define COLOR15_YELLOW_COLOR 2
218 #define COLOR15_GREEN_COLOR 3
219 #define COLOR15_CYAN_COLOR 4
220 #define COLOR15_BLUE_COLOR 5
221 #define COLOR15_MAGENTA_COLOR 6
222 #define COLOR15_WHITE_COLOR 7
223 #define COLOR15_BLACK_COLOR 8
229 #define COLOR15_WHITE_COLOR_LIGHTNESS 97
230 #define COLOR15_BLACK_COLOR_LIGHTNESS 3
231 #define COLOR15_YELLOW_COLOR_HUE_ANGLE 30
232 #define COLOR15_GREEN_COLOR_HUE_ANGLE 90
233 #define COLOR15_CYAN_COLOR_HUE_ANGLE 150
234 #define COLOR15_BLUE_COLOR_HUE_ANGLE 210
235 #define COLOR15_MAGENTA_COLOR_HUE_ANGLE 270
236 #define COLOR15_RED_COLOR_HUE_ANGLE 330
242 #define COLOR15_HSL_HUE_RESOLUTION 360
243 #define COLOR15_HSL_SATURATION_RESOLUTION 100
244 #define COLOR15_HSL_LIGHTNESS_RESOLUTION 100
250 #define COLOR15_PRODUCT_ID_LSB 0x12
251 #define COLOR15_PRODUCT_ID_MSB 0x07
258 #define COLOR15_DEVICE_ADDRESS 0x38
276 #define COLOR15_MAP_MIKROBUS( cfg, mikrobus ) \
277 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
278 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
279 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
uint16_t red
Definition: color15.h:325
uint16_t resolution
Definition: color15.h:299
float lightness
Definition: color15.h:341
pin_name_t scl
Definition: color15.h:309
i2c_master_t i2c
Definition: color15.h:294
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:350
pin_name_t sda
Definition: color15.h:310
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:297
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:291
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:315
@ COLOR15_OK
Definition: color15.h:351
pin_name_t int_pin
Definition: color15.h:312
uint16_t blue
Definition: color15.h:327
Color 15 RGBWIR channels data object.
Definition: color15.h:324
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:340
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:328
uint16_t ir
Definition: color15.h:329
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:326
@ COLOR15_ERROR
Definition: color15.h:352
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:314
float hue
Definition: color15.h:339
Color 15 Click context object.
Definition: color15.h:289
Color 15 HSL color data object.
Definition: color15.h:338
Color 15 Click configuration object.
Definition: color15.h:308