LibDriver VEML7700
Loading...
Searching...
No Matches
veml7700 basic driver function

veml7700 basic driver modules More...

Collaboration diagram for veml7700 basic driver function:

Data Structures

struct  veml7700_handle_s
 veml7700 handle structure definition More...
struct  veml7700_info_s
 veml7700 information structure definition More...

Macros

#define VEML7700_AUTO_RANGE_HIGH_THRESHOLD   0xFF00U
 veml7700 auto range high threshold definition
#define VEML7700_AUTO_RANGE_LOW_THRESHOLD   0x00FFU
 veml7700 auto range low threshold definition

Typedefs

typedef struct veml7700_handle_s veml7700_handle_t
 veml7700 handle structure definition
typedef struct veml7700_info_s veml7700_info_t
 veml7700 information structure definition

Enumerations

enum  veml7700_bool_t { VEML7700_BOOL_DISABLE = 0x0 , VEML7700_BOOL_ENABLE = 0x1 }
 veml7700 bool enumeration definition More...
enum  veml7700_als_gain_t { VEML7700_ALS_GAIN_1 = 0x0 , VEML7700_ALS_GAIN_2 = 0x1 , VEML7700_ALS_GAIN_1_DIV_8 = 0x2 , VEML7700_ALS_GAIN_1_DIV_4 = 0x3 }
 veml7700 als gain enumeration definition More...
enum  veml7700_als_integration_time_t {
  VEML7700_ALS_INTEGRATION_TIME_25MS = 0xC , VEML7700_ALS_INTEGRATION_TIME_50MS = 0x8 , VEML7700_ALS_INTEGRATION_TIME_100MS = 0x0 , VEML7700_ALS_INTEGRATION_TIME_200MS = 0x1 ,
  VEML7700_ALS_INTEGRATION_TIME_400MS = 0x2 , VEML7700_ALS_INTEGRATION_TIME_800MS = 0x3
}
 veml7700 als integration time enumeration definition More...
enum  veml7700_als_persistence_t { VEML7700_ALS_PERSISTENCE_1 = 0x0 , VEML7700_ALS_PERSISTENCE_2 = 0x1 , VEML7700_ALS_PERSISTENCE_4 = 0x2 , VEML7700_ALS_PERSISTENCE_8 = 0x3 }
 veml7700 als persistence enumeration definition More...
enum  veml7700_als_mode_t { VEML7700_ALS_MODE_POWER_ON = 0x0 , VEML7700_ALS_MODE_SHUT_DOWN = 0x1 }
 veml7700 als mode enumeration definition More...
enum  veml7700_power_saving_mode_t { VEML7700_POWER_SAVING_MODE1 = 0x0 , VEML7700_POWER_SAVING_MODE2 = 0x1 , VEML7700_POWER_SAVING_MODE3 = 0x2 , VEML7700_POWER_SAVING_MODE4 = 0x3 }
 veml7700 power saving mode enumeration definition More...

Functions

uint8_t veml7700_info (veml7700_info_t *info)
 get chip's information
uint8_t veml7700_init (veml7700_handle_t *handle)
 initialize the chip
uint8_t veml7700_deinit (veml7700_handle_t *handle)
 close the chip
uint8_t veml7700_read_als (veml7700_handle_t *handle, uint16_t *raw, double *lux)
 read als channel
uint8_t veml7700_read_white (veml7700_handle_t *handle, uint16_t *raw)
 read white channel
uint8_t veml7700_set_auto_range (veml7700_handle_t *handle, veml7700_bool_t enable)
 set auto range
uint8_t veml7700_get_auto_range (veml7700_handle_t *handle, veml7700_bool_t *enable)
 get auto range
uint8_t veml7700_set_als_gain (veml7700_handle_t *handle, veml7700_als_gain_t gain)
 set als gain
uint8_t veml7700_get_als_gain (veml7700_handle_t *handle, veml7700_als_gain_t *gain)
 get als gain
uint8_t veml7700_set_als_integration_time (veml7700_handle_t *handle, veml7700_als_integration_time_t t)
 set als integration time
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_persistence (veml7700_handle_t *handle, veml7700_als_persistence_t persistence)
 set als persistence
uint8_t veml7700_get_als_persistence (veml7700_handle_t *handle, veml7700_als_persistence_t *persistence)
 get als persistence
