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 COLOR11_REG_RAM_START 0x00
60 #define COLOR11_REG_ENABLE 0x80
61 #define COLOR11_REG_ATIME 0x81
62 #define COLOR11_REG_PTIME 0x82
63 #define COLOR11_REG_WTIME 0x83
64 #define COLOR11_REG_AILTL 0x84
65 #define COLOR11_REG_AILTH 0x85
66 #define COLOR11_REG_AIHTL 0x86
67 #define COLOR11_REG_AIHTH 0x87
68 #define COLOR11_REG_AUXID 0x90
69 #define COLOR11_REG_REVID 0x91
70 #define COLOR11_REG_ID 0x92
71 #define COLOR11_REG_STATUS 0x93
72 #define COLOR11_REG_ASTATUS 0x94
73 #define COLOR11_REG_ADATAL0 0x95
74 #define COLOR11_REG_ADATAH0 0x96
75 #define COLOR11_REG_ADATAL1 0x97
76 #define COLOR11_REG_ADATAH1 0x98
77 #define COLOR11_REG_ADATAL2 0x99
78 #define COLOR11_REG_ADATAH2 0x9A
79 #define COLOR11_REG_ADATAL3 0x9B
80 #define COLOR11_REG_ADATAH3 0x9C
81 #define COLOR11_REG_ADATAL4 0x9D
82 #define COLOR11_REG_ADATAH4 0x9E
83 #define COLOR11_REG_ADATAL5 0x9F
84 #define COLOR11_REG_ADATAH5 0xA0
85 #define COLOR11_REG_STATUS2 0xA3
86 #define COLOR11_REG_STATUS3 0xA4
87 #define COLOR11_REG_STATUS5 0xA6
88 #define COLOR11_REG_STATUS6 0xA7
89 #define COLOR11_REG_CFG0 0xA9
90 #define COLOR11_REG_CFG1 0xAA
91 #define COLOR11_REG_CFG3 0xAC
92 #define COLOR11_REG_CFG4 0xAD
93 #define COLOR11_REG_CFG6 0xAF
94 #define COLOR11_REG_CFG8 0xB1
95 #define COLOR11_REG_CFG9 0xB2
96 #define COLOR11_REG_CFG10 0xB3
97 #define COLOR11_REG_CFG11 0xB4
98 #define COLOR11_REG_CFG12 0xB5
99 #define COLOR11_REG_PERS 0xBD
100 #define COLOR11_REG_POFFSETH 0xC8
101 #define COLOR11_REG_ASTEPL 0xCA
102 #define COLOR11_REG_ASTEPH 0xCB
103 #define COLOR11_REG_AGC_GAIN_MAX 0xCF
104 #define COLOR11_REG_AZCONFIG 0xD6
105 #define COLOR11_REG_FD_STATUS 0xDB
106 #define COLOR11_REG_INTENAB 0xF9
107 #define COLOR11_REG_CONTROL 0xFA
125 #define COLOR11_ID_AUX 0x4A
126 #define COLOR11_ID_REV 0x53
127 #define COLOR11_ID_DEV 0x18
133 #define COLOR11_ALS_INTEG_TIME_DEFAULT 19000
134 #define COLOR11_ALS_STEP_DEFAULT 2780
135 #define COLOR11_ALS_THOLD_LOW_DEFAULT 0x0000u
136 #define COLOR11_ALS_THOLD_HIGH_DEFAULT 0xFFFFu
142 #define COLOR11_SET_INTENAB_ASI_DIS 0x00
143 #define COLOR11_SET_INTENAB_ASI_EN 0x80
144 #define COLOR11_SET_INTENAB_AI_DIS 0x00
145 #define COLOR11_SET_INTENAB_AI_EN 0x08
146 #define COLOR11_SET_INTENAB_SI_DIS 0x00
147 #define COLOR11_SET_INTENAB_SI_EN 0x01
153 #define COLOR11_STATUS2_AVALID 0x40
154 #define COLOR11_STATUS2_ASAT_DIGITAL 0x10
155 #define COLOR11_STATUS2_ASAT_ANALOG 0x08
156 #define COLOR11_STATUS2_FDSAT_ANALOG 0x02
157 #define COLOR11_STATUS2_FDSAT_DIGITAL 0x01
163 #define COLOR11_ALS_STEP_CONV_TO_US 100
164 #define COLOR11_ALS_STEP_MIN_ASTEP 278
165 #define COLOR11_ALS_STEP_COR_FACT 50
171 #define COLOR11_COEF_SCALE_DEFAULT 1000.0f
172 #define COLOR11_COEF_DGF_DEFAULT 898.0f
173 #define COLOR11_COEF_CLR_DEFAULT 210.0f
174 #define COLOR11_COEF_RED_DEFAULT -60.0f
175 #define COLOR11_COEF_GREEN_DEFAULT 10.0f
176 #define COLOR11_COEF_BLUE_DEFAULT -290.0f
183 #define COLOR11_DEVICE_ADDRESS 0x39
201 #define COLOR11_MAP_MIKROBUS( cfg, mikrobus ) \
202 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
203 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
204 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:250
err_t color11_init(color11_t *ctx, color11_cfg_t *cfg)
Color 11 initialization function.
pin_name_t int_pin
Definition: color11.h:235
uint8_t slave_address
Definition: color11.h:222
@ COLOR11_ERROR
Definition: color11.h:276
uint16_t clear
Definition: color11.h:248
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:307
color11_again_t
Color 11 Click ALS Gain value data.
Definition: color11.h:296
uint16_t red
Definition: color11.h:249
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:305
uint8_t i2c_address
Definition: color11.h:238
i2c_master_t i2c
Definition: color11.h:219
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:247
@ COLOR11_AGAIN_X1
Definition: color11.h:298
@ COLOR11_OK
Definition: color11.h:275
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:264
Color 11 Click device identification object.
Definition: color11.h:262
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:302
err_t color11_set_interrupt(color11_t *ctx, uint8_t intenab)
Color 11 set interrupt function.
@ COLOR11_AGAIN_X8
Definition: color11.h:301
@ COLOR11_ENABLE
Definition: color11.h:287
@ COLOR11_DISABLE
Definition: color11.h:286
uint32_t i2c_speed
Definition: color11.h:237
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:216
pin_name_t scl
Definition: color11.h:232
uint8_t aux_id
Definition: color11.h:263
@ COLOR11_AGAIN_X0_5
Definition: color11.h:297
@ COLOR11_AGAIN_X32
Definition: color11.h:303
uint8_t dev_id
Definition: color11.h:265
@ COLOR11_AGAIN_X2048
Definition: color11.h:309
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:233
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:274
uint16_t blue
Definition: color11.h:251
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:253
@ COLOR11_AGAIN_X1024
Definition: color11.h:308
err_t color11_default_cfg(color11_t *ctx)
Color 11 default configuration function.
@ COLOR11_AGAIN_X64
Definition: color11.h:304
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:299
color11_pwr_ctrl_t
Color 11 Click power, enable, and operation value data.
Definition: color11.h:285
err_t color11_get_illuminance(color11_t *ctx, float *lux)
Color 11 get illuminance function.
@ COLOR11_AGAIN_X256
Definition: color11.h:306
Color 11 Click context object.
Definition: color11.h:214
@ COLOR11_AGAIN_X4
Definition: color11.h:300
uint16_t wideband
Definition: color11.h:252
Color 11 Click configuration object.
Definition: color11.h:231
err_t color11_get_als_data(color11_t *ctx, color11_als_data_t *als_data)
Color 11 get ALS data function.