tdc 2.0.0.0
TDC Click Driver

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

Topics

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

Functions

void tdc_cfg_setup (tdc_cfg_t *cfg)
 TDC configuration object setup function.
 
err_t tdc_init (tdc_t *ctx, tdc_cfg_t *cfg)
 TDC initialization function.
 
err_t tdc_default_cfg (tdc_t *ctx)
 TDC default configuration function.
 
err_t tdc_generic_write (tdc_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 TDC data writing function.
 
err_t tdc_generic_read (tdc_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 TDC data reading function.
 
err_t tdc_generic_write_byte (tdc_t *ctx, uint8_t reg, uint8_t data_in)
 TDC data write byte function.
 
err_t tdc_generic_read_byte (tdc_t *ctx, uint8_t reg, uint8_t *data_out)
 TDC data read function.
 
void tdc_gen_pulse (tdc_t *ctx, uint32_t u_sec, uint8_t n_stops)
 TDC pulse generation function.
 
void tdc_start_measurement (tdc_t *ctx)
 TDC start measurement function.
 
void tdc_setup_overflow (tdc_t *ctx, uint32_t overflow_ps)
 TDC setup overflow function.
 
err_t tdc_setup_measurement (tdc_t *ctx, uint8_t cal_periods, uint8_t avg_cycles, uint8_t num_stops, uint8_t mode)
 TDC setup measurement function.
 
err_t tdc_get_measurement (tdc_t *ctx, uint8_t clock_mode, uint8_t measure_num_stop, uint32_t *time, uint32_t *clock_countn, uint32_t *tof)
 TDC get measurement function.
 
uint8_t tdc_get_interrupt (tdc_t *ctx)
 TDC get interrupt function.
 
uint8_t tdc_get_trg (tdc_t *ctx)
 TDC get trigger signal function.
 

Detailed Description

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

◆ tdc_cfg_setup()

void tdc_cfg_setup ( tdc_cfg_t * cfg)

TDC configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ tdc_default_cfg()

err_t tdc_default_cfg ( tdc_t * ctx)

TDC default configuration function.

This function executes a default configuration of TDC click board.

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

◆ tdc_gen_pulse()

void tdc_gen_pulse ( tdc_t * ctx,
uint32_t u_sec,
uint8_t n_stops )

TDC pulse generation function.

This function pulse generation mikroBUS 2, RST pin ( Start ), CS pin ( Stop ).

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
[in]u_sec: Pulse period in microseconds.
[in]n_stops: Number of stop signals.
Returns
Nothing.
Note
None.

◆ tdc_generic_read()

err_t tdc_generic_read ( tdc_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

TDC data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

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

◆ tdc_generic_read_byte()

err_t tdc_generic_read_byte ( tdc_t * ctx,
uint8_t reg,
uint8_t * data_out )

TDC data read function.

This function reads byte of data from the selected register by using SPI serial interface.

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

◆ tdc_generic_write()

err_t tdc_generic_write ( tdc_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

TDC data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

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

◆ tdc_generic_write_byte()

err_t tdc_generic_write_byte ( tdc_t * ctx,
uint8_t reg,
uint8_t data_in )

TDC data write byte function.

This function writes byte of data from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ tdc_get_interrupt()

uint8_t tdc_get_interrupt ( tdc_t * ctx)

TDC get interrupt function.

This function get interrupt pin state of the TDC7200 Time-to-Digital Converter for Time-of-Flight Applications in LIDAR, Magnetostrictive and Flow Meters on the TDC click board™.

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
Returns
INT pin state.
Note
None.

◆ tdc_get_measurement()

err_t tdc_get_measurement ( tdc_t * ctx,
uint8_t clock_mode,
uint8_t measure_num_stop,
uint32_t * time,
uint32_t * clock_countn,
uint32_t * tof )

TDC get measurement function.

This function get measurements
of the TDC7200 Time-to-Digital Converter for Time-of-Flight Applications in LIDAR, Magnetostrictive and Flow Meters on the TDC click board™.

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
[in]clock_mode: MCU clock mode.
[in]measure_num_stop: Number of stops per measurement.
[out]time: Pointer to the Measured Times values.
[out]clock_countn: Pointer to the CLOCK Counter values.
[out]tof: Pointer to the Time Of Flight values.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ tdc_get_trg()

uint8_t tdc_get_trg ( tdc_t * ctx)

TDC get trigger signal function.

This function get trigger signal of the TDC7200 Time-to-Digital Converter for Time-of-Flight Applications in LIDAR, Magnetostrictive and Flow Meters on the TDC click board™.

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
Returns
TRG pin state.
Note
None.

◆ tdc_init()

err_t tdc_init ( tdc_t * ctx,
tdc_cfg_t * cfg )

TDC initialization function.

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

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

◆ tdc_setup_measurement()

err_t tdc_setup_measurement ( tdc_t * ctx,
uint8_t cal_periods,
uint8_t avg_cycles,
uint8_t num_stops,
uint8_t mode )

TDC setup measurement function.

This function measurements configuration
of the TDC7200 Time-to-Digital Converter for Time-of-Flight Applications in LIDAR, Magnetostrictive and Flow Meters on the TDC click board™.

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
[in]cal_periods: Number of measuring clock periods, one of ( 2, 10, 20, 40 ).
[in]avg_cycles: Set number of averaging cycles ( 1, 2, 4, 8, 16, 32, 64, 128 ).
[in]num_stops: Set number of stop pulses ( 1, 2, 3, 4, 5 ).
[in]mode: Set measurement mode ( 1, 2 ). Mode 1 is for measurements < 500 us.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ tdc_setup_overflow()

void tdc_setup_overflow ( tdc_t * ctx,
uint32_t overflow_ps )

TDC setup overflow function.

This function configuration of the overflow of the TDC7200 Time-to-Digital Converter for Time-of-Flight Applications in LIDAR, Magnetostrictive and Flow Meters on the TDC click board™.

Parameters
[in]ctx: Click context object. See tdc_t object definition for detailed explanation.
[in]overflow_ps: Overflow time in ( ps ).
Returns
Nothing.
Note
None.

◆ tdc_start_measurement()

void tdc_start_measurement ( tdc_t * ctx)

TDC start measurement function.

This function start a new measurement of the TDC7200 Time-to-Digital Converter for Time-of-Flight Applications in LIDAR, Magnetostrictive and Flow Meters on the TDC click board™.

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