uint8_t veml7700_set_als_interrupt (veml7700_handle_t *handle, veml7700_bool_t enable)
 enable or disable als interrupt
uint8_t veml7700_get_als_interrupt (veml7700_handle_t *handle, veml7700_bool_t *enable)
 get als interrupt status
uint8_t veml7700_set_als_mode (veml7700_handle_t *handle, veml7700_als_mode_t mode)
 set als mode
uint8_t veml7700_get_als_mode (veml7700_handle_t *handle, veml7700_als_mode_t *mode)
 get als mode
uint8_t veml7700_set_als_high_threshold (veml7700_handle_t *handle, uint16_t threshold)
 set als high threshold
uint8_t veml7700_get_als_high_threshold (veml7700_handle_t *handle, uint16_t *threshold)
 get als high threshold
uint8_t veml7700_set_als_low_threshold (veml7700_handle_t *handle, uint16_t threshold)
 set als low threshold
uint8_t veml7700_get_als_low_threshold (veml7700_handle_t *handle, uint16_t *threshold)
 get als low threshold
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_power_saving_mode (veml7700_handle_t *handle, veml7700_power_saving_mode_t *mode)
 get power saving mode
uint8_t veml7700_set_power_saving (veml7700_handle_t *handle, veml7700_bool_t enable)
 enable or disable power saving
uint8_t veml7700_get_power_saving (veml7700_handle_t *handle, veml7700_bool_t *enable)
 get power saving status
uint8_t veml7700_get_interrupt_status (veml7700_handle_t *handle, veml7700_bool_t *low_threshold, veml7700_bool_t *high_threshold)
 get interrupt status

Detailed Description

veml7700 basic driver modules

Macro Definition Documentation

◆ VEML7700_AUTO_RANGE_HIGH_THRESHOLD

#define VEML7700_AUTO_RANGE_HIGH_THRESHOLD   0xFF00U

veml7700 auto range high threshold definition

0xFF00

Definition at line 63 of file driver_veml7700.h.

◆ VEML7700_AUTO_RANGE_LOW_THRESHOLD

#define VEML7700_AUTO_RANGE_LOW_THRESHOLD   0x00FFU

veml7700 auto range low threshold definition

0x00FF

Definition at line 70 of file driver_veml7700.h.

Typedef Documentation

◆ veml7700_handle_t

veml7700 handle structure definition

◆ veml7700_info_t

veml7700 information structure definition

Enumeration Type Documentation

◆ veml7700_als_gain_t

veml7700 als gain enumeration definition

Enumerator
VEML7700_ALS_GAIN_1 

gain 1

VEML7700_ALS_GAIN_2 

gain 2

VEML7700_ALS_GAIN_1_DIV_8 

gain 1/8

VEML7700_ALS_GAIN_1_DIV_4 

gain 1/4

Definition at line 85 of file driver_veml7700.h.

◆ veml7700_als_integration_time_t

veml7700 als integration time enumeration definition

Enumerator
VEML7700_ALS_INTEGRATION_TIME_25MS 

25ms

VEML7700_ALS_INTEGRATION_TIME_50MS 

50ms

VEML7700_ALS_INTEGRATION_TIME_100MS 

100ms

VEML7700_ALS_INTEGRATION_TIME_200MS 

200ms

VEML7700_ALS_INTEGRATION_TIME_400MS 

400ms

VEML7700_ALS_INTEGRATION_TIME_800MS 

800ms

Definition at line 96 of file driver_veml7700.h.

◆ veml7700_als_mode_t

veml7700 als mode enumeration definition

Enumerator
VEML7700_ALS_MODE_POWER_ON 

als power on

VEML7700_ALS_MODE_SHUT_DOWN 

als shut down

Definition at line 120 of file driver_veml7700.h.

◆ veml7700_als_persistence_t

veml7700 als persistence enumeration definition

Enumerator
VEML7700_ALS_PERSISTENCE_1 

persistence protect number 1

VEML7700_ALS_PERSISTENCE_2 

persistence protect number 2

VEML7700_ALS_PERSISTENCE_4 

persistence protect number 4

VEML7700_ALS_PERSISTENCE_8 

persistence protect number 8

Definition at line 109 of file driver_veml7700.h.

◆ veml7700_bool_t

veml7700 bool enumeration definition

Enumerator
VEML7700_BOOL_DISABLE 

