ambient14  2.1.0.0
Modules | Functions
Ambient 14 Click Driver

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

Modules

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

Functions

void ambient14_cfg_setup (ambient14_cfg_t *cfg)
 Ambient 14 configuration object setup function. More...
 
err_t ambient14_init (ambient14_t *ctx, ambient14_cfg_t *cfg)
 Ambient 14 initialization function. More...
 
err_t ambient14_default_cfg (ambient14_t *ctx)
 Ambient 14 default configuration function. More...
 
err_t ambient14_write_regs (ambient14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Ambient 14 write regs function. More...
 
err_t ambient14_read_regs (ambient14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Ambient 14 read regs function. More...
 
err_t ambient14_write_reg (ambient14_t *ctx, uint8_t reg, uint8_t data_in)
 Ambient 14 write reg function. More...
 
err_t ambient14_read_reg (ambient14_t *ctx, uint8_t reg, uint8_t *data_out)
 Ambient 14 read reg function. More...
 
void ambient14_enable_device (ambient14_t *ctx)
 Ambient 14 enable device function. More...
 
void ambient14_disable_device (ambient14_t *ctx)
 Ambient 14 disable device function. More...
 
uint8_t ambient14_get_int_pin (ambient14_t *ctx)
 Ambient 14 get int pin function. More...
 
err_t ambient14_check_communication (ambient14_t *ctx)
 Ambient 14 check communication function. More...
 
err_t ambient14_soft_reset (ambient14_t *ctx)
 Ambient 14 soft reset function. More...
 
err_t ambient14_clear_interrupts (ambient14_t *ctx)
 Ambient 14 clear interrupts function. More...
 
err_t ambient14_set_atime (ambient14_t *ctx, float atime_ms)
 Ambient 14 set atime function. More...
 
err_t ambient14_set_awtime (ambient14_t *ctx, float awtime_ms)
 Ambient 14 set awtime function. More...
 
err_t ambient14_set_pwtime (ambient14_t *ctx, float pwtime_ms)
 Ambient 14 set pwtime function. More...
 
err_t ambient14_read_proximity (ambient14_t *ctx, uint16_t *prox_data)
 Ambient 14 read proximity function. More...
 
err_t ambient14_read_als_ir (ambient14_t *ctx, uint16_t *als_data, uint16_t *ir_data)
 Ambient 14 read als ir function. More...
 
err_t ambient14_get_illuminance (ambient14_t *ctx, uint16_t als_data, float *illuminance)
 Ambient 14 get illuminance function. More...
 

Detailed Description

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

◆ ambient14_cfg_setup()

void ambient14_cfg_setup ( ambient14_cfg_t cfg)

Ambient 14 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ambient14_check_communication()

err_t ambient14_check_communication ( ambient14_t ctx)

Ambient 14 check communication function.

This function checks the communication by reading and verifying the device ID on up to 10 tries.

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

◆ ambient14_clear_interrupts()

err_t ambient14_clear_interrupts ( ambient14_t ctx)

Ambient 14 clear interrupts function.

This function clears all interrupts status.

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

◆ ambient14_default_cfg()

err_t ambient14_default_cfg ( ambient14_t ctx)

Ambient 14 default configuration function.

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

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

◆ ambient14_disable_device()

void ambient14_disable_device ( ambient14_t ctx)

Ambient 14 disable device function.

This function enables the device by setting the SBY pin to LOW logic state.

Parameters
[in]ctx: Click context object. See ambient14_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ ambient14_enable_device()

void ambient14_enable_device ( ambient14_t ctx)

Ambient 14 enable device function.

This function enables the device by setting the SBY pin to HIGH logic state.

Parameters
[in]ctx: Click context object. See ambient14_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ ambient14_get_illuminance()

err_t ambient14_get_illuminance ( ambient14_t ctx,
uint16_t  als_data,
float *  illuminance 
)

Ambient 14 get illuminance function.

This function calculates the illuminance level (Lux) from ALS data counts input.

Parameters
[in]ctx: Click context object. See ambient14_t object definition for detailed explanation.
[in]als_data: ALS data.
[out]illuminance: Illuminance in Lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient14_get_int_pin()

uint8_t ambient14_get_int_pin ( ambient14_t ctx)

Ambient 14 get int pin function.

This function returns the INT pin logic state.

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

◆ ambient14_init()

err_t ambient14_init ( ambient14_t ctx,
ambient14_cfg_t cfg 
)

Ambient 14 initialization function.

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

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

◆ ambient14_read_als_ir()

err_t ambient14_read_als_ir ( ambient14_t ctx,
uint16_t *  als_data,
uint16_t *  ir_data 
)

Ambient 14 read als ir function.

This function reads the raw ALS and IR data.

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

◆ ambient14_read_proximity()

err_t ambient14_read_proximity ( ambient14_t ctx,
uint16_t *  prox_data 
)

Ambient 14 read proximity function.

This function reads the raw proximity data. The higher the value, the closer the detected object is.

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

◆ ambient14_read_reg()

err_t ambient14_read_reg ( ambient14_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Ambient 14 read reg function.

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

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

◆ ambient14_read_regs()

err_t ambient14_read_regs ( ambient14_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Ambient 14 read regs 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 ambient14_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.

◆ ambient14_set_atime()

err_t ambient14_set_atime ( ambient14_t ctx,
float  atime_ms 
)

Ambient 14 set atime function.

This function sets the ADC integration time in milliseconds by setting the ATIME register.

Parameters
[in]ctx: Click context object. See ambient14_t object definition for detailed explanation.
[in]atime_ms: ADC integration time in milliseconds. [from AMBIENT14_ATIME_MIN to AMBIENT14_ATIME_MAX].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient14_set_awtime()

err_t ambient14_set_awtime ( ambient14_t ctx,
float  awtime_ms 
)

Ambient 14 set awtime function.

This function sets the ALS wait time in milliseconds by setting the AWTIME register.

Parameters
[in]ctx: Click context object. See ambient14_t object definition for detailed explanation.
[in]awtime_ms: ALS wait time in milliseconds. [from AMBIENT14_AWTIME_MIN to AMBIENT14_AWTIME_MAX].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient14_set_pwtime()

err_t ambient14_set_pwtime ( ambient14_t ctx,
float  pwtime_ms 
)

Ambient 14 set pwtime function.

This function sets the PROX wait time in milliseconds by setting the PWTIME register.

Parameters
[in]ctx: Click context object. See ambient14_t object definition for detailed explanation.
[in]pwtime_ms: PROX wait time in milliseconds. [from AMBIENT14_PWTIME_MIN to AMBIENT14_PWTIME_MAX].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ambient14_soft_reset()

err_t ambient14_soft_reset ( ambient14_t ctx)

Ambient 14 soft reset function.

This function executes the defice software reset command.

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

◆ ambient14_write_reg()

err_t ambient14_write_reg ( ambient14_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Ambient 14 write reg function.

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

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

◆ ambient14_write_regs()

err_t ambient14_write_regs ( ambient14_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Ambient 14 write regs 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 ambient14_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.