proximity19  2.1.0.0
Modules | Functions
Proximity 19 Click Driver

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

Modules

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

Functions

void proximity19_cfg_setup (proximity19_cfg_t *cfg)
 Proximity 19 configuration object setup function. More...
 
err_t proximity19_init (proximity19_t *ctx, proximity19_cfg_t *cfg)
 Proximity 19 initialization function. More...
 
err_t proximity19_default_cfg (proximity19_t *ctx)
 Proximity 19 default configuration function. More...
 
err_t proximity19_generic_write (proximity19_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Proximity 19 I2C writing function. More...
 
err_t proximity19_generic_read (proximity19_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Proximity 19 I2C reading function. More...
 
err_t proximity19_sw_reset (proximity19_t *ctx)
 Proximity 19 software reset function. More...
 
err_t proximity19_get_part_id (proximity19_t *ctx, uint8_t *part_id)
 Proximity 19 get part ID function. More...
 
err_t proximity19_set_ps_gain (proximity19_t *ctx, uint8_t ps_gain)
 Proximity 19 set PS gain function. More...
 
err_t proximity19_set_pd_sel (proximity19_t *ctx, uint8_t pd_sel)
 Proximity 19 set PD photodiode function. More...
 
err_t proximity19_set_period (proximity19_t *ctx, uint8_t period)
 Proximity 19 set period function. More...
 
err_t proximity19_set_pulse_width (proximity19_t *ctx, uint8_t pulse_width)
 Proximity 19 set pulse width function. More...
 
err_t proximity19_set_vcsel_current (proximity19_t *ctx, uint8_t vcsel_current)
 Proximity 19 set VCSEL current function. More...
 
err_t proximity19_ps_enable (proximity19_t *ctx)
 Proximity 19 PS enable function. More...
 
err_t proximity19_ps_disable (proximity19_t *ctx)
 Proximity 19 PS standby function. More...
 
err_t proximity19_get_ps_data (proximity19_t *ctx, uint16_t *ps_data)
 Proximity 19 get PS data function. More...
 
err_t proximity19_get_distance (proximity19_t *ctx, float *distance)
 Proximity 19 get distance function. More...
 
err_t proximity19_set_ps_offset (proximity19_t *ctx, uint16_t ps_offset)
 Proximity 19 set PS offset function. More...
 
err_t proximity19_int_cfg (proximity19_t *ctx, uint8_t int_cfg)
 Proximity 19 interrupt configuration function. More...
 
err_t proximity19_set_ps_th (proximity19_t *ctx, uint16_t ps_th_high, uint16_t ps_th_low)
 Proximity 19 set PS threshold function. More...
 
err_t proximity19_get_manufact_id (proximity19_t *ctx, uint8_t *manufact_id)
 Proximity 19 get manufacture ID function. More...
 
uint8_t proximity19_get_int_pin (proximity19_t *ctx)
 Proximity 19 get interrupt function. More...
 

Detailed Description

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

◆ proximity19_cfg_setup()

void proximity19_cfg_setup ( proximity19_cfg_t cfg)

Proximity 19 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ proximity19_default_cfg()

err_t proximity19_default_cfg ( proximity19_t ctx)

Proximity 19 default configuration function.

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

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

◆ proximity19_generic_read()

err_t proximity19_generic_read ( proximity19_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Proximity 19 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using the I2C serial interface.

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

◆ proximity19_generic_write()

err_t proximity19_generic_write ( proximity19_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Proximity 19 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using the I2C serial interface.

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

◆ proximity19_get_distance()

err_t proximity19_get_distance ( proximity19_t ctx,
float *  distance 
)

Proximity 19 get distance function.

This function reads the distance measured by the sensor in millimeters by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[out]proximity: Object distance in millimeters [1mm-15mm].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_get_int_pin()

uint8_t proximity19_get_int_pin ( proximity19_t ctx)

Proximity 19 get interrupt function.

This function get states of the Interrupt ( INT ) pin of the RPR-0720, Reflective Type Photosensor Miniature Proximity Sensor on the Proximity 19 Click board.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_get_manufact_id()

err_t proximity19_get_manufact_id ( proximity19_t ctx,
uint8_t *  manufact_id 
)

Proximity 19 get manufacture ID function.

This function reads the manufacturer ID data by using the I2C serial interface.

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

◆ proximity19_get_part_id()

err_t proximity19_get_part_id ( proximity19_t ctx,
uint8_t *  part_id 
)

Proximity 19 get part ID function.

This function reads the part ID data by using the I2C serial interface.

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

◆ proximity19_get_ps_data()

err_t proximity19_get_ps_data ( proximity19_t ctx,
uint16_t *  ps_data 
)

Proximity 19 get PS data function.

This function reads the proximity sensor's raw data by using the I2C serial interface.

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

◆ proximity19_init()

err_t proximity19_init ( proximity19_t ctx,
proximity19_cfg_t cfg 
)

Proximity 19 initialization function.

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

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

◆ proximity19_int_cfg()

err_t proximity19_int_cfg ( proximity19_t ctx,
uint8_t  int_cfg 
)

Proximity 19 interrupt configuration function.

This function sets the desired configuration of the interrupt register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]ps_offset: PS offset data [0x0000-0x03FF].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_ps_disable()

err_t proximity19_ps_disable ( proximity19_t ctx)

Proximity 19 PS standby function.

This function sets PS standby mode by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]vcsel_current: VCSEL current [0x00-0x02].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_ps_enable()

err_t proximity19_ps_enable ( proximity19_t ctx)

Proximity 19 PS enable function.

This function performs PS data enabled by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]vcsel_current: VCSEL current [0x00-0x02].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_set_pd_sel()

err_t proximity19_set_pd_sel ( proximity19_t ctx,
uint8_t  pd_sel 
)

Proximity 19 set PD photodiode function.

This function sets the desired PD photodiode by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]pd_sel: PD photodiode [0x00-0x03].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_set_period()