disable

VEML7700_BOOL_ENABLE 

enable

Definition at line 76 of file driver_veml7700.h.

◆ veml7700_power_saving_mode_t

veml7700 power saving mode enumeration definition

als_integration_time refresh time
mode1 mode2 mode3 mode4 100ms 600ms 1100ms 2100ms 4100ms 200ms 700ms 1200ms 2200ms 4200ms 400ms 900ms 1400ms 2400ms 4400ms 800ms 1300ms 1800ms 2800ms 4800ms

Enumerator
VEML7700_POWER_SAVING_MODE1 

mode 1

VEML7700_POWER_SAVING_MODE2 

mode 2

VEML7700_POWER_SAVING_MODE3 

mode 3

VEML7700_POWER_SAVING_MODE4 

mode 4

Definition at line 136 of file driver_veml7700.h.

Function Documentation

◆ veml7700_deinit()

uint8_t veml7700_deinit ( veml7700_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a veml7700 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 1234 of file driver_veml7700.c.

◆ veml7700_get_als_gain()

uint8_t veml7700_get_als_gain ( veml7700_handle_t * handle,
veml7700_als_gain_t * gain )

get als gain

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*gainpointer to an als gain buffer
Returns
status code
  • 0 success
  • 1 get als gain failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 442 of file driver_veml7700.c.

◆ veml7700_get_als_high_threshold()

uint8_t veml7700_get_als_high_threshold ( veml7700_handle_t * handle,
uint16_t * threshold )

get als high threshold

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*thresholdpointer to a high threshold buffer
Returns
status code
  • 0 success
  • 1 get als high threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 842 of file driver_veml7700.c.

◆ veml7700_get_als_integration_time()

uint8_t veml7700_get_als_integration_time ( veml7700_handle_t * handle,
veml7700_als_integration_time_t * t )

get als integration time

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*tpointer to an als integration time buffer
Returns
status code
  • 0 success
  • 1 get als integration time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 524 of file driver_veml7700.c.

◆ veml7700_get_als_interrupt()

uint8_t veml7700_get_als_interrupt ( veml7700_handle_t * handle,
veml7700_bool_t * enable )

get als interrupt status

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get als interrupt failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 688 of file driver_veml7700.c.

◆ veml7700_get_als_low_threshold()

uint8_t veml7700_get_als_low_threshold ( veml7700_handle_t * handle,
uint16_t * threshold )

get als low threshold

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*thresholdpointer to a low threshold buffer
Returns
status code
  • 0 success
  • 1 get als low threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 912 of file driver_veml7700.c.

◆ veml7700_get_als_mode()

uint8_t veml7700_get_als_mode ( veml7700_handle_t * handle,
veml7700_als_mode_t * mode )

get als mode

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*modepointer to an als mode buffer
Returns
status code
  • 0 success
  • 1 get als mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 770 of file driver_veml7700.c.

◆ veml7700_get_als_persistence()

uint8_t veml7700_get_als_persistence ( veml7700_handle_t * handle,
veml7700_als_persistence_t * persistence )

get als persistence

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*persistencepointer to an als persistence buffer
Returns
status code
  • 0 success
  • 1 get als persistence failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 606 of file driver_veml7700.c.

◆ veml7700_get_auto_range()

uint8_t veml7700_get_auto_range ( veml7700_handle_t * handle,
veml7700_bool_t * enable )

get auto range

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1310 of file driver_veml7700.c.

◆ veml7700_get_interrupt_status()

uint8_t veml7700_get_interrupt_status ( veml7700_handle_t * handle,
veml7700_bool_t * low_threshold,
veml7700_bool_t * high_threshold )

get interrupt status

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*low_thresholdpointer to a low threshold buffer
[out]*high_thresholdpointer to a high threshold buffer
Returns
status code
  • 0 success
  • 1 get interrupt status failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1112 of file driver_veml7700.c.

◆ veml7700_get_power_saving()

uint8_t veml7700_get_power_saving ( veml7700_handle_t * handle,
veml7700_bool_t * enable )

get power saving status

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get power saving failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1074 of file driver_veml7700.c.

◆ veml7700_get_power_saving_mode()

uint8_t veml7700_get_power_saving_mode ( veml7700_handle_t * handle,
veml7700_power_saving_mode_t * mode )

get power saving mode

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*modepointer to a power saving mode buffer
Returns
status code
  • 0 success
  • 1 get power saving mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 992 of file driver_veml7700.c.

◆ veml7700_info()

uint8_t veml7700_info ( veml7700_info_t * info)

get chip's information

Parameters
[out]*infopointer to a veml7700 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1475 of file driver_veml7700.c.

◆ veml7700_init()

uint8_t veml7700_init ( veml7700_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a veml7700 handle structure
Returns
status code
  • 0 success
  • 1 iic failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 id is invalid
Note
none

Definition at line 1150 of file driver_veml7700.c.

◆ veml7700_read_als()

uint8_t veml7700_read_als ( veml7700_handle_t * handle,
uint16_t * raw,
double * lux )

read als channel

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*rawpointer to a raw lux buffer
[out]*luxpointer to a converted lux buffer
Returns
status code
  • 0 success
  • 1 read als failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 calculate failed
  • 5 run auto range failed
Note
none

Definition at line 1374 of file driver_veml7700.c.

◆ veml7700_read_white()

uint8_t veml7700_read_white ( veml7700_handle_t * handle,
uint16_t * raw )

read white channel

Parameters
[in]*handlepointer to a veml7700 handle structure
[out]*rawpointer to a raw lux buffer
Returns
status code
  • 0 success
  • 1 read white failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1336 of file driver_veml7700.c.

◆ veml7700_set_als_gain()

uint8_t veml7700_set_als_gain ( veml7700_handle_t * handle,
veml7700_als_gain_t gain )

set als gain

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]gainals gain
Returns
status code
  • 0 success
  • 1 set als gain failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 397 of file driver_veml7700.c.

◆ veml7700_set_als_high_threshold()

uint8_t veml7700_set_als_high_threshold ( veml7700_handle_t * handle,
uint16_t threshold )

set als high threshold

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]thresholdhigh threshold
Returns
status code
  • 0 success
  • 1 set als high threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 807 of file driver_veml7700.c.

