tdc2 2.1.0.0
tdc2.h File Reference

This file contains API for TDC 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  tdc2_t
 TDC 2 Click context object. More...
 
struct  tdc2_cfg_t
 TDC 2 Click configuration object. More...
 

Macros

#define TDC2_REG_CFG0   0x00
 TDC 2 description register.
 
#define TDC2_REG_CFG1   0x01
 
#define TDC2_REG_CFG2   0x02
 
#define TDC2_REG_CFG3   0x03
 
#define TDC2_REG_CFG4   0x04
 
#define TDC2_REG_CFG5   0x05
 
#define TDC2_REG_CFG6   0x06
 
#define TDC2_REG_CFG7   0x07
 
#define TDC2_REG_CFG8   0x08
 
#define TDC2_REG_CFG9   0x09
 
#define TDC2_REG_CFG10   0x0A
 
#define TDC2_REG_CFG11   0x0B
 
#define TDC2_REG_CFG12   0x0C
 
#define TDC2_REG_CFG13   0x0D
 
#define TDC2_REG_CFG14   0x0E
 
#define TDC2_REG_CFG15   0x0F
 
#define TDC2_REG_CFG16   0x10
 
#define TDC2_REG_INDEX_CH1_BYTE3   0x08
 TDC 2 data register.
 
#define TDC2_REG_INDEX_CH1_BYTE2   0x09
 
#define TDC2_REG_INDEX_CH1_BYTE1   0x0A
 
#define TDC2_REG_STOP_CH1_BYTE3   0x0B
 
#define TDC2_REG_STOP_CH1_BYTE2   0x0C
 
#define TDC2_REG_STOP_CH1_BYTE1   0x0D
 
#define TDC2_REG_INDEX_CH2_BYTE3   0x0E
 
#define TDC2_REG_INDEX_CH2_BYTE2   0x0F
 
#define TDC2_REG_INDEX_CH2_BYTE1   0x10
 
#define TDC2_REG_STOP_CH2_BYTE3   0x11
 
#define TDC2_REG_STOP_CH2_BYTE2   0x12
 
#define TDC2_REG_STOP_CH2_BYTE1   0x13
 
#define TDC2_REG_INDEX_CH3_BYTE3   0x14
 
#define TDC2_REG_INDEX_CH3_BYTE2   0x15
 
#define TDC2_REG_INDEX_CH3_BYTE1   0x16
 
#define TDC2_REG_STOP_CH3_BYTE3   0x17
 
#define TDC2_REG_STOP_CH3_BYTE2   0x18
 
#define TDC2_REG_STOP_CH3_BYTE1   0x19
 
#define TDC2_REG_INDEX_CH4_BYTE3   0x1A
 
#define TDC2_REG_INDEX_CH4_BYTE2   0x1B
 
#define TDC2_REG_INDEX_CH4_BYTE1   0x1C
 
#define TDC2_REG_STOP_CH4_BYTE3   0x1D
 
#define TDC2_REG_STOP_CH4_BYTE2   0x1E
 
#define TDC2_REG_STOP_CH4_BYTE1   0x1F
 
#define TDC2_SPIOPC_POWER   0x30
 TDC 2 description setting.
 
#define TDC2_SPIOPC_INIT   0x18
 
#define TDC2_SPIOPC_WRITE_CONFIG   0x80
 
#define TDC2_SPIOPC_READ_CONFIG   0x40
 
#define TDC2_SPIOPC_READ_RESULTS   0x60
 
#define TDC2_SPIOPC_READ_RESULTS   0x60
 
#define TDC2_ENABLE_STOP1_PIN   0x01
 TDC 2 CFG0 register description setting.
 
#define TDC2_DISABLE_STOP1_PIN   0x00
 
#define TDC2_ENABLE_STOP2_PIN   0x02
 
#define TDC2_DISABLE_STOP2_PIN   0x00
 
#define TDC2_ENABLE_STOP3_PIN   0x04
 
#define TDC2_DISABLE_STOP3_PIN   0x00
 
#define TDC2_ENABLE_STOP4_PIN   0x08
 
#define TDC2_DISABLE_STOP4_PIN   0x00
 
#define TDC2_ENABLE_REFCLK_PIN   0x10
 
#define TDC2_DISABLE_REFCLK_PIN   0x00
 
#define TDC2_ENABLE_DISABLE_PIN   0x40
 
#define TDC2_DISABLE_DISABLE_PIN   0x00
 
#define TDC2_ENABLE_RSTINDX_PIN   0x80
 
#define TDC2_DISABLE_RSTINDX_PIN   0x00
 
#define TDC2_HIT_ENABLE_STOP1   0x01
 TDC 2 CFG1 register description setting.
 
#define TDC2_HIT_DISABLE_STOP1   0x00
 
#define TDC2_HIT_ENABLE_STOP2   0x02
 
#define TDC2_HIT_DISABLE_STOP2   0x00
 
#define TDC2_HIT_ENABLE_STOP3   0x04
 
