ambient22 2.1.0.0
Ambient 22 Click Driver

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

Topics

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

Functions

void ambient22_cfg_setup (ambient22_cfg_t *cfg)
 Ambient 22 configuration object setup function.
 
err_t ambient22_init (ambient22_t *ctx, ambient22_cfg_t *cfg)
 Ambient 22 initialization function.
 
err_t ambient22_default_cfg (ambient22_t *ctx)
 Ambient 22 default configuration function.
 
err_t ambient22_write_register (ambient22_t *ctx, uint8_t reg, uint16_t data_in)
 Ambient 22 write register function.
 
err_t ambient22_read_register (ambient22_t *ctx, uint8_t reg, uint16_t *data_out)
 Ambient 22 read register function.
 
err_t ambient22_check_communication (ambient22_t *ctx)
 Ambient 22 check communication function.
 
err_t ambient22_read_lux (ambient22_t *ctx, float *lux)
 Ambient 22 read lux function.
 
uint8_t ambient22_get_int_pin (ambient22_t *ctx)
 Ambient 22 get int pin function.
 

Detailed Description

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

◆ ambient22_cfg_setup()

void ambient22_cfg_setup ( ambient22_cfg_t * cfg)

Ambient 22 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ambient22_check_communication()

err_t ambient22_check_communication ( ambient22_t * ctx)

Ambient 22 check communication function.

This function checks the communication by reading and verifying the manufacturer and device identification numbers.

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

◆ ambient22_default_cfg()

err_t ambient22_default_cfg ( ambient22_t * ctx)

Ambient 22 default configuration function.

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

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

◆ ambient22_get_int_pin()

uint8_t ambient22_get_int_pin ( ambient22_t * ctx)

Ambient 22 get int pin function.

This function returns the INT pin logic state.

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

◆ ambient22_init()

err_t ambient22_init ( ambient22_t * ctx,
ambient22_cfg_t * cfg )

Ambient 22 initialization function.

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

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

◆ ambient22_read_lux()

err_t ambient22_read_lux ( ambient22_t * ctx,
float * lux )

Ambient 22 read lux function.

This function checks for a conversion ready flag bit and then reads the ambient light level in lux.

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

◆ ambient22_read_register()

err_t ambient22_read_register ( ambient22_t * ctx,
uint8_t reg,
uint16_t * data_out )

Ambient 22 read register function.

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

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

◆ ambient22_write_register()

err_t ambient22_write_register ( ambient22_t * ctx,
uint8_t reg,
uint16_t data_in )

Ambient 22 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 ambient22_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.