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 COLOR13_REG_MAIN_CTRL 0x00
70 #define COLOR13_REG_PS_VCSEL 0x01
71 #define COLOR13_REG_PS_PULSES 0x02
72 #define COLOR13_REG_PS_MEASRATE 0x03
73 #define COLOR13_REG_LS_MEAS_RATE 0x04
74 #define COLOR13_REG_LS_GAIN 0x05
75 #define COLOR13_REG_PART_ID 0x06
76 #define COLOR13_REG_MAIN_STATUS 0x07
77 #define COLOR13_REG_PS_DATA_0 0x08
78 #define COLOR13_REG_PS_DATA_1 0x09
79 #define COLOR13_REG_LS_DATA_IR_0 0x0A
80 #define COLOR13_REG_LS_DATA_IR_1 0x0B
81 #define COLOR13_REG_LS_DATA_IR_2 0x0C
82 #define COLOR13_REG_LS_DATA_GREEN_0 0x0D
83 #define COLOR13_REG_LS_DATA_GREEN_1 0x0E
84 #define COLOR13_REG_LS_DATA_GREEN_2 0x0F
85 #define COLOR13_REG_LS_DATA_BLUE_0 0x10
86 #define COLOR13_REG_LS_DATA_BLUE_1 0x11
87 #define COLOR13_REG_LS_DATA_BLUE_2 0x12
88 #define COLOR13_REG_LS_DATA_RED_0 0x13
89 #define COLOR13_REG_LS_DATA_RED_1 0x14
90 #define COLOR13_REG_LS_DATA_RED_2 0x15
91 #define COLOR13_REG_INT_CFG 0x19
92 #define COLOR13_REG_INT_PST 0x1A
93 #define COLOR13_REG_PS_THRES_UP_0 0x1B
94 #define COLOR13_REG_PS_THRES_UP_1 0x1C
95 #define COLOR13_REG_PS_THRES_LOW_0 0x1D
96 #define COLOR13_REG_PS_THRES_LOW_1 0x1E
97 #define COLOR13_REG_PS_CAN_0 0x1F
98 #define COLOR13_REG_PS_CAN_1_ANA 0x20
99 #define COLOR13_REG_LS_THRES_UP_0 0x21
100 #define COLOR13_REG_LS_THRES_UP_1 0x22
101 #define COLOR13_REG_LS_THRES_UP_2 0x23
102 #define COLOR13_REG_LS_THRES_LOW_0 0x24
103 #define COLOR13_REG_LS_THRES_LOW_1 0x25
104 #define COLOR13_REG_LS_THRES_LOW_2 0x26
105 #define COLOR13_REG_LS_THRES_VAR 0x27
123 #define COLOR13_ID 0xC2
131 #define COLOR13_SET_DEV_ADDR 0x52
149 #define COLOR13_MAP_MIKROBUS( cfg, mikrobus ) \
150 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
151 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
152 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
void color13_cfg_setup(color13_cfg_t *cfg)
Color 13 configuration object setup function.
err_t color13_ls_color(color13_t *ctx, uint8_t ls_reg, uint32_t *ls_data)
Read ls data from color registers.
@ COLOR13_ERROR_PARAM
Definition: color13.h:215
err_t color13_get_proximity(color13_t *ctx, uint16_t *ps_data)
Read proximity data from device.
err_t color13_generic_read(color13_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Color 13 I2C reading function.
err_t color13_get_rgb_ir(color13_t *ctx, color13_color_t *color_data)
Read color data from device.
@ COLOR13_ERROR_OVF
Definition: color13.h:214
uint32_t i2c_speed
Definition: color13.h:188
uint8_t slave_address
Definition: color13.h:170
uint32_t red
Definition: color13.h:199
uint8_t color13_get_int(color13_t *ctx)
Get interrupt pin state.
uint32_t blue
Definition: color13.h:201
float lux_resolution
Definition: color13.h:173
@ COLOR13_OK
Definition: color13.h:212
Color 13 color data object.
Definition: color13.h:198
i2c_master_t i2c
Definition: color13.h:167
digital_in_t int_pin
Definition: color13.h:164
err_t color13_init(color13_t *ctx, color13_cfg_t *cfg)
Color 13 initialization function.
color13_return_value_t
Color 13 Click return value data.
Definition: color13.h:211
float color13_get_als_resolution(color13_t *ctx)
Get resolution for the lux calculation.
err_t color13_generic_write(color13_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Color 13 I2C writing function.
uint8_t i2c_address
Definition: color13.h:189
err_t color13_get_als(color13_t *ctx, float *als_data)
Read lux data from device.
pin_name_t int_pin
Definition: color13.h:186
@ COLOR13_ERROR_CFG
Definition: color13.h:216
uint32_t ir
Definition: color13.h:202
uint32_t green
Definition: color13.h:200
@ COLOR13_ERROR
Definition: color13.h:213
Color 13 Click context object.
Definition: color13.h:162
pin_name_t sda
Definition: color13.h:184
pin_name_t scl
Definition: color13.h:183
Color 13 Click configuration object.
Definition: color13.h:182