42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define AMBIENT3_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define AMBIENT3_RETVAL uint8_t
79#define AMBIENT3_OK 0x00
80#define AMBIENT3_INIT_ERROR 0xFF
87#define AMBIENT3_DEVICE_SLAVE_ADDRESS 0x49
94#define AMBIENT3_REG_HW_VERSION_MSB 0x00
95#define AMBIENT3_REG_HW_VERSION_LSB 0x01
96#define AMBIENT3_REG_FW_VERSION_MSB 0x02
97#define AMBIENT3_REG_FW_VERSION_LSB 0x03
98#define AMBIENT3_REG_CONF_CONTROL 0x04
99#define AMBIENT3_REG_INTEGRATION_TIME 0x05
100#define AMBIENT3_REG_DEVICE_TEMP 0x06
101#define AMBIENT3_REG_LED_CONFIG 0x07
102#define AMBIENT3_REG_ESP 0x4F
103#define AMBIENT3_REG_DIR_CONFIG 0x60
104#define AMBIENT3_REG_DIR_CONTROL 0x61
105#define AMBIENT3_REG_DIR_CH_1_MSB 0x62
106#define AMBIENT3_REG_DIR_CH_1_LSB 0x63
107#define AMBIENT3_REG_DIR_CH_2_MSB 0x64
108#define AMBIENT3_REG_DIR_CH_2_LSB 0x65
109#define AMBIENT3_REG_DIR_CH_3_MSB 0x66
110#define AMBIENT3_REG_DIR_CH_3_LSB 0x67
111#define AMBIENT3_REG_DIR_LUXT_MSB 0x70
112#define AMBIENT3_REG_DIR_LUXT_LSB 0x71
113#define AMBIENT3_REG_DIR_CCTT_MSB 0x72
114#define AMBIENT3_REG_DIR_CCTT_LSB 0x73
121#define AMBIENT3_REG_RAW_VALUE_0_MSB 0x08
122#define AMBIENT3_REG_RAW_VALUE_0_LSB 0x09
123#define AMBIENT3_REG_RAW_VALUE_1_MSB 0x0A
124#define AMBIENT3_REG_RAW_VALUE_1_LSB 0x0B
125#define AMBIENT3_REG_RAW_VALUE_2_MSB 0x0C
126#define AMBIENT3_REG_RAW_VALUE_2_LSB 0x0D
127#define AMBIENT3_REG_RAW_VALUE_3_MSB 0x0E
128#define AMBIENT3_REG_RAW_VALUE_3_LSB 0x0F
129#define AMBIENT3_REG_RAW_VALUE_4_MSB 0x10
130#define AMBIENT3_REG_RAW_VALUE_4_LSB 0x11
131#define AMBIENT3_REG_RAW_VALUE_5_MSB 0x12
132#define AMBIENT3_REG_RAW_VALUE_5_LSB 0x13
139#define AMBIENT3_REG_COEF_DATA_0 0x50
140#define AMBIENT3_REG_COEF_DATA_1 0x51
141#define AMBIENT3_REG_COEF_DATA_2 0x52
142#define AMBIENT3_REG_COEF_DATA_3 0x53
143#define AMBIENT3_REG_COEF_READ 0x54
144#define AMBIENT3_REG_COEF_WRITE 0x55
151#define AMBIENT3_REG_X_CALIBRATED_B1 0x14
152#define AMBIENT3_REG_X_CALIBRATED_B2 0x15
153#define AMBIENT3_REG_X_CALIBRATED_B3 0x16
154#define AMBIENT3_REG_X_CALIBRATED_B4 0x17
155#define AMBIENT3_REG_Y_CALIBRATED_B1 0x18
156#define AMBIENT3_REG_Y_CALIBRATED_B2 0x19
157#define AMBIENT3_REG_Y_CALIBRATED_B3 0x1A
158#define AMBIENT3_REG_Y_CALIBRATED_B4 0x1B
159#define AMBIENT3_REG_Z_CALIBRATED_B1 0x1C
160#define AMBIENT3_REG_Z_CALIBRATED_B2 0x1D
161#define AMBIENT3_REG_Z_CALIBRATED_B3 0x1E
162#define AMBIENT3_REG_Z_CALIBRATED_B4 0x1F
169#define AMBIENT3_REG_CIE1931_X_CALIBRATED_B1 0x20
170#define AMBIENT3_REG_CIE1931_X_CALIBRATED_B2 0x21
171#define AMBIENT3_REG_CIE1931_X_CALIBRATED_B3 0x22
172#define AMBIENT3_REG_CIE1931_X_CALIBRATED_B4 0x23
173#define AMBIENT3_REG_CIE1931_Y_CALIBRATED_B1 0x24
174#define AMBIENT3_REG_CIE1931_Y_CALIBRATED_B2 0x25
175#define AMBIENT3_REG_CIE1931_Y_CALIBRATED_B3 0x26
176#define AMBIENT3_REG_CIE1931_Y_CALIBRATED_B4 0x27
183#define AMBIENT3_REG_U_PRI_CALIBRATED_B1 0x28
184#define AMBIENT3_REG_U_PRI_CALIBRATED_B2 0x29
185#define AMBIENT3_REG_U_PRI_CALIBRATED_B3 0x2A
186#define AMBIENT3_REG_U_PRI_CALIBRATED_B4 0x2B
187#define AMBIENT3_REG_V_PRI_CALIBRATED_B1 0x2C
188#define AMBIENT3_REG_V_PRI_CALIBRATED_B2 0x2D
189#define AMBIENT3_REG_V_PRI_CALIBRATED_B3 0x2E
190#define AMBIENT3_REG_V_PRI_CALIBRATED_B4 0x2F
191#define AMBIENT3_REG_U_CALIBRATED_B1 0x30
192#define AMBIENT3_REG_U_CALIBRATED_B2 0x31
193#define AMBIENT3_REG_U_CALIBRATED_B3 0x32
194#define AMBIENT3_REG_U_CALIBRATED_B4 0x33
195#define AMBIENT3_REG_V_CALIBRATED_B1 0x34
196#define AMBIENT3_REG_V_CALIBRATED_B2 0x35
197#define AMBIENT3_REG_V_CALIBRATED_B3 0x36
198#define AMBIENT3_REG_V_CALIBRATED_B4 0x37
205#define AMBIENT3_REG_DUV_CALIBRATED_B1 0x38
206#define AMBIENT3_REG_DUV_CALIBRATED_B2 0x39
207#define AMBIENT3_REG_DUV_CALIBRATED_B3 0x3A
208#define AMBIENT3_REG_DUV_CALIBRATED_B4 0x3B
215#define AMBIENT3_REG_CAL_LUX_MSB 0x3C
216#define AMBIENT3_REG_CAL_LUX_LSB 0x3D
217#define AMBIENT3_REG_CAL_CCT_MSB 0x3E
218#define AMBIENT3_REG_CAL_CCT_LSB 0x3F
225#define AMBIENT3_CC_GAIN_x1 0x00
226#define AMBIENT3_CC_GAIN_x3_7 0x10
227#define AMBIENT3_CC_GAIN_x16 0x20
228#define AMBIENT3_CC_GAIN_x64 0x30
229#define AMBIENT3_CC_RDY_TO_INT 0x02
230#define AMBIENT3_CC_SOFTWARE_RESET 0x01
#define AMBIENT3_RETVAL
Definition ambient3.h:77
void ambient3_hardware_reset(ambient3_t *ctx)
Hardware reset function.
void ambient3_default_cfg(ambient3_t *ctx)
Default Config Initialization function.
uint8_t ambient3_get_device_temperature(ambient3_t *ctx)
Getting temperature function.
uint16_t ambient3_get_data_in_lux(ambient3_t *ctx)
This function reads data in LUX.
void ambient3_cfg_setup(ambient3_cfg_t *cfg)
Config Object Initialization function.
uint8_t ambient3_get_interrupt(ambient3_t *ctx)
This function reads interrupt state.
uint8_t ambient3_read_byte(ambient3_t *ctx, uint8_t virtual_reg)
Read function.
void ambient3_write_byte(ambient3_t *ctx, uint8_t virtual_reg, uint8_t data_buf)
Write function.
uint16_t ambient3_get_cct_data(ambient3_t *ctx)
This function reads CCT data in K.
AMBIENT3_RETVAL ambient3_init(ambient3_t *ctx, ambient3_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition ambient3.h:268
uint32_t i2c_speed
Definition ambient3.h:281
pin_name_t scl
Definition ambient3.h:271
pin_name_t int_pin
Definition ambient3.h:277
pin_name_t sda
Definition ambient3.h:272
pin_name_t rst
Definition ambient3.h:276
uint8_t i2c_address
Definition ambient3.h:282
Click ctx object definition.
Definition ambient3.h:245
digital_in_t int_pin
Definition ambient3.h:252
i2c_master_t i2c
Definition ambient3.h:256
digital_out_t rst
Definition ambient3.h:248
uint8_t slave_address
Definition ambient3.h:260