|
pcr 2.2.0
|
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. | |
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.
| void pcr_cfg_setup | ( | pcr_cfg_t * | cfg | ) |
PCR configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See pcr_cfg_t object definition for detailed explanation. |
| 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
0 - Success device not busy, 1 - Device busy. See #err_t definition for detailed explanation. | 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t pcr_default_cfg | ( | pcr_t * | ctx | ) |
PCR default configuration function.
This function executes a default configuration of PCR Click board.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | 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.
| [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. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | 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.
| [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. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| [out] | distance_data | : Read distance data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| [out] | status | : Read status data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void pcr_hw_reset | ( | pcr_t * | ctx | ) |
PCR hardware reset function.
This function is used to perform hardware reset of PCR Click board.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
PCR initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [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. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [out] | data_out | : Output read data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| [in] | pin_state | : State of the 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| [in] | pin_state | : State of the pin. |
| 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.
| [in] | ctx | : Click context object. See pcr_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.