Go to the documentation of this file.
38 #include "drv_digital_in.h"
39 #include "drv_i2c_master.h"
52 #define AMBIENT2_CFG_RANGE_40_95_LX_MIN 0x0
53 #define AMBIENT2_CFG_RANGE_81_9_LX 0x1000
54 #define AMBIENT2_CFG_RANGE_163_8_LX 0x2000
55 #define AMBIENT2_CFG_RANGE_327_6_LX 0x3000
56 #define AMBIENT2_CFG_RANGE_655_2_LX 0x4000
57 #define AMBIENT2_CFG_RANGE_1310_4_LX 0x5000
58 #define AMBIENT2_CFG_RANGE_2620_8_LX 0x6000
59 #define AMBIENT2_CFG_RANGE_5241_6_LX 0x7000
60 #define AMBIENT2_CFG_RANGE_10483_2_LX 0x8000
61 #define AMBIENT2_CFG_RANGE_20966_4_LX 0x9000
62 #define AMBIENT2_CFG_RANGE_41932_8_LX 0xA000
63 #define AMBIENT2_CFG_RANGE_83865_6_LX_MAX 0xB000
64 #define AMBIENT2_CFG_RANGE_AUTO_SCALE 0xC000
71 #define AMBIENT2_CFG_CONV_TIME_100MS 0x0
72 #define AMBIENT2_CFG_CONV_TIME_800MS 0x800
79 #define AMBIENT2_CFG_CONV_MODE_SHUTDOWN 0x0
80 #define AMBIENT2_CFG_CONV_MODE_SINGLE_SHOT 0x200
81 #define AMBIENT2_CFG_CONV_MODE_CONT_CONV 0x400
88 #define AMBIENT2_CFG_LATCH_COMP_HYSTERESIS_STYLE 0x0
89 #define AMBIENT2_CFG_LATCH_COMP_WINDOW_STYLE 0x10
96 #define AMBIENT2_CFG_POL_INT_ACTIVE_LOW 0x0
97 #define AMBIENT2_CFG_POL_INT_ACTIVE_HIGH 0x8
104 #define AMBIENT2_CFG_MASK_EXPONENT 0x4
111 #define AMBIENT2_CFG_FAULT_1_COUNT 0x0
112 #define AMBIENT2_CFG_FAULT_2_COUNTS 0x1
113 #define AMBIENT2_CFG_FAULT_4_COUNTS 0x2
114 #define AMBIENT2_CFG_FAULT_8_COUNTS 0x3
121 #define AMBIENT2_FLAG_MASK_OVERFLOW 0x100
122 #define AMBIENT2_FLAG_MASK_CONV_READY 0x80
123 #define AMBIENT2_FLAG_MASK_HIGH 0x40
124 #define AMBIENT2_FLAG_MASK_LOW 0x20
131 #define AMBIENT2_ID_MANUFACTURER 0x5449
132 #define AMBIENT2_ID_DEVICE 0x3001
139 #define AMBIENT2_MAP_MIKROBUS( cfg, mikrobus ) \
140 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
141 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
142 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
334 #endif // _AMBIENT2_H_
void ambient2_generic_write(ambient2_t *ctx, ambient2_reg_addr_t reg_addr, ambient2_data_t data_in)
Generic Write function.
Definition: ambient2.h:173
float amb_light_range
Definition: ambient2.h:200
Click context object definition.
Definition: ambient2.h:208
Definition: ambient2.h:187
void ambient2_get_sens_results(ambient2_t *ctx)
Sensor Results Read function.
Definition: ambient2.h:188
uint8_t amb_light_per
Definition: ambient2.h:201
ambient2_i2c_addr_t slave_addr
Definition: ambient2.h:217
ambient2_err_t ambient2_init(ambient2_t *ctx, ambient2_cfg_t *cfg)
Click Initialization function.
ambient2_reg_addr_t
Click register address selection.
Definition: ambient2.h:183
Click configuration structure definition.
Definition: ambient2.h:227
ambient2_i2c_addr_t
Click I2C address selection.
Definition: ambient2.h:171
void ambient2_cfg_setup(ambient2_cfg_t *cfg)
Configuration Object Setup function.
void ambient2_default_cfg(ambient2_t *ctx)
Click Default Configuration function.
pin_name_t int_pin
Definition: ambient2.h:234
Definition: ambient2.h:164
hal_i2c_speed_t i2c_speed
Definition: ambient2.h:237
digital_in_t int_pin
Definition: ambient2.h:211
Definition: ambient2.h:190
ambient2_i2c_addr_t i2c_addr
Definition: ambient2.h:238
i2c_master_t i2c
Definition: ambient2.h:214
Definition: ambient2.h:175
Definition: ambient2.h:176
pin_name_t sda
Definition: ambient2.h:231
Definition: ambient2.h:162
Definition: ambient2.h:189
ambient2_err_t
Click error code definition.
Definition: ambient2.h:160
Definition: ambient2.h:163
Definition: ambient2.h:186
uint16_t ambient2_data_t
Click registers data type.
Definition: ambient2.h:155
pin_name_t scl
Definition: ambient2.h:230
ambient2_sens_data_t sens_data
Definition: ambient2.h:220
ambient2_data_t ambient2_generic_read(ambient2_t *ctx, ambient2_reg_addr_t reg_addr)
Generic Read function.
Definition: ambient2.h:185
Click sensor data definition.
Definition: ambient2.h:197
Definition: ambient2.h:174
float amb_light_lx
Definition: ambient2.h:199
digital_in_data_t ambient2_get_int(ambient2_t *ctx)
INT Pin Check function.