pcr 2.1.0.0
pcr.h File Reference

This file contains API for PCR Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  pcr_t
 PCR Click context object. More...
 
struct  pcr_cfg_t
 PCR Click configuration object. More...
 

Macros

#define PCR_REG_VERSION   0x0000
 PCR description register.
 
#define PCR_REG_PROTOCOL_STATUS   0x0001
 
#define PCR_REG_MEASURE_CNT   0x0002
 
#define PCR_REG_DETECTOR_STATUS   0x0003
 
#define PCR_REG_DISTANCE_RESULT   0x0010
 
#define PCR_REG_PEAK0_DISTANCE   0x0011
 
#define PCR_REG_PEAK1_DISTANCE   0x0012
 
#define PCR_REG_PEAK2_DISTANCE   0x0013
 
#define PCR_REG_PEAK3_DISTANCE   0x0014
 
#define PCR_REG_PEAK4_DISTANCE   0x0015
 
#define PCR_REG_PEAK5_DISTANCE   0x0016
 
#define PCR_REG_PEAK6_DISTANCE   0x0017
 
#define PCR_REG_PEAK7_DISTANCE   0x0018
 
#define PCR_REG_PEAK8_DISTANCE   0x0019
 
#define PCR_REG_PEAK9_DISTANCE   0x001A
 
#define PCR_REG_PEAK0_STRENGTH   0x001B
 
#define PCR_REG_PEAK1_STRENGTH   0x001C
 
#define PCR_REG_PEAK2_STRENGTH   0x001D
 
#define PCR_REG_PEAK3_STRENGTH   0x001E
 
#define PCR_REG_PEAK4_STRENGTH   0x001F
 
#define PCR_REG_PEAK5_STRENGTH   0x0020
 
#define PCR_REG_PEAK6_STRENGTH   0x0021
 
#define PCR_REG_PEAK7_STRENGTH   0x0022
 
#define PCR_REG_PEAK8_STRENGTH   0x0023
 
#define PCR_REG_PEAK9_STRENGTH   0x0024
 
#define PCR_REG_START   0x0040
 
#define PCR_REG_END   0x0041
 
#define PCR_REG_MAX_STEP_LEN   0x0042
 
#define PCR_REG_CLOSE_RANGE_LEAK   0x0043
 
#define PCR_REG_SIGNAL_QUALITY   0x0044
 
#define PCR_REG_MAX_PROFILE   0x0045
 
#define PCR_REG_TRESHOLD_SENSITIVITY   0x0046
 
#define PCR_REG_PEAK_SORTI   0x0047
 
#define PCR_REG_MAX_FRAMES_RECORDED   0x0048
 
#define PCR_REG_AMPLITUDE_TERSHOLD   0x0049
 
#define PCR_REG_TERSHOLD_SENSITIVITY   0x004A
 
#define PCR_REG_REFLECTOR_SHAPE   0x004B
 
#define PCR_REG_STRENGHT_TRESHOLD   0x004C
 
#define PCR_REG_MEASURE_ON_WAKEUP   0x0080
 
#define PCR_REG_COMMAND   0x0100
 
#define PCR_STATUS_RSS_REG_OK   0x00000001ul
 PCR description setting.
 
#define PCR_STATUS_CFG_CREATE_OK   0x00000002ul
 
#define PCR_STATUS_SENSOR_CREATE_OK   0x00000004ul
 
#define PCR_STATUS_DETECTOR_CREATE_OK   0x00000008ul
 
#define PCR_STATUS_DETECTOR_BUFFER_OK   0x00000010ul
 
#define PCR_STATUS_SENSOR_BUFFER_OK   0x00000020ul
 
#define PCR_STATUS_CALIB_BUFFER_OK   0x00000040ul
 
#define PCR_STATUS_CFG_APPLY_OK   0x00000080ul
 
#define PCR_STATUS_SENSOR_CALIB_OK   0x00000100ul
 
#define PCR_STATUS_DETECTOR_CALIB_OK   0x00000200ul
 
#define PCR_STATUS_RSS_REG_ERR   0x00010000ul
 
#define PCR_STATUS_CFG_CREATE_ERR   0x00020000ul
 
#define PCR_STATUS_SENSOR_CREATE_ERR   0x00040000ul
 
#define PCR_STATUS_DETECTOR_CREATE_ERR   0x00080000ul
 
#define PCR_STATUS_DETECTOR_BUFFER_ERR   0x00100000ul
 
#define PCR_STATUS_SENSOR_BUFFER_ERR   0x00200000ul
 
#define PCR_STATUS_CALIB_BUFFER_ERR   0x00400000ul
 
#define PCR_STATUS_CFG_APPLY_ERR   0x00800000ul
 
#define PCR_STATUS_SENSOR_CALIB_ERR   0x01000000ul
 
#define PCR_STATUS_DETECTOR_CALIB_ERR   0x02000000ul
 
#define PCR_STATUS_DETECTOR_ERR   0x10000000ul
 
#define PCR_STATUS_BUSY   0x80000000ul
 
#define PCR_APPLY_CFG_AND_CALIB_CMD   0x00000001ul
 PCR commands setting.
 
#define PCR_MEASURE_DISTANCE_CMD   0x00000002ul
 
#define PCR_APPLY_CONFIGURATION_CMD   0x00000003ul
 
#define PCR_CALIBRATE_CMD   0x00000004ul
 
#define PCR_RECALIBRATE_CMD   0x00000005ul
 
#define PCR_ENABLE_UART_LOGS_CMD   0x00000020ul
 
#define PCR_DISABLE_UART_LOGS_CMD   0x00000021ul
 
#define PCR_LOG_CONFIGURATION_CMD   0x00000022ul
 
#define PCR_RESET_MODULE_CMD   0x52535421ul
 
#define PCR_PIN_STATE_HIGH   0x01
 PCR pin state setting.
 
#define PCR_PIN_STATE_LOW   0x00
 
#define PCR_MIN_DISTANCE   10
 PCR distance setting.
 
#define PCR_MAX_DISTANCE   5000
 
#define PCR_DEVICE_ADDRESS   0x52
 PCR device address setting.
 
#define PCR_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  pcr_return_value_t { PCR_OK = 0 , PCR_BUSY = 1 , PCR_ERROR = -1 }
 PCR Click return value data. More...
 

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

This file contains API for PCR Click Driver.

Enumeration Type Documentation

◆ pcr_return_value_t

PCR Click return value data.

Predefined enum values for driver return values.

Enumerator
PCR_OK 
PCR_BUSY 
PCR_ERROR