proximity18 2.1.0.0
Proximity 18 Click Driver

API for configuring and manipulating Proximity 18 Click driver. More...

Topics

 Proximity 18 Registers List
 List of registers of Proximity 18 Click driver.
 
 Proximity 18 Registers Settings
 Settings for registers of Proximity 18 Click driver.
 
 Proximity 18 MikroBUS Map
 MikroBUS pin mapping of Proximity 18 Click driver.
 

Functions

void proximity18_cfg_setup (proximity18_cfg_t *cfg)
 Proximity 18 configuration object setup function.
 
err_t proximity18_init (proximity18_t *ctx, proximity18_cfg_t *cfg)
 Proximity 18 initialization function.
 
err_t proximity18_default_cfg (proximity18_t *ctx)
 Proximity 18 default configuration function.
 
err_t proximity18_write_register (proximity18_t *ctx, uint8_t reg, uint16_t data_in)
 Proximity 18 write register function.
 
err_t proximity18_read_register (proximity18_t *ctx, uint8_t reg, uint16_t *data_out)
 Proximity 18 read register function.
 
err_t proximity18_check_communication (proximity18_t *ctx)
 Proximity 18 check communication function.
 
uint8_t proximity18_get_int_pin (proximity18_t *ctx)
 Proximity 18 get int pin function.
 
err_t proximity18_start_measurement (proximity18_t *ctx)
 Proximity 18 start measurement function.
 
err_t proximity18_wait_for_data_ready (proximity18_t *ctx)
 Proximity 18 wait for data ready function.
 
err_t proximity18_read_proximity (proximity18_t *ctx, uint16_t *ps1_data, uint16_t *ps2_data, uint16_t *ps3_data)
 Proximity 18 read proximity function.
 

Detailed Description

API for configuring and manipulating Proximity 18 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

◆ proximity18_cfg_setup()

void proximity18_cfg_setup ( proximity18_cfg_t * cfg)

Proximity 18 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ proximity18_check_communication()

err_t proximity18_check_communication ( proximity18_t * ctx)

Proximity 18 check communication function.

This function checks the communication by reading and verifying the device ID.

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

◆ proximity18_default_cfg()

err_t proximity18_default_cfg ( proximity18_t * ctx)

Proximity 18 default configuration function.

This function executes a default configuration of Proximity 18 click board.

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

◆ proximity18_get_int_pin()

uint8_t proximity18_get_int_pin ( proximity18_t * ctx)

Proximity 18 get int pin function.

This function returns the INT pin logic state.

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

◆ proximity18_init()

err_t proximity18_init ( proximity18_t * ctx,
proximity18_cfg_t * cfg )

Proximity 18 initialization function.

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

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

◆ proximity18_read_proximity()

err_t proximity18_read_proximity ( proximity18_t * ctx,
uint16_t * ps1_data,
uint16_t * ps2_data,
uint16_t * ps3_data )

Proximity 18 read proximity function.

This function reads the proximity data from all 3 sensors.

Parameters
[in]ctx: Click context object. See proximity18_t object definition for detailed explanation.
[out]ps1_data: PS1 data from IRED1 sensor.
[out]ps2_data: PS2 data from IRED2 sensor.
[out]ps3_data: PS3 data from IRED3 sensor.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity18_read_register()

err_t proximity18_read_register ( proximity18_t * ctx,
uint8_t reg,
uint16_t * data_out )

Proximity 18 read register function.

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

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

◆ proximity18_start_measurement()

err_t proximity18_start_measurement ( proximity18_t * ctx)

Proximity 18 start measurement function.

This function starts the measurement by setting the one time trigger bit in the PS_CONF3_MS register.

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

◆ proximity18_wait_for_data_ready()

err_t proximity18_wait_for_data_ready ( proximity18_t * ctx)

Proximity 18 wait for data ready function.

This function waits for the MPX data ready interrupt flag.

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

◆ proximity18_write_register()

err_t proximity18_write_register ( proximity18_t * ctx,
uint8_t reg,
uint16_t data_in )

Proximity 18 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 proximity18_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.