37#ifndef DRIVER_VEML7700_H
38#define DRIVER_VEML7700_H
62#ifndef VEML7700_AUTO_RANGE_HIGH_THRESHOLD
63 #define VEML7700_AUTO_RANGE_HIGH_THRESHOLD 0xFF00U
69#ifndef VEML7700_AUTO_RANGE_LOW_THRESHOLD
70 #define VEML7700_AUTO_RANGE_LOW_THRESHOLD 0x00FFU
151 uint8_t (*
iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
152 uint8_t (*
iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
192#define DRIVER_VEML7700_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
200#define DRIVER_VEML7700_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
208#define DRIVER_VEML7700_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
216#define DRIVER_VEML7700_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
224#define DRIVER_VEML7700_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
232#define DRIVER_VEML7700_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
240#define DRIVER_VEML7700_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t veml7700_get_interrupt_status(veml7700_handle_t *handle, veml7700_bool_t *low_threshold, veml7700_bool_t *high_threshold)
get interrupt status
uint8_t veml7700_set_als_integration_time(veml7700_handle_t *handle, veml7700_als_integration_time_t t)
set als integration time
veml7700_bool_t
veml7700 bool enumeration definition
uint8_t veml7700_deinit(veml7700_handle_t *handle)
close the chip
uint8_t veml7700_set_als_interrupt(veml7700_handle_t *handle, veml7700_bool_t enable)
enable or disable als interrupt
uint8_t veml7700_get_als_persistence(veml7700_handle_t *handle, veml7700_als_persistence_t *persistence)
get als persistence
uint8_t veml7700_read_white(veml7700_handle_t *handle, uint16_t *raw)
read white channel
uint8_t veml7700_get_power_saving_mode(veml7700_handle_t *handle, veml7700_power_saving_mode_t *mode)
get power saving mode
uint8_t veml7700_info(veml7700_info_t *info)
get chip's information
uint8_t veml7700_get_als_low_threshold(veml7700_handle_t *handle, uint16_t *threshold)
get als low threshold
struct veml7700_info_s veml7700_info_t
veml7700 information structure definition
uint8_t veml7700_init(veml7700_handle_t *handle)
initialize the chip
uint8_t veml7700_read_als(veml7700_handle_t *handle, uint16_t *raw, double *lux)
read als channel
uint8_t veml7700_set_als_mode(veml7700_handle_t *handle, veml7700_als_mode_t mode)
set als mode
uint8_t veml7700_set_als_gain(veml7700_handle_t *handle, veml7700_als_gain_t gain)
set als gain
veml7700_power_saving_mode_t
veml7700 power saving mode enumeration definition
uint8_t veml7700_get_als_gain(veml7700_handle_t *handle, veml7700_als_gain_t *gain)
get als gain
uint8_t veml7700_get_als_high_threshold(veml7700_handle_t *handle, uint16_t *threshold)
get als high threshold
struct veml7700_handle_s veml7700_handle_t
veml7700 handle structure definition
uint8_t veml7700_get_als_interrupt(veml7700_handle_t *handle, veml7700_bool_t *enable)
get als interrupt status
veml7700_als_integration_time_t
veml7700 als integration time enumeration definition
uint8_t veml7700_set_als_persistence(veml7700_handle_t *handle, veml7700_als_persistence_t persistence)
set als persistence
veml7700_als_gain_t
veml7700 als gain enumeration definition
uint8_t veml7700_set_als_low_threshold(veml7700_handle_t *handle, uint16_t threshold)
set als low threshold
uint8_t veml7700_get_als_integration_time(veml7700_handle_t *handle, veml7700_als_integration_time_t *t)
get als integration time
uint8_t veml7700_set_als_high_threshold(veml7700_handle_t *handle, uint16_t threshold)
set als high threshold
uint8_t veml7700_get_auto_range(veml7700_handle_t *handle, veml7700_bool_t *enable)
get auto range
uint8_t veml7700_get_power_saving(veml7700_handle_t *handle, veml7700_bool_t *enable)
get power saving status
uint8_t veml7700_set_auto_range(veml7700_handle_t *handle, veml7700_bool_t enable)
set auto range
veml7700_als_persistence_t
veml7700 als persistence enumeration definition
veml7700_als_mode_t
veml7700 als mode enumeration definition
uint8_t veml7700_set_power_saving(veml7700_handle_t *handle, veml7700_bool_t enable)
enable or disable power saving
uint8_t veml7700_set_power_saving_mode(veml7700_handle_t *handle, veml7700_power_saving_mode_t mode)
set power saving mode
uint8_t veml7700_get_als_mode(veml7700_handle_t *handle, veml7700_als_mode_t *mode)
get als mode
@ VEML7700_POWER_SAVING_MODE3
@ VEML7700_POWER_SAVING_MODE2
@ VEML7700_POWER_SAVING_MODE4
@ VEML7700_POWER_SAVING_MODE1
@ VEML7700_ALS_INTEGRATION_TIME_400MS
@ VEML7700_ALS_INTEGRATION_TIME_50MS
@ VEML7700_ALS_INTEGRATION_TIME_25MS
@ VEML7700_ALS_INTEGRATION_TIME_200MS
@ VEML7700_ALS_INTEGRATION_TIME_800MS
@ VEML7700_ALS_INTEGRATION_TIME_100MS
@ VEML7700_ALS_GAIN_1_DIV_4
@ VEML7700_ALS_GAIN_1_DIV_8
@ VEML7700_ALS_PERSISTENCE_1
@ VEML7700_ALS_PERSISTENCE_2
@ VEML7700_ALS_PERSISTENCE_8
@ VEML7700_ALS_PERSISTENCE_4
@ VEML7700_ALS_MODE_SHUT_DOWN
@ VEML7700_ALS_MODE_POWER_ON
uint8_t veml7700_set_reg(veml7700_handle_t *handle, uint8_t reg, uint16_t data)
set the chip register
uint8_t veml7700_get_reg(veml7700_handle_t *handle, uint8_t reg, uint16_t *data)
get the chip register
veml7700 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
veml7700 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v