◆ veml7700_set_als_integration_time()

uint8_t veml7700_set_als_integration_time ( veml7700_handle_t * handle,
veml7700_als_integration_time_t t )

set als integration time

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]tals integration time
Returns
status code
  • 0 success
  • 1 set als integration time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 479 of file driver_veml7700.c.

◆ veml7700_set_als_interrupt()

uint8_t veml7700_set_als_interrupt ( veml7700_handle_t * handle,
veml7700_bool_t enable )

enable or disable als interrupt

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set als interrupt failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 643 of file driver_veml7700.c.

◆ veml7700_set_als_low_threshold()

uint8_t veml7700_set_als_low_threshold ( veml7700_handle_t * handle,
uint16_t threshold )

set als low threshold

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]thresholdlow threshold
Returns
status code
  • 0 success
  • 1 set als low threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 877 of file driver_veml7700.c.

◆ veml7700_set_als_mode()

uint8_t veml7700_set_als_mode ( veml7700_handle_t * handle,
veml7700_als_mode_t mode )

set als mode

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]modeals mode
Returns
status code
  • 0 success
  • 1 set als mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 725 of file driver_veml7700.c.

◆ veml7700_set_als_persistence()

uint8_t veml7700_set_als_persistence ( veml7700_handle_t * handle,
veml7700_als_persistence_t persistence )

set als persistence

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]persistenceals persistence
Returns
status code
  • 0 success
  • 1 set als persistence failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 561 of file driver_veml7700.c.

◆ veml7700_set_auto_range()

uint8_t veml7700_set_auto_range ( veml7700_handle_t * handle,
veml7700_bool_t enable )

set auto range

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1285 of file driver_veml7700.c.

◆ veml7700_set_power_saving()

uint8_t veml7700_set_power_saving ( veml7700_handle_t * handle,
veml7700_bool_t enable )

enable or disable power saving

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set power saving failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1029 of file driver_veml7700.c.

◆ veml7700_set_power_saving_mode()

uint8_t veml7700_set_power_saving_mode ( veml7700_handle_t * handle,
veml7700_power_saving_mode_t mode )

set power saving mode

Parameters
[in]*handlepointer to a veml7700 handle structure
[in]modepower saving mode
Returns
status code
  • 0 success
  • 1 set power saving mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 947 of file driver_veml7700.c.