proximity21  2.1.0.0
Modules | Functions
Proximity 21 Click Driver

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

Modules

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

Functions

void proximity21_cfg_setup (proximity21_cfg_t *cfg)
 Proximity 21 configuration object setup function. More...
 
err_t proximity21_init (proximity21_t *ctx, proximity21_cfg_t *cfg)
 Proximity 21 initialization function. More...
 
err_t proximity21_default_cfg (proximity21_t *ctx)
 Proximity 21 default configuration function. More...
 
err_t proximity21_reg_write_bytes (proximity21_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len)
 Proximity 21 reg write bytes function. More...
 
err_t proximity21_reg_read_bytes (proximity21_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len)
 Proximity 21 reg read bytes function. More...
 
err_t proximity21_reg_write_byte (proximity21_t *ctx, uint16_t reg, uint8_t data_in)
 Proximity 21 reg write byte function. More...
 
err_t proximity21_reg_read_byte (proximity21_t *ctx, uint16_t reg, uint8_t *data_out)
 Proximity 21 reg read byte function. More...
 
err_t proximity21_reg_write_word (proximity21_t *ctx, uint16_t reg, uint16_t data_in)
 Proximity 21 reg write word function. More...
 
err_t proximity21_reg_read_word (proximity21_t *ctx, uint16_t reg, uint16_t *data_out)
 Proximity 21 reg read word function. More...
 
err_t proximity21_reg_write_dword (proximity21_t *ctx, uint16_t reg, uint32_t data_in)
 Proximity 21 reg write dword function. More...
 
err_t proximity21_reg_read_dword (proximity21_t *ctx, uint16_t reg, uint32_t *data_out)
 Proximity 21 reg read dword function. More...
 
void proximity21_disable_device (proximity21_t *ctx)
 Proximity 21 disable device function. More...
 
void proximity21_enable_device (proximity21_t *ctx)
 Proximity 21 enable device function. More...
 
uint8_t proximity21_get_gpio1_pin (proximity21_t *ctx)
 Proximity 21 get GPIO1 pin function. More...
 
err_t proximity21_check_comm (proximity21_t *ctx)
 Proximity 21 check comm function. More...
 
err_t proximity21_set_i2c_address (proximity21_t *ctx, uint8_t address)
 Proximity 21 set I2C address function. More...
 
err_t proximity21_clear_interrupt (proximity21_t *ctx)
 Proximity 21 clear interrupt function. More...
 
err_t proximity21_start_ranging (proximity21_t *ctx)
 Proximity 21 start ranging function. More...
 
err_t proximity21_stop_ranging (proximity21_t *ctx)
 Proximity 21 stop ranging function. More...
 
err_t proximity21_set_range_timing (proximity21_t *ctx, uint32_t timing_budget_ms, uint32_t inter_measurement_ms)
 Proximity 21 set range timing function. More...
 
err_t proximity21_get_result (proximity21_t *ctx, proximity21_data_t *results)
 Proximity 21 get result function. More...
 

Detailed Description

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

◆ proximity21_cfg_setup()

void proximity21_cfg_setup ( proximity21_cfg_t cfg)

Proximity 21 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ proximity21_check_comm()

err_t proximity21_check_comm ( proximity21_t ctx)

Proximity 21 check comm function.

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

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

◆ proximity21_clear_interrupt()

err_t proximity21_clear_interrupt ( proximity21_t ctx)

Proximity 21 clear interrupt function.

This function clears the data ready interrupt.

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

◆ proximity21_default_cfg()

err_t proximity21_default_cfg ( proximity21_t ctx)

Proximity 21 default configuration function.

This function executes a default configuration of Proximity 21 Click board.

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

◆ proximity21_disable_device()

void proximity21_disable_device ( proximity21_t ctx)

Proximity 21 disable device function.

This function disables the device by setting the XSHUT pin to low logic state.

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

◆ proximity21_enable_device()