#define TDC2_HIT_DISABLE_STOP3   0x00
 
#define TDC2_HIT_ENABLE_STOP4   0x08
 
#define TDC2_HIT_DISABLE_STOP4   0x00
 
#define TDC2_CHANNEL_COMBINE_NORMAL   0x00
 
#define TDC2_CHANNEL_COMBINE_PULSE_DISTANCE   0x10
 
#define TDC2_CHANNEL_COMBINE_PULSE_WIDTH   0x20
 
#define TDC2_HIGH_RESOLUTION_OFF   0x00
 
#define TDC2_HIGH_RESOLUTION_X2   0x40
 
#define TDC2_HIGH_RESOLUTION_X4   0x80
 
#define TDC2_FIFO_COMMON_READ_OFF   0x00
 TDC 2 CFG2 register description setting.
 
#define TDC2_FIFO_COMMON_READ_ON   0x40
 
#define TDC2_FIFO_BLOCKWISE_READ_OFF   0x00
 
#define TDC2_FIFO_BLOCKWISE_READ_ON   0x80
 
#define TDC2_CFG6_FIXED_VALUE   0xC0
 TDC 2 fixed value registers description setting.
 
#define TDC2_CFG8_FIXED_VALUE   0xA1
 
#define TDC2_CFG9_FIXED_VALUE   0x13
 
#define TDC2_CFG10_FIXED_VALUE   0x00
 
#define TDC2_CFG11_FIXED_VALUE   0x0A
 
#define TDC2_CFG12_FIXED_VALUE   0xCC
 
#define TDC2_CFG13_FIXED_VALUE   0x05
 
#define TDC2_CFG14_FIXED_VALUE   0xF1
 
#define TDC2_CFG15_FIXED_VALUE   0x7D
 
#define TDC2_CFG16_FIXED_VALUE   0x04
 
#define TDC2_CFG7_FIXED_VALUE   0x23
 TDC 2 CFG7 register description setting.
 
#define TDC2_REFERENCE_CLOCK_INTERNAL   0x80
 
#define TDC2_REFERENCE_CLOCK_EXTERNAL   0x00
 
#define TDC2_1pS_RESOLUTION   125000
 TDC 2 resolution setting.
 
#define TDC2_5pS_RESOLUTION   62500
 
#define TDC2_10pS_RESOLUTION   12500
 
#define TDC2_uS_TO_mS   1000000
 
#define TDC2_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define TDC2_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define TDC2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  tdc2_return_value_t { TDC2_OK = 0 , TDC2_ERROR = -1 }
 TDC 2 Click return value data. More...
 

Functions

void tdc2_cfg_setup (tdc2_cfg_t *cfg)
 TDC 2 configuration object setup function.
 
err_t tdc2_init (tdc2_t *ctx, tdc2_cfg_t *cfg)
 TDC 2 initialization function.
 
err_t tdc2_default_cfg (tdc2_t *ctx)
 TDC 2 default configuration function.
 
err_t tdc2_generic_write (tdc2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 TDC 2 data writing function.
 
err_t tdc2_generic_read (tdc2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 TDC 2 data reading function.
 
err_t tdc2_write_config (tdc2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 TDC 2 config data writing function.
 
err_t tdc2_read_config (tdc2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 TDC 2 config data reading function.
 
err_t tdc2_read_results (tdc2_t *ctx, uint8_t reg, uint32_t *reference_index, uint32_t *stop_result)
 TDC 2 results data reading function.
 
err_t tdc2_send_command (tdc2_t *ctx, uint8_t command)
 TDC 2 send command function.
 
err_t tdc2_sw_reset (tdc2_t *ctx)
 TDC 2 software reset function.
 
err_t tdc2_start_measuring (tdc2_t *ctx)
 TDC 2 start measuring function.
 
err_t tdc2_set_resolution (tdc2_t *ctx, uint32_t resolution)
 TDC 2 set resolution function.
 
err_t tdc2_get_resolution (tdc2_t *ctx, uint32_t *resolution)
 TDC 2 set resolution function.
 
void tdc2_reset_index (tdc2_t *ctx)
 TDC 2 reset reference index function.
 
void tdc2_disable_stop_channels (tdc2_t *ctx)
 TDC 2 disable stop channels function.
 
void tdc2_enable_stop_channels (tdc2_t *ctx)
 TDC 2 enable stop channels function.
 
uint8_t tdc2_get_int_state (tdc2_t *ctx)
 TDC 2 get int state function.
 
err_t tdc2_get_time_between_stops (tdc2_t *ctx, uint32_t stop_result1, uint32_t reference_index1, uint32_t stop_result2, uint32_t reference_index2, uint32_t *time_in_us)
 TDC 2 get time between stops function.
 

Detailed Description

This file contains API for TDC 2 Click Driver.

Enumeration Type Documentation

◆ tdc2_return_value_t

TDC 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
TDC2_OK 
TDC2_ERROR