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_analog_in.h"
52#include "drv_i2c_master.h"
74#define AMBIENT18_MODE_SHUTDOWN 0
75#define AMBIENT18_MODE_H_GAIN 1
76#define AMBIENT18_MODE_M_GAIN 2
77#define AMBIENT18_MODE_L_GAIN 3
83#define AMBIENT18_ADC_RESOLUTION 0x0FFF
84#define AMBIENT18_VREF_3V3 3.3
85#define AMBIENT18_VREF_5V 5.0
91#define AMBIENT18_IOUT_CURRENT_H_GAIN 6.1
92#define AMBIENT18_IOUT_CURRENT_M_GAIN 0.61
93#define AMBIENT18_IOUT_CURRENT_L_GAIN 0.061
94#define AMBIENT18_MICROAMPER_TO_AMPER 0.000001
95#define AMBIENT18_IOUT_RESISTOR 5420
102#define AMBIENT18_SET_DEV_ADDR 0x4D
120#define AMBIENT18_MAP_MIKROBUS( cfg, mikrobus ) \
121 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
122 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
123 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
124 cfg.gc1 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
125 cfg.gc2 = MIKROBUS( mikrobus, MIKROBUS_PWM )
ambient18_drv_t
Ambient 18 Click driver selector.
Definition ambient18.h:135
@ AMBIENT18_DRV_SEL_I2C
Definition ambient18.h:137
@ AMBIENT18_DRV_SEL_ADC
Definition ambient18.h:136
ambient18_return_value_t
Ambient 18 Click return value data.
Definition ambient18.h:188
@ AMBIENT18_ERROR
Definition ambient18.h:190
@ AMBIENT18_OK
Definition ambient18.h:189
void ambient18_drv_interface_selection(ambient18_cfg_t *cfg, ambient18_drv_t drv_sel)
Ambient 18 driver interface setup function.
err_t ambient18_set_vref(ambient18_t *ctx, float vref)
Ambient 18 set vref function.
void ambient18_cfg_setup(ambient18_cfg_t *cfg)
Ambient 18 configuration object setup function.
err_t ambient18_read_raw_adc(ambient18_t *ctx, uint16_t *raw_adc)
Ambient 18 read raw ADC value function.
void ambient18_set_gain_mode(ambient18_t *ctx, uint8_t mode)
Ambient 18 set gain mode function.
int32_t ambient18_voltage_to_lux(ambient18_t *ctx, float voltage)
Ambient 18 voltage to illuminance function.
err_t ambient18_read_voltage(ambient18_t *ctx, float *voltage)
Ambient 18 read voltage level function.
err_t ambient18_init(ambient18_t *ctx, ambient18_cfg_t *cfg)
Ambient 18 initialization function.
Ambient 18 Click configuration object.
Definition ambient18.h:166
pin_name_t gc1
Definition ambient18.h:170
analog_in_resolution_t resolution
Definition ambient18.h:173
float vref
Definition ambient18.h:174
uint32_t i2c_speed
Definition ambient18.h:176
pin_name_t scl
Definition ambient18.h:168
pin_name_t gc2
Definition ambient18.h:171
ambient18_drv_t drv_sel
Definition ambient18.h:179
pin_name_t sda
Definition ambient18.h:169
pin_name_t an
Definition ambient18.h:167
uint8_t i2c_address
Definition ambient18.h:177
Ambient 18 Click context object.
Definition ambient18.h:146
digital_out_t gc1
Definition ambient18.h:147
float vref
Definition ambient18.h:155
i2c_master_t i2c
Definition ambient18.h:151
uint8_t gain_mode
Definition ambient18.h:157
uint8_t slave_address
Definition ambient18.h:153
ambient18_drv_t drv_sel
Definition ambient18.h:156
digital_out_t gc2
Definition ambient18.h:148
pin_name_t chip_select
Definition ambient18.h:154
analog_in_t adc
Definition ambient18.h:150