42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_i2c_master.h"
65#define AMBIENT6_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
67 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
74#define AMBIENT6_RETVAL uint8_t
76#define AMBIENT6_OK 0x00
77#define AMBIENT6_INIT_ERROR 0xFF
84#define AMBIENT6_CMD_CONFIGURATION 0x00
85#define AMBIENT6_CMD_THRESHOLD_HIGH_SETTINGS 0x01
86#define AMBIENT6_CMD_THRESHOLD_LOW_SETTINGS 0x02
87#define AMBIENT6_CMD_MODE_SETTINGS 0x03
88#define AMBIENT6_CMD_ALS_DATA 0x04
89#define AMBIENT6_CMD_WHITE_DATA 0x05
90#define AMBIENT6_CMD_ALS_THRESHOLD_INTERRUPT 0x06
97#define AMBIENT6_CFG_ALS_SENSITIVITY_X1 0x0000 << 11
98#define AMBIENT6_CFG_ALS_SENSITIVITY_X2 0x0001 << 11
99#define AMBIENT6_CFG_ALS_SENSITIVITY_X1_8 0x0002 << 11
100#define AMBIENT6_CFG_ALS_SENSITIVITY_X1_4 0x0003 << 11
101#define AMBIENT6_CFG_ALS_TIME_SETTING_25MS 0x000C << 6
102#define AMBIENT6_CFG_ALS_TIME_SETTING_50MS 0x0008 << 6
103#define AMBIENT6_CFG_ALS_TIME_SETTING_100MS 0x0000
104#define AMBIENT6_CFG_ALS_TIME_SETTING_200MS 0x0001 << 6
105#define AMBIENT6_CFG_ALS_TIME_SETTING_400MS 0x0002 << 6
106#define AMBIENT6_CFG_ALS_TIME_SETTING_800MS 0x0003 << 6
107#define AMBIENT6_CFG_PERSISTENCE_NUMBER_1 0x0000 << 4
108#define AMBIENT6_CFG_PERSISTENCE_NUMBER_2 0x0001 << 4
109#define AMBIENT6_CFG_PERSISTENCE_NUMBER_4 0x0002 << 4
110#define AMBIENT6_CFG_PERSISTENCE_NUMBER_8 0x0003 << 4
111#define AMBIENT6_CFG_ALS_INT_DISABLE 0x0000
112#define AMBIENT6_CFG_ALS_INT_ENABLE 0x0001 << 1
113#define AMBIENT6_CFG_ALS_POWER_ON 0x0000
114#define AMBIENT6_CFG_ALS_SHUT_DOWN 0x0001
121#define AMBIENT6_POWER_MODE_1 0x0000
122#define AMBIENT6_POWER_MODE_2 0x0002
123#define AMBIENT6_POWER_MODE_3 0x0004
124#define AMBIENT6_POWER_MODE_4 0x0006
125#define AMBIENT6_POWER_MODE_ENABLE 0x0001
126#define AMBIENT6_POWER_MODE_DISABLE 0x0000
133#define AMBIENT6_DEVICE_SLAVE_ADDRESS 0x10
#define AMBIENT6_RETVAL
Definition ambient6.h:74
float ambient6_get_ambient_light(ambient6_t *ctx)
Functions for get Ambient Light Data.
void ambient6_generic_read(ambient6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint16_t ambient6_get_ambient_data(ambient6_t *ctx)
Functions for read 16bit Ambient Data (ALS)
void ambient6_generic_write(ambient6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
AMBIENT6_RETVAL ambient6_init(ambient6_t *ctx, ambient6_cfg_t *cfg)
Initialization function.
void ambient6_cfg_setup(ambient6_cfg_t *cfg)
Config Object Initialization function.
void ambient6_settings(ambient6_t *ctx, uint16_t config_data)
Functions for configuration device for measurement.
void ambient6_default_cfg(ambient6_t *ctx)
Click Default Configuration function.
Click configuration structure definition.
Definition ambient6.h:165
uint32_t i2c_speed
Definition ambient6.h:173
pin_name_t scl
Definition ambient6.h:168
pin_name_t sda
Definition ambient6.h:169
uint8_t i2c_address
Definition ambient6.h:174
Click ctx object definition.
Definition ambient6.h:147
float c_gain
Definition ambient6.h:156
float c_time
Definition ambient6.h:157
i2c_master_t i2c
Definition ambient6.h:150
uint8_t slave_address
Definition ambient6.h:154