proximity12 2.0.0.0
Proximity 12 Click Driver

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

Topics

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

Functions

void proximity12_cfg_setup (proximity12_cfg_t *cfg)
 Proximity 12 configuration object setup function.
 
err_t proximity12_init (proximity12_t *ctx, proximity12_cfg_t *cfg)
 Proximity 12 initialization function.
 
err_t proximity12_default_cfg (proximity12_t *ctx)
 Proximity 12 default configuration function.
 
err_t proximity12_generic_write (proximity12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Proximity 12 I2C writing function.
 
err_t proximity12_generic_read (proximity12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Proximity 12 I2C reading function.
 
err_t proximity12_check_device_id (proximity12_t *ctx)
 Proximity 12 check device ID function.
 
err_t proximity12_read_proximity (proximity12_t *ctx, uint16_t *prox_data)
 Proximity 12 read proximity function.
 
err_t proximity12_read_als (proximity12_t *ctx, proximity12_als_data_t *als)
 Proximity 12 read als data function.
 
err_t proximity12_wait_atime (proximity12_t *ctx)
 Proximity 12 wait atime function.
 
err_t proximity12_wait_ptime (proximity12_t *ctx)
 Proximity 12 wait ptime function.
 
err_t proximity12_enable (proximity12_t *ctx, uint8_t en_mask)
 Proximity 12 enable function.
 
err_t proximity12_enable_measurement (proximity12_t *ctx, uint8_t en_mask)
 Proximity 12 enable measurement function.
 
err_t proximity12_proximity_calibration (proximity12_t *ctx)
 Proximity 12 proximity calibration function.
 
err_t proximity12_set_proximity_filter (proximity12_t *ctx, uint8_t filter)
 Proximity 12 set proximity filter function.
 
err_t proximity12_set_led_isink (proximity12_t *ctx, uint8_t scaler, uint8_t current)
 Proximity 12 set led isink function.
 
err_t proximity12_set_proximity_gain (proximity12_t *ctx, uint8_t gain)
 Proximity 12 set proximity gain function.
 
err_t proximity12_set_agc_mod_gain (proximity12_t *ctx, uint8_t en_mask, uint8_t gain)
 Proximity 12 set agc modulator gain function.
 
void proximity12_set_syn_pin (proximity12_t *ctx, uint8_t state)
 Proximity 12 set syn pin state function.
 
void proximity12_set_gp1_pin (proximity12_t *ctx, uint8_t state)
 Proximity 12 set gp1 pin state function.
 
void proximity12_set_gp2_pin (proximity12_t *ctx, uint8_t state)
 Proximity 12 set gp2 pin state function.
 
uint8_t proximity12_get_int_pin (proximity12_t *ctx)
 Proximity 12 get int pin state function.
 

Detailed Description

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

◆ proximity12_cfg_setup()

void proximity12_cfg_setup ( proximity12_cfg_t * cfg)

Proximity 12 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ proximity12_check_device_id()

err_t proximity12_check_device_id ( proximity12_t * ctx)

Proximity 12 check device ID function.

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

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

◆ proximity12_default_cfg()

err_t proximity12_default_cfg ( proximity12_t * ctx)

Proximity 12 default configuration function.

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

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

◆ proximity12_enable()

err_t proximity12_enable ( proximity12_t * ctx,
uint8_t en_mask )

Proximity 12 enable function.

This function enables desired sensors.

Parameters
[in]ctx: Click context object. See proximity12_t object definition for detailed explanation.
[in]en_mask: Enable mask, refer to ENABLE register settings for more information.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity12_enable_measurement()

err_t proximity12_enable_measurement ( proximity12_t * ctx,
uint8_t en_mask )

Proximity 12 enable measurement function.

This function enables desired diodes for a measurement.

Parameters
[in]ctx: Click context object. See proximity12_t object definition for detailed explanation.
[in]en_mask: Enable mask, refer to MEAS_MODE0 register settings for more information.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity12_generic_read()

err_t proximity12_generic_read ( proximity12_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Proximity 12 I2C reading 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 proximity12_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity12_generic_write()

err_t proximity12_generic_write ( proximity12_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Proximity 12 I2C writing 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 proximity12_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity12_get_int_pin()

uint8_t proximity12_get_int_pin ( proximity12_t * ctx)

Proximity 12 get int pin state function.

This function returns the int pin logic state.

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

◆ proximity12_init()

err_t proximity12_init ( proximity12_t * ctx,
proximity12_cfg_t * cfg )

Proximity 12 initialization function.

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

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

◆ proximity12_proximity_calibration()

err_t proximity12_proximity_calibration ( proximity12_t * ctx)

Proximity 12 proximity calibration function.

This function performs a proximity calibration and waits until the calibration is finished.

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

◆ proximity12_read_als()

err_t proximity12_read_als ( proximity12_t * ctx,
proximity12_als_data_t * als )

Proximity 12 read als data function.

This function reads all als data measured by the click board.

Parameters
[in]ctx: Click context object. See proximity12_t object definition for detailed explanation.
[out]als: Als data structure. See proximity12_als_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ proximity12_read_proximity()

err_t proximity12_read_proximity ( proximity12_t * ctx,
uint16_t * prox_data )

Proximity 12 read proximity function.

This function reads the raw proximity value measured by the click board.

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

◆ proximity12_set_agc_mod_gain()

err_t proximity12_set_agc_mod_gain ( proximity12_t * ctx,
uint8_t en_mask,
uint8_t gain )

Proximity 12 set agc modulator gain function.

This function sets the agc modulator gains.

Parameters
[in]ctx: Click context object. See proximity12_t object definition for detailed explanation.
[in]en_mask: Enable mask, refer to AGC_ENABLE register settings for more information.
[in]gain: Gain mask [0-11].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This functions affects all modulator gain registers.

◆ proximity12_set_gp1_pin()

void proximity12_set_gp1_pin ( proximity12_t * ctx,
uint8_t state )

Proximity 12 set gp1 pin state function.

This function sets the gp1 pin state.

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

◆ proximity12_set_gp2_pin()

void proximity12_set_gp2_pin ( proximity12_t * ctx,
uint8_t state )

Proximity 12 set gp2 pin state function.

This function sets the gp2 pin state.

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

◆ proximity12_set_led_isink()

err_t proximity12_set_led_isink ( proximity12_t * ctx,
uint8_t scaler,
uint8_t current )

Proximity 12 set led isink function.

This function sets the LEDs sink scaler and current values.

Parameters
[in]ctx: Click context object. See proximity12_t object definition for detailed explanation.
[in]scaler: Scaler mask [0-3].
[in]current: Current mask [0-7].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This functions affects both PCFG2 and PCFG3 registers.

◆ proximity12_set_proximity_filter()

err_t proximity12_set_proximity_filter ( proximity12_t * ctx,
uint8_t filter )

Proximity 12 set proximity filter function.

This function sets the proximity filter by setting the PCFG1 register.

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

◆ proximity12_set_proximity_gain()

err_t proximity12_set_proximity_gain ( proximity12_t * ctx,
uint8_t gain )

Proximity 12 set proximity gain function.

This function sets the proximity gain by setting the PCFG4 register.

Parameters
[in]ctx: Click context object. See proximity12_t object definition for detailed explanation.
[in]gain: Gain mask [0-3].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This functions affects both PGAINs in PCFG4 register.

◆ proximity12_set_syn_pin()

void proximity12_set_syn_pin ( proximity12_t * ctx,
uint8_t state )

Proximity 12 set syn pin state function.

This function sets the syn pin state.

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

◆ proximity12_wait_atime()

err_t proximity12_wait_atime ( proximity12_t * ctx)

Proximity 12 wait atime function.

This function waits for als integration time which is set in the proper registers.

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

◆ proximity12_wait_ptime()

err_t proximity12_wait_ptime ( proximity12_t * ctx)

Proximity 12 wait ptime function.

This function waits for proximity sample time which is set in the proper registers.

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