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 COLOR14_REG_MAIN_CTRL 0x00
60 #define COLOR14_REG_PS_VCSEL 0x01
61 #define COLOR14_REG_PS_PULSES 0x02
62 #define COLOR14_REG_PS_MEASRATE 0x03
63 #define COLOR14_REG_LS_MEAS_RATE 0x04
64 #define COLOR14_REG_LS_GAIN 0x05
65 #define COLOR14_REG_PART_ID 0x06
66 #define COLOR14_REG_MAIN_STATUS 0x07
67 #define COLOR14_REG_PS_DATA_0 0x08
68 #define COLOR14_REG_PS_DATA_1 0x09
69 #define COLOR14_REG_LS_DATA_IR_0 0x0A
70 #define COLOR14_REG_LS_DATA_IR_1 0x0B
71 #define COLOR14_REG_LS_DATA_IR_2 0x0C
72 #define COLOR14_REG_LS_DATA_GREEN_0 0x0D
73 #define COLOR14_REG_LS_DATA_GREEN_1 0x0E
74 #define COLOR14_REG_LS_DATA_GREEN_2 0x0F
75 #define COLOR14_REG_LS_DATA_BLUE_0 0x10
76 #define COLOR14_REG_LS_DATA_BLUE_1 0x11
77 #define COLOR14_REG_LS_DATA_BLUE_2 0x12
78 #define COLOR14_REG_LS_DATA_RED_0 0x13
79 #define COLOR14_REG_LS_DATA_RED_1 0x14
80 #define COLOR14_REG_LS_DATA_RED_2 0x15
81 #define COLOR14_REG_INT_CFG 0x19
82 #define COLOR14_REG_INT_PST 0x1A
83 #define COLOR14_REG_PS_THRES_UP_0 0x1B
84 #define COLOR14_REG_PS_THRES_UP_1 0x1C
85 #define COLOR14_REG_PS_THRES_LOW_0 0x1D
86 #define COLOR14_REG_PS_THRES_LOW_1 0x1E
87 #define COLOR14_REG_PS_CAN_0 0x1F
88 #define COLOR14_REG_PS_CAN_1_ANA 0x20
89 #define COLOR14_REG_LS_THRES_UP_0 0x21
90 #define COLOR14_REG_LS_THRES_UP_1 0x22
91 #define COLOR14_REG_LS_THRES_UP_2 0x23
92 #define COLOR14_REG_LS_THRES_LOW_0 0x24
93 #define COLOR14_REG_LS_THRES_LOW_1 0x25
94 #define COLOR14_REG_LS_THRES_LOW_2 0x26
95 #define COLOR14_REG_LS_THRES_VAR 0x27
113 #define COLOR14_ID 0xC2
120 #define COLOR14_SET_DEV_ADDR 0x52
138 #define COLOR14_MAP_MIKROBUS( cfg, mikrobus ) \
139 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
140 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
141 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t int_pin
Definition: color14.h:175
uint8_t color14_get_int(color14_t *ctx)
Get interrupt pin state.
color14_return_value_t
Color 14 Click return value data.
Definition: color14.h:200
err_t color14_generic_write(color14_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Color 14 I2C writing function.
err_t color14_get_als(color14_t *ctx, float *als_data)
Read lux data from device.
err_t color14_get_rgb_ir(color14_t *ctx, color14_color_t *color_data)
Read color data from device.
uint32_t red
Definition: color14.h:188
pin_name_t sda
Definition: color14.h:173
uint8_t i2c_address
Definition: color14.h:178
uint32_t blue
Definition: color14.h:190
@ COLOR14_ERROR
Definition: color14.h:202
err_t color14_init(color14_t *ctx, color14_cfg_t *cfg)
Color 14 initialization function.
uint32_t i2c_speed
Definition: color14.h:177
void color14_cfg_setup(color14_cfg_t *cfg)
Color 14 configuration object setup function.
float color14_get_als_resolution(color14_t *ctx)
Get resolution for the lux calculation.
float lux_resolution
Definition: color14.h:162
pin_name_t scl
Definition: color14.h:172
Color 14 color data object.
Definition: color14.h:187
@ COLOR14_ERROR_PARAM
Definition: color14.h:204
err_t color14_get_proximity(color14_t *ctx, uint16_t *ps_data)
Read proximity data from device.
@ COLOR14_ERROR_CFG
Definition: color14.h:205
i2c_master_t i2c
Definition: color14.h:156
uint32_t ir
Definition: color14.h:191
uint32_t green
Definition: color14.h:189
Color 14 Click context object.
Definition: color14.h:151
err_t color14_generic_read(color14_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Color 14 I2C reading function.
uint8_t slave_address
Definition: color14.h:159
digital_in_t int_pin
Definition: color14.h:153
err_t color14_ls_color(color14_t *ctx, uint8_t ls_reg, uint32_t *ls_data)
Read ls data from color registers.
@ COLOR14_ERROR_OVF
Definition: color14.h:203
Color 14 Click configuration object.
Definition: color14.h:171
@ COLOR14_OK
Definition: color14.h:201