void proximity21_enable_device ( proximity21_t ctx)

Proximity 21 enable device function.

This function enables the device by setting the XSHUT pin to high logic state.

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

◆ proximity21_get_gpio1_pin()

uint8_t proximity21_get_gpio1_pin ( proximity21_t ctx)

Proximity 21 get GPIO1 pin function.

This function returns the GPIO1 (interrupt) pin logic state.

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

◆ proximity21_get_result()

err_t proximity21_get_result ( proximity21_t ctx,
proximity21_data_t results 
)

Proximity 21 get result function.

This function gets the results reported by the sensor.

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

◆ proximity21_init()

err_t proximity21_init ( proximity21_t ctx,
proximity21_cfg_t cfg 
)

Proximity 21 initialization function.

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

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

◆ proximity21_reg_read_byte()

err_t proximity21_reg_read_byte ( proximity21_t ctx,
uint16_t  reg,
uint8_t *  data_out 
)

Proximity 21 reg read byte function.

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

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

◆ proximity21_reg_read_bytes()

err_t proximity21_reg_read_bytes ( proximity21_t ctx,
uint16_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Proximity 21 reg read bytes 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 proximity21_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.

◆ proximity21_reg_read_dword()

err_t proximity21_reg_read_dword ( proximity21_t ctx,
uint16_t  reg,
uint32_t *  data_out 
)

Proximity 21 reg read dword function.

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

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

◆ proximity21_reg_read_word()

err_t proximity21_reg_read_word ( proximity21_t ctx,
uint16_t  reg,
uint16_t *  data_out 
)

Proximity 21 reg read word function.

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

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

◆ proximity21_reg_write_byte()

err_t proximity21_reg_write_byte ( proximity21_t ctx,
uint16_t  reg,
uint8_t  data_in 
)

Proximity 21 reg write byte function.

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

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

◆ proximity21_reg_write_bytes()

err_t proximity21_reg_write_bytes ( proximity21_t ctx,
uint16_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Proximity 21 reg write bytes 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 proximity21_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.

◆ proximity21_reg_write_dword()

err_t proximity21_reg_write_dword ( proximity21_t ctx,
uint16_t  reg,
uint32_t  data_in 
)

Proximity 21 reg write dword function.

This function writes a data dword starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity21_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: 32-bit data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity21_reg_write_word()

err_t proximity21_reg_write_word ( proximity21_t ctx,
uint16_t  reg,
uint16_t  data_in 
)

Proximity 21 reg write word function.

This function writes a data word starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity21_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: 16-bit data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity21_set_i2c_address()

err_t proximity21_set_i2c_address ( proximity21_t ctx,
uint8_t  address 
)

Proximity 21 set I2C address function.

This function sets a new 7-bit I2C address for the Click sensor.

Parameters
[in]ctx: Click context object. See proximity21_t object definition for detailed explanation.
[in]address: 7-bit I2C address to be set.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity21_set_range_timing()

err_t proximity21_set_range_timing ( proximity21_t ctx,
uint32_t  timing_budget_ms,
uint32_t  inter_measurement_ms 
)

Proximity 21 set range timing function.

This function sets the VCSEL enabled time, and the time between two measurements.

Parameters
[in]ctx: Click context object. See proximity21_t object definition for detailed explanation.
[in]timing_budget_ms: VCSEL enabled time in milliseconds (10 to 200ms), default 50ms.
[in]inter_measurement_ms: The time between two measurements in milliseconds. If the value is equal to 0, the time is defined by timing_budget_ms. Otherwise, it must be > timing_budget_ms, default 200ms.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity21_start_ranging()

err_t proximity21_start_ranging ( proximity21_t ctx)

Proximity 21 start ranging function.

This function starts a continuous ranging session.

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

◆ proximity21_stop_ranging()

err_t proximity21_stop_ranging ( proximity21_t ctx)

Proximity 21 stop ranging function.

This function stops the ranging session.

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