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"
75#define AMBIENT12_SET_DEV_ADDR 0x4D
81#define AMBIENT12_ADC_RESOLUTION 0x0FFF
82#define AMBIENT12_VREF_3V3 3.3
88#define AMBIENT12_IOUT_CURRENT_H_GAIN 0.57
89#define AMBIENT12_IOUT_CURRENT_M_GAIN 0.057
90#define AMBIENT12_IOUT_CURRENT_L_GAIN 0.0057
91#define AMBIENT12_MICROAMPER_TO_AMPER 0.000001
92#define AMBIENT12_IOUT_RESISTOR 5700
110#define AMBIENT12_MAP_MIKROBUS( cfg, mikrobus ) \
111 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
112 cfg.gc1 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
113 cfg.gc2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
114 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
115 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
ambient12_return_value_t
Ambient 12 Click return value data.
Definition ambient12.h:175
@ AMBIENT12_ERROR
Definition ambient12.h:177
@ AMBIENT12_OK
Definition ambient12.h:176
ambient12_gain_mode_t
Ambient 12 Click gain mode setting.
Definition ambient12.h:125
@ AMBIENT12_MODE_M_GAIN
Definition ambient12.h:128
@ AMBIENT12_MODE_L_GAIN
Definition ambient12.h:129
@ AMBIENT12_MODE_H_GAIN
Definition ambient12.h:127
@ AMBIENT12_MODE_SHUTDOWN
Definition ambient12.h:126
void ambient12_set_gc1_pin(ambient12_t *ctx, uint8_t state)
Ambient 12 set GC1 pin state function.
err_t ambient12_read_an_pin_value(ambient12_t *ctx, uint16_t *data_out)
Ambient 12 read AN pin value function.
void ambient12_cfg_setup(ambient12_cfg_t *cfg)
Ambient 12 configuration object setup function.
err_t ambient12_read_adc_voltage(ambient12_t *ctx, float *voltage)
Ambient 12 read ADC voltage function.
int32_t ambient12_voltage_to_lux(ambient12_t *ctx, float voltage)
Ambient 12 voltage to illuminance function.
void ambient12_set_gain_mode(ambient12_t *ctx, uint8_t mode)
Ambient 12 set gain mode function.
err_t ambient12_init(ambient12_t *ctx, ambient12_cfg_t *cfg)
Ambient 12 initialization function.
void ambient12_set_gc2_pin(ambient12_t *ctx, uint8_t state)
Ambient 12 set GC2 pin state function.
err_t ambient12_read_an_pin_voltage(ambient12_t *ctx, float *data_out)
Ambient 12 read AN pin voltage level function.
err_t ambient12_read_raw_adc(ambient12_t *ctx, uint16_t *raw_adc)
Ambient 12 read raw ADC function.
Ambient 12 Click configuration object.
Definition ambient12.h:155
pin_name_t gc1
Definition ambient12.h:157
analog_in_resolution_t resolution
Definition ambient12.h:165
float vref
Definition ambient12.h:166
uint32_t i2c_speed
Definition ambient12.h:162
pin_name_t scl
Definition ambient12.h:159
pin_name_t gc2
Definition ambient12.h:158
pin_name_t sda
Definition ambient12.h:160
pin_name_t an
Definition ambient12.h:156
uint8_t i2c_address
Definition ambient12.h:163
Ambient 12 Click context object.
Definition ambient12.h:138
digital_out_t gc1
Definition ambient12.h:139
i2c_master_t i2c
Definition ambient12.h:143
ambient12_gain_mode_t gain_mode
Definition ambient12.h:146
uint8_t slave_address
Definition ambient12.h:145
digital_out_t gc2
Definition ambient12.h:140
analog_in_t adc
Definition ambient12.h:142