tdc2 2.1.0.0
main.c File Reference

TDC 2 Click example. More...

#include "board.h"
#include "log.h"
#include "tdc2.h"

Functions

void dev_generate_stop (tdc2_t *ctx)
 Dev generate stop signal function.
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

TDC 2 Click example.

Description

This library contains API for TDC 2 Click driver. The library initializes and defines the SPI bus drivers to write and read data from registers, as well as the default configuration for a reading time between two STOP signals.

The demo application is composed of two sections :

Application Init

Initializes the driver after that resets the device and performs default configuration and sets the device in read mode.

Application Task

This example demonstrates the use of the TDC 2 Click board by measuring the time between two STOP signals. This example is set up to generate stop signals until FIFO fil's up which is indicated by interrupt pin going to low state. After that FIFO buffer is completely emptied by reading, and that data is used to calculate the time between STOP signals.

Note
In order to test this example, you will need to connect STOP1 with the DIS pin. Disable pin is disabled by software and it isn't going to affect the working state of the TDC 2 Click Bord.
Author
Stefan Ilic

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ dev_generate_stop()

void dev_generate_stop ( tdc2_t * ctx)

Dev generate stop signal function.

This function generates the stop signal by toggling DIS pin.

Parameters
[out]cfg: Click configuration structure. See tdc2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
DIS pin ( Disable STOP channels) is disabled by software and isn't affecting the example.

◆ main()

int main ( void )