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 COLOR11_REG_RAM_START 0x00
70 #define COLOR11_REG_ENABLE 0x80
71 #define COLOR11_REG_ATIME 0x81
72 #define COLOR11_REG_PTIME 0x82
73 #define COLOR11_REG_WTIME 0x83
74 #define COLOR11_REG_AILTL 0x84
75 #define COLOR11_REG_AILTH 0x85
76 #define COLOR11_REG_AIHTL 0x86
77 #define COLOR11_REG_AIHTH 0x87
78 #define COLOR11_REG_AUXID 0x90
79 #define COLOR11_REG_REVID 0x91
80 #define COLOR11_REG_ID 0x92
81 #define COLOR11_REG_STATUS 0x93
82 #define COLOR11_REG_ASTATUS 0x94
83 #define COLOR11_REG_ADATAL0 0x95
84 #define COLOR11_REG_ADATAH0 0x96
85 #define COLOR11_REG_ADATAL1 0x97
86 #define COLOR11_REG_ADATAH1 0x98
87 #define COLOR11_REG_ADATAL2 0x99
88 #define COLOR11_REG_ADATAH2 0x9A
89 #define COLOR11_REG_ADATAL3 0x9B
90 #define COLOR11_REG_ADATAH3 0x9C
91 #define COLOR11_REG_ADATAL4 0x9D
92 #define COLOR11_REG_ADATAH4 0x9E
93 #define COLOR11_REG_ADATAL5 0x9F
94 #define COLOR11_REG_ADATAH5 0xA0
95 #define COLOR11_REG_STATUS2 0xA3
96 #define COLOR11_REG_STATUS3 0xA4
97 #define COLOR11_REG_STATUS5 0xA6
98 #define COLOR11_REG_STATUS6 0xA7
99 #define COLOR11_REG_CFG0 0xA9
100 #define COLOR11_REG_CFG1 0xAA
101 #define COLOR11_REG_CFG3 0xAC
102 #define COLOR11_REG_CFG4 0xAD
103 #define COLOR11_REG_CFG6 0xAF
104 #define COLOR11_REG_CFG8 0xB1
105 #define COLOR11_REG_CFG9 0xB2
106 #define COLOR11_REG_CFG10 0xB3
107 #define COLOR11_REG_CFG11 0xB4
108 #define COLOR11_REG_CFG12 0xB5
109 #define COLOR11_REG_PERS 0xBD
110 #define COLOR11_REG_POFFSETH 0xC8
111 #define COLOR11_REG_ASTEPL 0xCA
112 #define COLOR11_REG_ASTEPH 0xCB
113 #define COLOR11_REG_AGC_GAIN_MAX 0xCF
114 #define COLOR11_REG_AZCONFIG 0xD6
115 #define COLOR11_REG_FD_STATUS 0xDB
116 #define COLOR11_REG_INTENAB 0xF9
117 #define COLOR11_REG_CONTROL 0xFA
135 #define COLOR11_ID_AUX 0x4A
136 #define COLOR11_ID_REV 0x53
137 #define COLOR11_ID_DEV 0x18
143 #define COLOR11_ALS_INTEG_TIME_DEFAULT 19000
144 #define COLOR11_ALS_STEP_DEFAULT 2780
145 #define COLOR11_ALS_THOLD_LOW_DEFAULT 0x0000u
146 #define COLOR11_ALS_THOLD_HIGH_DEFAULT 0xFFFFu
152 #define COLOR11_SET_INTENAB_ASI_DIS 0x00
153 #define COLOR11_SET_INTENAB_ASI_EN 0x80
154 #define COLOR11_SET_INTENAB_AI_DIS 0x00
155 #define COLOR11_SET_INTENAB_AI_EN 0x08
156 #define COLOR11_SET_INTENAB_SI_DIS 0x00
157 #define COLOR11_SET_INTENAB_SI_EN 0x01
163 #define COLOR11_STATUS2_AVALID 0x40
164 #define COLOR11_STATUS2_ASAT_DIGITAL 0x10
165 #define COLOR11_STATUS2_ASAT_ANALOG 0x08
166 #define COLOR11_STATUS2_FDSAT_ANALOG 0x02
167 #define COLOR11_STATUS2_FDSAT_DIGITAL 0x01
173 #define COLOR11_ALS_STEP_CONV_TO_US 100
174 #define COLOR11_ALS_STEP_MIN_ASTEP 278
175 #define COLOR11_ALS_STEP_COR_FACT 50
181 #define COLOR11_COEF_SCALE_DEFAULT 1000.0f
182 #define COLOR11_COEF_DGF_DEFAULT 898.0f
183 #define COLOR11_COEF_CLR_DEFAULT 210.0f
184 #define COLOR11_COEF_RED_DEFAULT -60.0f
185 #define COLOR11_COEF_GREEN_DEFAULT 10.0f
186 #define COLOR11_COEF_BLUE_DEFAULT -290.0f
193 #define COLOR11_DEVICE_ADDRESS 0x39
211 #define COLOR11_MAP_MIKROBUS( cfg, mikrobus ) \
212 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
213 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
214 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t color11_set_als_step(color11_t *ctx, uint32_t als_step)
Color 11 set ALS step function.
err_t color11_get_als_step(color11_t *ctx, uint32_t *als_step)
Color 11 get ALS step function.
uint16_t green
Definition: color11.h:260
err_t color11_init(color11_t *ctx, color11_cfg_t *cfg)
Color 11 initialization function.
pin_name_t int_pin
Definition: color11.h:245
uint8_t slave_address
Definition: color11.h:232
@ COLOR11_ERROR
Definition: color11.h:286
uint16_t clear
Definition: color11.h:258
err_t color11_set_power_ctrl(color11_t *ctx, color11_pwr_ctrl_t pwr, color11_pwr_ctrl_t aen, color11_pwr_ctrl_t wen, color11_pwr_ctrl_t fden)
Color 11 set power control function.
@ COLOR11_AGAIN_X512
Definition: color11.h:317
color11_again_t
Color 11 Click ALS Gain value data.
Definition: color11.h:306
uint16_t red
Definition: color11.h:259
uint8_t color11_get_interrupt(color11_t *ctx)
Color 11 get interrupt function.
err_t color11_get_gain(color11_t *ctx, uint8_t *gain)
Color 11 get gain function.
@ COLOR11_AGAIN_X128
Definition: color11.h:315
uint8_t i2c_address
Definition: color11.h:248
i2c_master_t i2c
Definition: color11.h:229
err_t color11_set_als_wait(color11_t *ctx, uint8_t wait_time)
Color 11 set ALS wait time function.
Color 11 Click ALS data object.
Definition: color11.h:257
@ COLOR11_AGAIN_X1
Definition: color11.h:308
@ COLOR11_OK
Definition: color11.h:285
err_t color11_generic_read(color11_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Color 11 I2C reading function.
uint8_t rev_id
Definition: color11.h:274
Color 11 Click device identification object.
Definition: color11.h:272
err_t color11_generic_write(color11_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Color 11 I2C writing function.
@ COLOR11_AGAIN_X16
Definition: color11.h:312
err_t color11_set_interrupt(color11_t *ctx, uint8_t intenab)
Color 11 set interrupt function.
@ COLOR11_AGAIN_X8
Definition: color11.h:311
@ COLOR11_ENABLE
Definition: color11.h:297
@ COLOR11_DISABLE
Definition: color11.h:296
uint32_t i2c_speed
Definition: color11.h:247
err_t color11_get_identification(color11_t *ctx, color11_identification_t *id)
Color 11 get identification function.
err_t color11_set_als_time(color11_t *ctx, uint32_t als_time)
Color 11 set ALS integration time function.
digital_in_t int_pin
Definition: color11.h:226
pin_name_t scl
Definition: color11.h:242
uint8_t aux_id
Definition: color11.h:273
@ COLOR11_AGAIN_X0_5
Definition: color11.h:307
@ COLOR11_AGAIN_X32
Definition: color11.h:313
uint8_t dev_id
Definition: color11.h:275
@ COLOR11_AGAIN_X2048
Definition: color11.h:319
err_t color11_set_als_thold(color11_t *ctx, uint16_t l_thold, uint16_t h_thold)
Color 11 set ALS interrupt threshold function.
pin_name_t sda
Definition: color11.h:243
err_t color11_set_gain(color11_t *ctx, color11_again_t gain)
Color 11 set gain function.
color11_return_value_t
Color 11 Click return value data.
Definition: color11.h:284
uint16_t blue
Definition: color11.h:261
err_t color11_get_ir(color11_t *ctx, float *ir)
Color 11 get IR data function.
void color11_cfg_setup(color11_cfg_t *cfg)
Color 11 configuration object setup function.
err_t color11_get_data_valid_status(color11_t *ctx, uint8_t *status)
Color 11 get data valid status function.
uint16_t flicker
Definition: color11.h:263
@ COLOR11_AGAIN_X1024
Definition: color11.h:318
err_t color11_default_cfg(color11_t *ctx)
Color 11 default configuration function.
@ COLOR11_AGAIN_X64
Definition: color11.h:314
err_t color11_get_als_time(color11_t *ctx, float *als_time)
Color 11 get ALS integration time function.
@ COLOR11_AGAIN_X2
Definition: color11.h:309
color11_pwr_ctrl_t
Color 11 Click power, enable, and operation value data.
Definition: color11.h:295
err_t color11_get_illuminance(color11_t *ctx, float *lux)
Color 11 get illuminance function.
@ COLOR11_AGAIN_X256
Definition: color11.h:316
Color 11 Click context object.
Definition: color11.h:224
@ COLOR11_AGAIN_X4
Definition: color11.h:310
uint16_t wideband
Definition: color11.h:262
Color 11 Click configuration object.
Definition: color11.h:241
err_t color11_get_als_data(color11_t *ctx, color11_als_data_t *als_data)
Color 11 get ALS data function.