pcr 2.1.0.0
PCR Click Driver

API for configuring and manipulating PCR Click driver. More...

Topics

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

Functions

void pcr_cfg_setup (pcr_cfg_t *cfg)
 PCR configuration object setup function.
 
err_t pcr_init (pcr_t *ctx, pcr_cfg_t *cfg)
 PCR initialization function.
 
err_t pcr_default_cfg (pcr_t *ctx)
 PCR default configuration function.
 
err_t pcr_generic_write (pcr_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 PCR I2C writing function.
 
err_t pcr_generic_read (pcr_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 PCR I2C reading function.
 
void pcr_set_wup_pin (pcr_t *ctx, uint8_t pin_state)
 PCR set wake up pin state function.
 
void pcr_set_rst_pin (pcr_t *ctx, uint8_t pin_state)
 PCR set reset pin state function.
 
uint8_t pcr_get_int_pin (pcr_t *ctx)
 PCR get interrupt pin state function.
 
void pcr_hw_reset (pcr_t *ctx)
 PCR hardware reset function.
 
err_t pcr_write_reg (pcr_t *ctx, uint16_t reg, uint32_t data_in)
 PCR register writing function.
 
err_t pcr_read_reg (pcr_t *ctx, uint16_t reg, uint32_t *data_out)
 PCR register reading function.
 
err_t pcr_get_status (pcr_t *ctx, uint32_t *status)
 PCR get status function.
 
err_t pcr_check_if_busy (pcr_t *ctx)
 PCR check if device is busy function.
 
err_t pcr_check_if_ok (pcr_t *ctx)
 PCR check if device is ok function.
 
err_t pcr_get_distance (pcr_t *ctx, uint32_t *distance_data)
 PCR read distance function.
 

Detailed Description

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

◆ pcr_cfg_setup()

void pcr_cfg_setup ( pcr_cfg_t * cfg)

PCR configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ pcr_check_if_busy()

err_t pcr_check_if_busy ( pcr_t * ctx)

PCR check if device is busy function.

This function is used to check if the PCR click board is busy.

Parameters
[in]ctx: Click context object. See pcr_t object definition for detailed explanation.
Returns
  • 0 - Success device not busy,
  • 1 - Device busy. See #err_t definition for detailed explanation.
Note
None.

◆ pcr_check_if_ok()

err_t pcr_check_if_ok ( pcr_t * ctx)

PCR check if device is ok function.

This function is used to read status register, if any error flags are up, function will return error.

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

◆ pcr_default_cfg()

err_t pcr_default_cfg ( pcr_t * ctx)

PCR default configuration function.

This function executes a default configuration of PCR click board.

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

◆ pcr_generic_read()

err_t pcr_generic_read ( pcr_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

PCR 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 pcr_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.

◆ pcr_generic_write()

err_t pcr_generic_write ( pcr_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

PCR 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 pcr_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.

◆ pcr_get_distance()

err_t pcr_get_distance ( pcr_t * ctx,
uint32_t * distance_data )

PCR read distance function.

This function is used to read distance from the PCR click board.

Parameters
[in]ctx: Click context object. See pcr_t object definition for detailed explanation.
[out]distance_data: Read distance data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pcr_get_int_pin()

uint8_t pcr_get_int_pin ( pcr_t * ctx)

PCR get interrupt pin state function.

This function is used to read interrupt pin state of PCR click board.

Parameters
[in]ctx: Click context object. See pcr_t object definition for detailed explanation.
Returns
State of the interrupt pin.
Note
None.

◆ pcr_get_status()

err_t pcr_get_status ( pcr_t * ctx,
uint32_t * status )

PCR get status function.

This function is used to read status register of the PCR click board.

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

◆ pcr_hw_reset()

void pcr_hw_reset ( pcr_t * ctx)

PCR hardware reset function.

This function is used to perform hardware reset of PCR click board.

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

◆ pcr_init()

err_t pcr_init ( pcr_t * ctx,
pcr_cfg_t * cfg )

PCR initialization function.

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

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

◆ pcr_read_reg()

err_t pcr_read_reg ( pcr_t * ctx,
uint16_t reg,
uint32_t * data_out )

PCR register reading function.

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

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

◆ pcr_set_rst_pin()

void pcr_set_rst_pin ( pcr_t * ctx,
uint8_t pin_state )

PCR set reset pin state function.

This function is used to set reset pin state of PCR click board.

Parameters
[in]ctx: Click context object. See pcr_t object definition for detailed explanation.
[in]pin_state: State of the pin.
Returns
Nothing.
Note
None.

◆ pcr_set_wup_pin()

void pcr_set_wup_pin ( pcr_t * ctx,
uint8_t pin_state )

PCR set wake up pin state function.

This function is used to set wake up pin state of PCR click board.

Parameters
[in]ctx: Click context object. See pcr_t object definition for detailed explanation.
[in]pin_state: State of the pin.
Returns
Nothing.
Note
None.

◆ pcr_write_reg()

err_t pcr_write_reg ( pcr_t * ctx,
uint16_t reg,
uint32_t data_in )

PCR register writing function.

This function writes a desired data bytes into the selected register by using I2C serial interface.

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