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 AMBIENT20_SYSTEM_CONTROL_REG 0x40
74#define AMBIENT20_MODE_CONTROL1_REG 0x41
75#define AMBIENT20_MODE_CONTROL2_REG 0x42
76#define AMBIENT20_MODE_CONTROL3_REG 0x43
77#define AMBIENT20_DATA0_LSB_REG 0x50
78#define AMBIENT20_DATA0_MSB_REG 0x51
79#define AMBIENT20_DATA1_LSB_REG 0x52
80#define AMBIENT20_DATA1_MSB_REG 0x53
81#define AMBIENT20_MANUFACTURER_ID_REG 0x92
99#define AMBIENT20_GAIN_X1 0x02
100#define AMBIENT20_GAIN_X32 0x0A
101#define AMBIENT20_GAIN_X256 0x0C
102#define AMBIENT20_100mS_MODE 0x00
103#define AMBIENT20_55mS_MODE 0x01
104#define AMBIENT20_VALID_MASK 0x80
105#define AMBIENT20_ENABLE 0x01
106#define AMBIENT20_DISABLE 0x00
107#define AMBIENT20_MANUFACTURER_ID 0xE0
108#define AMBIENT20_PART_ID 0x12
109#define AMBIENT20_PART_ID_MASK 0x3F
117#define AMBIENT20_DATA0_CONVERSION_COEF 0.169491525
118#define AMBIENT20_DATA1_CONVERSION_COEF 0.689655172
125#define AMBIENT20_DEVICE_ADDRESS 0x38
143#define AMBIENT20_MAP_MIKROBUS( cfg, mikrobus ) \
144 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
145 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
ambient20_return_value_t
Ambient 20 Click return value data.
Definition ambient20.h:186
@ AMBIENT20_OK
Definition ambient20.h:187
@ AMBIENT20_ERROR
Definition ambient20.h:188
err_t ambient20_default_cfg(ambient20_t *ctx)
Ambient 20 default configuration function.
err_t ambient20_generic_read(ambient20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Ambient 20 I2C reading function.
err_t ambient20_get_manufacturer_id(ambient20_t *ctx, uint8_t *manufacturer_id)
Ambient 20 read manufacturer id function.
void ambient20_cfg_setup(ambient20_cfg_t *cfg)
Ambient 20 configuration object setup function.
err_t ambient20_get_part_id(ambient20_t *ctx, uint8_t *part_id)
Ambient 20 read part id function.
err_t ambient20_get_data_lux(ambient20_t *ctx, float *data0_out, float *data1_out)
Ambient 20 read light function.
err_t ambient20_enable_wait_mode(ambient20_t *ctx)
Ambient 20 enable wait mode function.
err_t ambient20_generic_write(ambient20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Ambient 20 I2C writing function.
err_t ambient20_enable_meas(ambient20_t *ctx)
Ambient 20 enable measurements function.
err_t ambient20_set_gain(ambient20_t *ctx, uint8_t data0_gain, uint8_t data1_gain)
Ambient 20 set data gain function.
err_t ambient20_set_meas_mode(ambient20_t *ctx, uint8_t meas_mode)
Ambient 20 set measurement mode function.
err_t ambient20_disable_meas(ambient20_t *ctx)
Ambient 20 disable measurements function.
err_t ambient20_disable_wait_mode(ambient20_t *ctx)
Ambient 20 disable wait mode function.
err_t ambient20_init(ambient20_t *ctx, ambient20_cfg_t *cfg)
Ambient 20 initialization function.
err_t ambient20_check_valid(ambient20_t *ctx)
Ambient 20 check valid bit function.
err_t ambient20_read_data1(ambient20_t *ctx, uint16_t *data1_out)
Ambient 20 read data1 function.
err_t ambient20_sw_reset(ambient20_t *ctx)
Ambient 20 software reset function.
err_t ambient20_read_data0(ambient20_t *ctx, uint16_t *data0_out)
Ambient 20 read data0 function.
Ambient 20 Click configuration object.
Definition ambient20.h:172
uint32_t i2c_speed
Definition ambient20.h:176
pin_name_t scl
Definition ambient20.h:173
pin_name_t sda
Definition ambient20.h:174
uint8_t i2c_address
Definition ambient20.h:177
Ambient 20 Click context object.
Definition ambient20.h:155
uint8_t data0_gain
Definition ambient20.h:162
i2c_master_t i2c
Definition ambient20.h:157
uint8_t data1_gain
Definition ambient20.h:163
uint8_t slave_address
Definition ambient20.h:160