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"
66#define AMBIENT5_DEVICE_ADDRESS 0x10
73#define AMBIENT5_MAP_MIKROBUS( cfg, mikrobus ) \
74 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
75 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
76 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
83#define AMBIENT5_RETVAL uint8_t
85#define AMBIENT5_OK 0x00
86#define AMBIENT5_INIT_ERROR 0xFF
93#define AMBIENT5_CONFIGURATION 0x00
94#define AMBIENT5_HIGH_THRESHOLD 0x01
95#define AMBIENT5_LOW_THRESHOLD 0x02
96#define AMBIENT5_POWER_SAVING_MODE 0x03
97#define AMBIENT5_HIGH_RESOLUTION_OUTPUT_DATA 0x04
98#define AMBIENT5_WHITE_CHANNEL_OUTPUT_DATA 0x05
99#define AMBIENT5_INTERRUPT_STATUS 0x06
106#define AMBIENT5_GAIN_x1 0x0000
107#define AMBIENT5_GAIN_x2 0x0800
108#define AMBIENT5_GAIN_x1_8 0x1000
109#define AMBIENT5_GAIN_x1_4 0x1800
110#define AMBIENT5_INTEGRATION_TIME_25ms 0x0300
111#define AMBIENT5_INTEGRATION_TIME_50ms 0x0200
112#define AMBIENT5_INTEGRATION_TIME_100ms 0x0000
113#define AMBIENT5_INTEGRATION_TIME_200ms 0x0040
114#define AMBIENT5_INTEGRATION_TIME_400ms 0x0080
115#define AMBIENT5_INTEGRATION_TIME_800ms 0x00C0
116#define AMBIENT5_PERSISTANCE_PROTECT_NUMBER_1 0x0000
117#define AMBIENT5_PERSISTANCE_PROTECT_NUMBER_2 0x0010
118#define AMBIENT5_PERSISTANCE_PROTECT_NUMBER_4 0x0020
119#define AMBIENT5_PERSISTANCE_PROTECT_NUMBER_8 0x0030
120#define AMBIENT5_INTERRUPT_DISABLE 0x0000
121#define AMBIENT5_INTERRUPT_ENABLE 0x0002
122#define AMBIENT5_POWER_ON 0x0000
123#define AMBIENT5_SHUT_DOWN 0x0001
130#define AMBIENT5_MODE_1 0x0000
131#define AMBIENT5_MODE_2 0x0002
132#define AMBIENT5_MODE_3 0x0004
133#define AMBIENT5_MODE_4 0x0006
134#define AMBIENT5_POWER_SAVING_MODE_DISABLE 0x0000
135#define AMBIENT5_POWER_SAVING_MODE_ENABLE 0x0001
239 uint16_t reg_value );
307 float low_light_level_threshold );
319 float high_light_level_threshold );
#define AMBIENT5_RETVAL
Definition ambient5.h:83
AMBIENT5_RETVAL ambient5_init(ambient5_t *ctx, ambient5_cfg_t *cfg)
Initialization function.
void ambient5_default_cfg(ambient5_t *ctx)
Default configuration function.
uint8_t ambient5_checkIntPin(ambient5_t *ctx)
Checking INT pin state.
float ambient5_get_white_channel_light_level(ambient5_t *ctx)
Get white channel light level.
uint16_t ambient5_get_refresh_time(ambient5_t *ctx)
Get refresh time.
void ambient5_power_on(ambient5_t *ctx)
Set high light level threshold.
void ambient5_cfg_setup(ambient5_cfg_t *cfg)
Config Object Initialization function.
float ambient5_get_high_resolution_light_level(ambient5_t *ctx)
Get high resolution light level.
float ambient5_get_resolution(ambient5_t *ctx)
Get resolution.
uint16_t ambient5_get_register(ambient5_t *ctx, uint8_t reg)
Get register function.
void ambient5_set_low_light_level_threshold(ambient5_t *ctx, float low_light_level_threshold)
Set low light level threshold.
void ambient5_set_register(ambient5_t *ctx, uint8_t reg_addr, uint16_t reg_value)
Set register function.
void ambient5_set_high_light_level_threshold(ambient5_t *ctx, float high_light_level_threshold)
Set high light level threshold.
Click configuration structure definition.
Definition ambient5.h:171
uint32_t i2c_speed
Definition ambient5.h:183
pin_name_t scl
Definition ambient5.h:174
pin_name_t int_pin
Definition ambient5.h:179
pin_name_t sda
Definition ambient5.h:175
uint8_t i2c_address
Definition ambient5.h:184
Click ctx object definition.
Definition ambient5.h:151
digital_in_t int_pin
Definition ambient5.h:155
i2c_master_t i2c
Definition ambient5.h:159
uint8_t slave_address
Definition ambient5.h:163