39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define AMBIENT22_REG_RESULT 0x00
74#define AMBIENT22_REG_CONFIGURATION 0x01
75#define AMBIENT22_REG_LOW_LIMIT 0x02
76#define AMBIENT22_REG_HIGH_LIMIT 0x03
77#define AMBIENT22_REG_MANUFACTURER_ID 0x7E
78#define AMBIENT22_REG_DEVICE_ID 0x7F
96#define AMBIENT22_CONFIG_RN_AUTO_SCALE 0xC000u
97#define AMBIENT22_CONFIG_RN_MASK 0xF000u
98#define AMBIENT22_CONFIG_CT_100_mS 0x0000u
99#define AMBIENT22_CONFIG_CT_800_mS 0x0800u
100#define AMBIENT22_CONFIG_CT_MASK 0x0800u
101#define AMBIENT22_CONFIG_M_SHUTDOWN 0x0000u
102#define AMBIENT22_CONFIG_M_SINGLE 0x0200u
103#define AMBIENT22_CONFIG_M_CONTINUOUS 0x0400u
104#define AMBIENT22_CONFIG_M_MASK 0x0600u
105#define AMBIENT22_CONFIG_OVF_MASK 0x0100u
106#define AMBIENT22_CONFIG_CRF_MASK 0x0080u
107#define AMBIENT22_CONFIG_FH_MASK 0x0040u
108#define AMBIENT22_CONFIG_FL_MASK 0x0020u
109#define AMBIENT22_CONFIG_L_TRANSPARENT 0x0000u
110#define AMBIENT22_CONFIG_L_LATCH 0x0010u
111#define AMBIENT22_CONFIG_L_MASK 0x0010u
112#define AMBIENT22_CONFIG_POL_LOW 0x0000u
113#define AMBIENT22_CONFIG_POL_HIGH 0x0008u
114#define AMBIENT22_CONFIG_POL_MASK 0x0008u
115#define AMBIENT22_CONFIG_ME_MASK 0x0004u
116#define AMBIENT22_CONFIG_FC_ONE 0x0000u
117#define AMBIENT22_CONFIG_FC_TWO 0x0001u
118#define AMBIENT22_CONFIG_FC_FOUR 0x0002u
119#define AMBIENT22_CONFIG_FC_EIGHT 0x0003u
120#define AMBIENT22_CONFIG_FC_MASK 0x0003u
126#define AMBIENT22_RESULT_EXP 0xF000u
127#define AMBIENT22_RESULT_FRACT 0x0FFFu
128#define AMBIENT22_RESULT_MIN 0x0000u
129#define AMBIENT22_RESULT_MAX 0xBFFFu
130#define AMBIENT22_RESULT_LUX_PER_LSB 0.02f
136#define AMBIENT22_MANUFACTURER_ID 0x5449u
137#define AMBIENT22_DEVICE_ID 0x3001u
144#define AMBIENT22_DEVICE_ADDRESS_0 0x44
145#define AMBIENT22_DEVICE_ADDRESS_1 0x45
163#define AMBIENT22_MAP_MIKROBUS( cfg, mikrobus ) \
164 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
165 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
166 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
ambient22_return_value_t
Ambient 22 Click return value data.
Definition ambient22.h:209
@ AMBIENT22_OK
Definition ambient22.h:210
@ AMBIENT22_ERROR
Definition ambient22.h:211
err_t ambient22_write_register(ambient22_t *ctx, uint8_t reg, uint16_t data_in)
Ambient 22 write register function.
err_t ambient22_default_cfg(ambient22_t *ctx)
Ambient 22 default configuration function.
err_t ambient22_read_lux(ambient22_t *ctx, float *lux)
Ambient 22 read lux function.
err_t ambient22_init(ambient22_t *ctx, ambient22_cfg_t *cfg)
Ambient 22 initialization function.
err_t ambient22_read_register(ambient22_t *ctx, uint8_t reg, uint16_t *data_out)
Ambient 22 read register function.
void ambient22_cfg_setup(ambient22_cfg_t *cfg)
Ambient 22 configuration object setup function.
uint8_t ambient22_get_int_pin(ambient22_t *ctx)
Ambient 22 get int pin function.
err_t ambient22_check_communication(ambient22_t *ctx)
Ambient 22 check communication function.
Ambient 22 Click configuration object.
Definition ambient22.h:193
uint32_t i2c_speed
Definition ambient22.h:199
pin_name_t scl
Definition ambient22.h:194
pin_name_t int_pin
Definition ambient22.h:197
pin_name_t sda
Definition ambient22.h:195
uint8_t i2c_address
Definition ambient22.h:200
Ambient 22 Click context object.
Definition ambient22.h:176
digital_in_t int_pin
Definition ambient22.h:178
i2c_master_t i2c
Definition ambient22.h:181
uint8_t slave_address
Definition ambient22.h:184