ft 2.0.0.0
Main Page

FT click

‍FT Click is a compact smart transceiver add-on board that helps you add a Free Topology (FT) interface to any host board with the mikroBUS™ socket. Leveraging FT, the most reliable and easiest-to-scale wired communications media, FT Click lets you network sensors and devices to create IoT solutions for automation and control networks that are easier to develop, integrate and install. This Click board™ supports full communication stacks for LON® and BACnet FT, as well as FTMQ (MQTT like messaging format) on board to simplify integration of BACnet, LON or custom IoT networks over twisted pair wire. FT Click is ideal for markets including smart buildings, cities, machines, agriculture, manufacturing, transportation and many more where wireless communications do not provide the required reliability and scale.

click Product page


Click library

  • Author : MikroE Team
  • Date : jun 2020.
  • Type : UART type

Software Support

We provide a library for the Ft Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

‍This library contains API for Ft Click driver.

Standard key functions :

  • ft_cfg_setup Config Object Initialization function.
    void ft_cfg_setup ( ft_cfg_t *cfg );
    void ft_cfg_setup(ft_cfg_t *cfg)
    Config Object Initialization function.
    Click configuration structure definition.
    Definition ft.h:153
  • ft_init Initialization function.
    err_t ft_init ( ft_t *ctx, ft_cfg_t *cfg );
    err_t ft_init(ft_t *ctx, ft_cfg_t *cfg)
    Initialization function.
    Click ctx object definition.
    Definition ft.h:128

Example key functions :

  • ft_get_data_status Use this function to get current status of data
    uint8_t ft_get_data_status ( ft_t *ctx );
    uint8_t ft_get_data_status(ft_t *ctx)
    Gets current status of data.
  • ft_get_data Use this function to read received data
    uint16_t ft_get_data ( ft_t *ctx, uint8_t *data_buf );
    uint16_t ft_get_data(ft_t *ctx, uint8_t *data_buf)
    Gets new received data.
  • ft_send_package Use this function to send data to other module
    void ft_send_package ( ft_t *ctx, uint8_t *data_buf, uint16_t len, uint8_t queue );
    void ft_send_package(ft_t *ctx, uint8_t *data_buf, uint16_t len, uint8_t queue)
    Sends full package to other module.

Example Description

‍This example demonstrates the use of an FT click board by showing the communication between the two click boards.

The demo application is composed of two sections :

Application Init

‍Initalizes device and makes an initial log.

void application_init ( void )
{
log_cfg_t log_cfg;
ft_cfg_t ft_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ft_cfg_setup( &ft_cfg );
FT_MAP_MIKROBUS( ft_cfg, MIKROBUS_1 );
if ( UART_ERROR == ft_init( &ft, &ft_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
#ifdef DEMO_APP_TRANSMITTER
log_printf( &logger, " Application Mode: Transmitter\r\n" );
#else
log_printf( &logger, " Application Mode: Receiver\r\n" );
#endif
log_info( &logger, " Application Task " );
}
#define FT_MAP_MIKROBUS(cfg, mikrobus)
Definition ft.h:66
void application_init(void)
Definition main.c:35

Application Task

‍Depending on the selected application mode, it reads all the received data or sends the desired text message once per second.

void application_task ( void )
{
#ifdef DEMO_APP_TRANSMITTER
log_printf( &logger, " Sent data: %s", ( char * ) DEMO_TEXT_MESSAGE );
Delay_ms ( 1000 );
#else
uint8_t rsp_data_buf[ FT_MAX_DATA_BUFFER ] = { 0 };
uint8_t rx_byte = 0;
if ( 1 == ft_generic_read( &ft, &rx_byte, 1 ) )
{
ft_isr_parser( &ft, rx_byte );
{
if ( ft_get_data( &ft, rsp_data_buf ) )
{
log_printf( &logger, " Received data: %s", rsp_data_buf );
}
}
}
#endif
}
#define FT_MAX_DATA_BUFFER
Definition ft.h:115
#define FT_NEW_DATA_AVAILABLE
Definition ft.h:106
void ft_isr_parser(ft_t *ctx, uint8_t rsp_data)
Collecting and preserving data received via uart interrupt routine.
int32_t ft_generic_read(ft_t *ctx, uint8_t *data_buf, uint16_t max_len)
Generic read function.
#define DEMO_TEXT_MESSAGE
Definition main.c:30
void application_task(void)
Definition main.c:70

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Ft

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.