ambient16 2.0.0.0
Ambient 16 Click Driver

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

Topics

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

Functions

void ambient16_cfg_setup (ambient16_cfg_t *cfg)
 Ambient 16 configuration object setup function.
 
err_t ambient16_init (ambient16_t *ctx, ambient16_cfg_t *cfg)
 Ambient 16 initialization function.
 
err_t ambient16_default_cfg (ambient16_t *ctx)
 Ambient 16 default configuration function.
 
err_t ambient16_generic_write (ambient16_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Ambient 16 I2C writing function.
 
err_t ambient16_generic_read (ambient16_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Ambient 16 I2C reading function.
 
uint8_t ambient16_get_int_state (ambient16_t *ctx)
 Ambient 16 get INT state function.
 
err_t ambient16_set_reg (ambient16_t *ctx, uint8_t reg, uint8_t value)
 Ambient 16 set register value function.
 
err_t ambient16_send_cmd (ambient16_t *ctx, uint8_t cmd)
 Ambient 16 send command function.
 
err_t ambient16_sw_reset (ambient16_t *ctx)
 Ambient 16 software reset function.
 
err_t ambient16_int_reset (ambient16_t *ctx)
 Ambient 16 interrupt reset function.
 
err_t ambient16_set_th_low (ambient16_t *ctx, uint16_t th_val)
 Ambient 16 set interrupt threshold lower level function.
 
err_t ambient16_set_th_high (ambient16_t *ctx, uint16_t th_val)
 Ambient 16 set interrupt threshold upper level function.
 
err_t ambient16_set_gain (ambient16_t *ctx, uint8_t data0_gain, uint8_t data1_gain)
 Ambient 16 set ADC gain function.
 
err_t ambient16_get_part_id (ambient16_t *ctx, uint8_t *part_id)
 Ambient 16 get part ID function.
 
err_t ambient16_get_data (ambient16_t *ctx, uint16_t *data0, uint16_t *data1)
 Ambient 16 get ADC data function.
 
err_t ambient16_read_data (ambient16_t *ctx, float *data0, float *data1)
 Ambient 16 get data function.
 
void ambient16_set_wait (ambient16_t *ctx, uint8_t wait_mode)
 Ambient 16 set wait function.
 

Detailed Description

API for configuring and manipulating Ambient 16 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

◆ ambient16_cfg_setup()

void ambient16_cfg_setup ( ambient16_cfg_t * cfg)

Ambient 16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ambient16_default_cfg()

err_t ambient16_default_cfg ( ambient16_t * ctx)

Ambient 16 default configuration function.

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

Parameters
[in]ctx: Click context object. See ambient16_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.

◆ ambient16_generic_read()

err_t ambient16_generic_read ( ambient16_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Ambient 16 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 ambient16_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_generic_write()

err_t ambient16_generic_write ( ambient16_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Ambient 16 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 ambient16_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_get_data()

err_t ambient16_get_data ( ambient16_t * ctx,
uint16_t * data0,
uint16_t * data1 )

Ambient 16 get ADC data function.

This function is used for reading ADC data from DATA0 and DATA1 by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[out]data0: Output read data from DATA0.
[out]data1: Output read data from DATA1.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_get_int_state()

uint8_t ambient16_get_int_state ( ambient16_t * ctx)

Ambient 16 get INT state function.

This function reads a state of the INT pin.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
Returns
  • 1 - Pin state high,
  • 0 - Pin state low.

◆ ambient16_get_part_id()

err_t ambient16_get_part_id ( ambient16_t * ctx,
uint8_t * part_id )

Ambient 16 get part ID function.

This function is used for reading part ID by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[out]part_id: Part ID.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_init()

err_t ambient16_init ( ambient16_t * ctx,
ambient16_cfg_t * cfg )

Ambient 16 initialization function.

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

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

◆ ambient16_int_reset()

err_t ambient16_int_reset ( ambient16_t * ctx)

Ambient 16 interrupt reset function.

This function executes an interrupt reset of Ambient 16 click board.

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

◆ ambient16_read_data()

err_t ambient16_read_data ( ambient16_t * ctx,
float * data0,
float * data1 )

Ambient 16 get data function.

This function is used for reading data from DATA0 and DATA1 by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[out]data0: Output read data from DATA0 in lux.
[out]data1: Output read data from DATA1 in lux.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_send_cmd()

err_t ambient16_send_cmd ( ambient16_t * ctx,
uint8_t cmd )

Ambient 16 send command function.

This function sends a desired command by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[in]cmd: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_set_gain()

err_t ambient16_set_gain ( ambient16_t * ctx,
uint8_t data0_gain,
uint8_t data1_gain )

Ambient 16 set ADC gain function.

This function is used for setting ADC gain mode by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[in]data0_gain: Gain setting of ADC for DATA0.
[in]data1_gain: Gain setting of ADC for DATA1.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_set_reg()

err_t ambient16_set_reg ( ambient16_t * ctx,
uint8_t reg,
uint8_t value )

Ambient 16 set register value function.

This function writes a desired value into a selected register by using I2C serial interface.

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

◆ ambient16_set_th_high()

err_t ambient16_set_th_high ( ambient16_t * ctx,
uint16_t th_val )

Ambient 16 set interrupt threshold upper level function.

This function is used for setting interrupt threshold upper level by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[in]th_val: Treshold data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_set_th_low()

err_t ambient16_set_th_low ( ambient16_t * ctx,
uint16_t th_val )

Ambient 16 set interrupt threshold lower level function.

This function is used for setting interrupt threshold lower level by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[in]th_val: Treshold data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ambient16_set_wait()

void ambient16_set_wait ( ambient16_t * ctx,
uint8_t wait_mode )

Ambient 16 set wait function.

This function is used for enabling wait mode by using I2C serial interface.

Parameters
[in]ctx: Click context object. See ambient16_t object definition for detailed explanation.
[in]wait_mode: Wait mode data.
Returns
Nothing.
Note
If wait function is enabled there is interval ( Twt ) after each measurment.

◆ ambient16_sw_reset()

err_t ambient16_sw_reset ( ambient16_t * ctx)

Ambient 16 software reset function.

This function executes a software reset of Ambient 16 click board.

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