ambient8 2.0.0.0
Public function

Functions

void ambient8_cfg_setup (ambient8_cfg_t *cfg)
 Config Object Initialization function.
 
AMBIENT8_RETVAL ambient8_init (ambient8_t *ctx, ambient8_cfg_t *cfg)
 Initialization function.
 
void ambient8_set_register (ambient8_t *ctx, uint8_t *write_buf, uint8_t n_bytes)
 Writing to device registers.
 
void ambient8_get_register (ambient8_t *ctx, uint8_t reg_addr, uint8_t *data_buf, uint8_t n_bytes)
 Reading register value(s).
 
void ambient8_set_constants (ambient8_t *ctx)
 Setting constants for lux level calculation.
 
AMBIENT8_RETVAL ambient8_get_als_data (ambient8_t *ctx, uint16_t *als_data_ch1, uint16_t *als_data_ch0)
 Reading ALS data.
 
AMBIENT8_RETVAL ambient8_get_lux_level (ambient8_t *ctx, float *lux_level, float window_factor, float IR_factor)
 Calculating lux level.
 

Detailed Description

Function Documentation

◆ ambient8_cfg_setup()

void ambient8_cfg_setup ( ambient8_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ ambient8_get_als_data()

AMBIENT8_RETVAL ambient8_get_als_data ( ambient8_t * ctx,
uint16_t * als_data_ch1,
uint16_t * als_data_ch0 )

Reading ALS data.

Parameters
ctxClick object.
als_data_ch1ALS channel 1 data.
als_data_ch0ALS channel 0 data.
Returns
Error 0 - OK, 1-Error.

@description This function checks for new data by polling ALS status register.

◆ ambient8_get_lux_level()

AMBIENT8_RETVAL ambient8_get_lux_level ( ambient8_t * ctx,
float * lux_level,
float window_factor,
float IR_factor )

Calculating lux level.

Parameters
ctxClick object.
lux_levelLux level calculated using window factor , IR factor and ALS channel 0 and channel 1 data
window_factorWindow factor needs to be derived if window is being used.
IR_facotrIR factor needs to be derived if window is being used.
Returns
Error 0 - OK, 1-Error.

@description This function reads and data and performs lux level calculation This function returns 0 and stores lux level value into luxLevel_ if new data is ready and if new data is valid.

◆ ambient8_get_register()

void ambient8_get_register ( ambient8_t * ctx,
uint8_t reg_addr,
uint8_t * data_buf,
uint8_t n_bytes )

Reading register value(s).

Parameters
ctxClick object.
reg_addrRegister address.
data_bufOutput data buf
n_bytesNumber of the bytes to be read

@description This function reads n_bytes - registers(bytes) from device memory

◆ ambient8_init()

AMBIENT8_RETVAL ambient8_init ( ambient8_t * ctx,
ambient8_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ ambient8_set_constants()

void ambient8_set_constants ( ambient8_t * ctx)

Setting constants for lux level calculation.

Parameters
ctxClick object.

@description This function sets constants (gain and integration time) for lux level calculation.

◆ ambient8_set_register()

void ambient8_set_register ( ambient8_t * ctx,
uint8_t * write_buf,
uint8_t n_bytes )

Writing to device registers.

Parameters
ctxClick object.
write_bufBuffer for bytes to be written.
n_bytesNumber of bytes to be written.

@description This function writes bytes to n_bytes - registers in device memory