42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
67#define AMBIENT11_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define AMBIENT11_RETVAL uint8_t
79#define AMBIENT11_OK 0x00
80#define AMBIENT11_INIT_ERROR 0xFF
87#define AMBIENT11_SLAVE_ADDRESS 0x29
94#define AMBIENT11_ALS_CONF_WR 0x00
95#define AMBIENT11_TRSHLD_WINDOW_SET_HIGH 0x01
96#define AMBIENT11_TRSHLD_WINDOW_SET_LOW 0x02
97#define AMBIENT11_ALS_CONF_RD 0x04
98#define AMBIENT11_WHITE_VAL 0x05
99#define AMBIENT11_TRSHLD_TRIG_INT 0x06
106#define AMBIENT11_ALS_CONF_SENS_LOW 0x1000
107#define AMBIENT11_ALS_CONF_DG_DOUBLE 0x0800
108#define AMBIENT11_ALS_CONF_GAIN_DOUBLE_SENS 0x0400
109#define AMBIENT11_ALS_CONF_IT_25 0x0300
110#define AMBIENT11_ALS_CONF_IT_50 0x0200
111#define AMBIENT11_ALS_CONF_IT_100 0x0000
112#define AMBIENT11_ALS_CONF_IT_200 0x0040
113#define AMBIENT11_ALS_CONF_IT_400 0x0080
114#define AMBIENT11_ALS_CONF_IT_800 0x00C0
115#define AMBIENT11_ALS_CONF_PERS_1 0x0000
116#define AMBIENT11_ALS_CONF_PERS_2 0x0010
117#define AMBIENT11_ALS_CONF_PERS_4 0x0020
118#define AMBIENT11_ALS_CONF_PERS_8 0x0030
119#define AMBIENT11_ALS_CONF_INT_CHAN 0x0008
120#define AMBIENT11_ALS_CONF_CHAN_EN 0x0004
121#define AMBIENT11_ALS_CONF_INT_EN 0x0002
122#define AMBIENT11_ALS_CONF_SHUT_DOWN 0x0001
#define AMBIENT11_RETVAL
Definition ambient11.h:77
uint16_t ambient11_generic_read(ambient11_t *ctx, uint8_t reg_addr)
Generic read function.
uint8_t ambient11_check_int(ambient11_t *ctx)
Check interrupt function.
void ambient11_cfg_setup(ambient11_cfg_t *cfg)
Config Object Initialization function.
float ambient11_calc_illumination(ambient11_t *ctx, float typical_res)
Calculate Illumination function.
void ambient11_default_cfg(ambient11_t *ctx)
Click Default Configuration function.
void ambient11_generic_write(ambient11_t *ctx, uint8_t wr_cmd, uint16_t wr_data)
Generic write function.
AMBIENT11_RETVAL ambient11_init(ambient11_t *ctx, ambient11_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition ambient11.h:157
uint32_t i2c_speed
Definition ambient11.h:169
pin_name_t scl
Definition ambient11.h:160
pin_name_t int_pin
Definition ambient11.h:165
pin_name_t sda
Definition ambient11.h:161
uint8_t i2c_address
Definition ambient11.h:170
Click ctx object definition.
Definition ambient11.h:136
digital_in_t int_pin
Definition ambient11.h:141
i2c_master_t i2c
Definition ambient11.h:145
uint8_t slave_address
Definition ambient11.h:149