err_t proximity19_set_period ( proximity19_t ctx,
uint8_t  period 
)

Proximity 19 set period function.

This function sets the desired data measurement period value by using the I2C serial interface.

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

◆ proximity19_set_ps_gain()

err_t proximity19_set_ps_gain ( proximity19_t ctx,
uint8_t  ps_gain 
)

Proximity 19 set PS gain function.

This function adjusts the gain of the sensor's sensitivity to light reception by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]ps_gain: PS gain selection [0x00-0x01].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_set_ps_offset()

err_t proximity19_set_ps_offset ( proximity19_t ctx,
uint16_t  ps_offset 
)

Proximity 19 set PS offset function.

This function sets the desired PS offset value by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]ps_offset: PS offset data [0x0000-0x03FF].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_set_ps_th()

err_t proximity19_set_ps_th ( proximity19_t ctx,
uint16_t  ps_th_high,
uint16_t  ps_th_low 
)

Proximity 19 set PS threshold function.

This function sets the desired high and low threshold data by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]ps_th_high: High threshold data [0x0000-0x0FFF].
[in]ps_th_low: Low threshold data [0x0000-0x0FFF].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_set_pulse_width()

err_t proximity19_set_pulse_width ( proximity19_t ctx,
uint8_t  pulse_width 
)

Proximity 19 set pulse width function.

This function sets the desired sensor pulse width value by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]pulse_width: VCSEL pulse width [0x00-0x03].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_set_vcsel_current()

err_t proximity19_set_vcsel_current ( proximity19_t ctx,
uint8_t  vcsel_current 
)

Proximity 19 set VCSEL current function.

This function sets the desired VCSEL current value by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See proximity19_t object definition for detailed explanation.
[in]vcsel_current: VCSEL current [0x00-0x02].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity19_sw_reset()

err_t proximity19_sw_reset ( proximity19_t ctx)

Proximity 19 software reset function.

This function performs sensor software reset by using the I2C serial interface.

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