ambient19 2.0.0.0
Ambient 19 Click Driver

API for configuring and manipulating Ambient 19 Click driver. More...

Topics

 Ambient 19 Registers List
 List of registers of Ambient 19 Click driver.
 
 Ambient 19 Registers Settings
 Settings for registers of Ambient 19 Click driver.
 
 Ambient 19 MikroBUS Map
 MikroBUS pin mapping of Ambient 19 Click driver.
 

Functions

void ambient19_cfg_setup (ambient19_cfg_t *cfg)
 Ambient 19 configuration object setup function.
 
err_t ambient19_init (ambient19_t *ctx, ambient19_cfg_t *cfg)
 Ambient 19 initialization function.
 
err_t ambient19_default_cfg (ambient19_t *ctx)
 Ambient 19 default configuration function.
 
err_t ambient19_generic_write (ambient19_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Ambient 19 I2C writing function.
 
err_t ambient19_generic_read (ambient19_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Ambient 19 I2C reading function.
 
err_t ambient19_write_register (ambient19_t *ctx, uint8_t reg, uint8_t data_in)
 Ambient 19 write register function.
 
err_t ambient19_read_register (ambient19_t *ctx, uint8_t reg, uint8_t *data_out)
 Ambient 19 read register function.
 
err_t ambient19_check_communication (ambient19_t *ctx)
 Ambient 19 check communication function.
 
uint8_t ambient19_get_int_pin (ambient19_t *ctx)
 Ambient 19 get INT pin function.
 
err_t ambient19_clear_interrupts (ambient19_t *ctx)
 Ambient 19 clear interrupts function.
 
err_t ambient19_set_wait_time (ambient19_t *ctx, float wait_time_ms)
 Ambient 19 set wait time function.
 
err_t ambient19_set_als_time (ambient19_t *ctx, float als_time_ms)
 Ambient 19 set als time function.
 
err_t ambient19_set_als_gain (ambient19_t *ctx, uint8_t als_gain)
 Ambient 19 set als gain function.
 
err_t ambient19_read_raw_als (ambient19_t *ctx, uint16_t *ch_0, uint16_t *ch_1)
 Ambient 19 read raw als function.
 
err_t ambient19_read_raw_proximity (ambient19_t *ctx, uint16_t *ps_data, uint16_t *ir_data)
 Ambient 19 read raw proximity function.
 
err_t ambient19_measure_light_level (ambient19_t *ctx, uint16_t *lux)
 Ambient 19 measure light level function.
 

Detailed Description

API for configuring and manipulating Ambient 19 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ ambient19_cfg_setup()

void ambient19_cfg_setup ( ambient19_cfg_t * cfg)

Ambient 19 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See ambient19_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ ambient19_check_communication()

err_t ambient19_check_communication ( ambient19_t * ctx)

Ambient 19 check communication function.

This function checks the communication by reading and verifying the product number.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_clear_interrupts()

err_t ambient19_clear_interrupts ( ambient19_t * ctx)

Ambient 19 clear interrupts function.

This function clears all interrupts by clearing the INT_FLAG register.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_default_cfg()

err_t ambient19_default_cfg ( ambient19_t * ctx)

Ambient 19 default configuration function.

This function executes a default configuration of Ambient 19 click board.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ ambient19_generic_read()

err_t ambient19_generic_read ( ambient19_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Ambient 19 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_generic_write()

err_t ambient19_generic_write ( ambient19_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Ambient 19 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_get_int_pin()

uint8_t ambient19_get_int_pin ( ambient19_t * ctx)

Ambient 19 get INT pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ ambient19_init()

err_t ambient19_init ( ambient19_t * ctx,
ambient19_cfg_t * cfg )

Ambient 19 initialization function.

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

Parameters
[out]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See ambient19_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_measure_light_level()

err_t ambient19_measure_light_level ( ambient19_t * ctx,
uint16_t * lux )

Ambient 19 measure light level function.

This function reads the raw ALS data from two channels and then measures the light level in lux based on those readings.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[out]lux: Ambient light level in Lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_read_raw_als()

err_t ambient19_read_raw_als ( ambient19_t * ctx,
uint16_t * ch_0,
uint16_t * ch_1 )

Ambient 19 read raw als function.

This function reads the raw ALS data from two channels.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[out]ch_0: Raw data from channel 0.
[out]ch_1: Raw data from channel 1.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_read_raw_proximity()

err_t ambient19_read_raw_proximity ( ambient19_t * ctx,
uint16_t * ps_data,
uint16_t * ir_data )

Ambient 19 read raw proximity function.

This function reads the raw PS and IR data of the proximity sensor.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[out]ps_data: Raw PS data.
[out]ir_data: Raw IR data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_read_register()

err_t ambient19_read_register ( ambient19_t * ctx,
uint8_t reg,
uint8_t * data_out )

Ambient 19 read register function.

This function reads data from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_set_als_gain()

err_t ambient19_set_als_gain ( ambient19_t * ctx,
uint8_t als_gain )

Ambient 19 set als gain function.

This function sets the ALS gain level in the ALS_GAIN register.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]als_gain: ALS gain level
  • 0 - 1X,
  • 1 - 4X,
  • 2 - 8X,
  • 3 - 32X.
  • 4 - 96X.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_set_als_time()

err_t ambient19_set_als_time ( ambient19_t * ctx,
float als_time_ms )

Ambient 19 set als time function.

This function sets the ALS_TIME register for the selected ALS integration time.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]als_time_ms: Als integration time. Valid values from 5.513 to 674.888 milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient19_set_wait_time()

err_t ambient19_set_wait_time ( ambient19_t * ctx,
float wait_time_ms )

Ambient 19 set wait time function.

This function sets the WAIT_TIME register for the selected wait time.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]wait_time_ms: Wait time period. Valid values from 5.0 to 1280.0 milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Wait time must be enabled in the SYSM_CTRL register.

◆ ambient19_write_register()

err_t ambient19_write_register ( ambient19_t * ctx,
uint8_t reg,
uint8_t data_in )

Ambient 19 write register function.

This function writes a desired data to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient19_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.