terminal2  2.0.0.0
Main Page

Terminal 2 click

Terminal 2 Click is an adapter Click board™ used as a mikroBUS™ socket expansion board. It provides an easy and elegant solution for adding the external connection capability to the Click board™, plugged on a mikroBUS™ socket. Featuring two 9-position 2.54mm pitch terminal blocks makes it an easy way to expand the development system's connectivity with the mikroBUS™ socket while keeping the bus free to use with any Click board™.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Dec 2021.
  • Type : GPIO type

Software Support

We provide a library for the Terminal 2 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 from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Terminal 2 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstates the use of Terminal 2 click board by toggling all its pins.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger and sets all pins to low logic state.

void application_init ( void )
{
log_cfg_t log_cfg;
terminal2_cfg_t terminal2_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
terminal2_cfg_setup( &terminal2_cfg );
TERMINAL2_MAP_MIKROBUS( terminal2_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == terminal2_init( &terminal2, &terminal2_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Toggles all pins from mikroBUS one by one in the span of 1 second between each pin toggle.

void application_task ( void )
{
static digital_out_t *pin_addr[ 12 ] =
{
&terminal2.mosi, // 0 MOSI
&terminal2.miso, // 1 MISO
&terminal2.sck, // 2 SCK
&terminal2.cs, // 3 CS
&terminal2.rst, // 4 RST
&terminal2.an, // 5 AN
&terminal2.pwm, // 6 PWM
&terminal2.int_pin, // 7 INT
&terminal2.tx_pin, // 8 TX
&terminal2.rx_pin, // 9 RX
&terminal2.scl, // 10 SCL
&terminal2.sda // 11 SDA
};
static uint8_t pin_num = 0;
log_printf( &logger, " Toggling pin: %u\r\n", ( uint16_t ) pin_num );
terminal2_toggle_pin ( pin_addr[ pin_num ] );
Delay_ms ( 1000 );
terminal2_toggle_pin ( pin_addr[ pin_num ] );
pin_num++;
if ( 12 == pin_num )
{
pin_num = 0;
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Terminal2

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. UART terminal is available in all MikroElektronika compilers.


terminal2_set_all_pins_low
void terminal2_set_all_pins_low(terminal2_t *ctx)
Terminal 2 set all pins low function.
terminal2_cfg_t
Terminal 2 Click configuration object.
Definition: terminal2.h:111
terminal2_t
Terminal 2 Click context object.
Definition: terminal2.h:90
terminal2_toggle_pin
void terminal2_toggle_pin(digital_out_t *pin)
Terminal 2 toggle pin function.
terminal2_cfg_setup
void terminal2_cfg_setup(terminal2_cfg_t *cfg)
Terminal 2 configuration object setup function.
application_task
void application_task(void)
Definition: main.c:58
TERMINAL2_MAP_MIKROBUS
#define TERMINAL2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: terminal2.h:68
terminal2_init
err_t terminal2_init(terminal2_t *ctx, terminal2_cfg_t *cfg)
Terminal 2 initialization function.
application_init
void application_init(void)
Definition: main.c:27
terminal2_set_all_pins_high
void terminal2_set_all_pins_high(terminal2_t *ctx)
Terminal 2 set all pins high function.