force2  2.0.0.0
Main Page

Force 2 click

Force 2 Click is a mikroBUS™ add-on board with circuitry for implementing Honeywell’s FSS1500NGT Series force sensors into your projects (with a single zone force sensing resistor included with the click).

click Product page


Click library

  • Author : MikroE Team
  • Date : Feb 2020.
  • Type : ADC type

Software Support

We provide a library for the Force2 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 Force2 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void force2_cfg_setup ( force2_cfg_t *cfg );

  • Initialization function.

    FORCE2_RETVAL force2_init ( force2_t *ctx, force2_cfg_t *cfg );

Example key functions :

  • Generic read function.

    force2_data_t force2_generic_read ( force2_t *ctx );

Examples Description

This application is used to measure the pressure force.

The demo application is composed of two sections :

Application Init

Initalizes ADC driver, sets ADC channel and makes an initial log.

void application_init ( void )
{
log_cfg_t log_cfg;
// Logger initialization.
log_cfg.level = LOG_LEVEL_DEBUG;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
FORCE2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
force2_init( &force2, &cfg );
log_printf( &logger, "--------------------\r\n" );
log_printf( &logger, " Force 2 click \r\n" );
log_printf( &logger, "--------------------\r\n" );
Delay_ms( 100 );
}

Application Task

This is an example that shows the capabilities of the Force 2 click by taking measurements from the device and displaying it via USART terminal.

void application_task ( void )
{
uint32_t disp_val;
// Task implementation.
tmp = force2_generic_read ( &force2 );
disp_val = force2_val_conv( tmp, 4095, 15, 0 );
log_printf( &logger, "Force: %d N\r\n", disp_val );
Delay_ms( 500 );
}

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.Force2

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.


FORCE2_MAP_MIKROBUS
#define FORCE2_MAP_MIKROBUS(cfg, mikrobus)
Definition: force2.h:53
force2_data_t
uint16_t force2_data_t
Analog data type.
Definition: force2.h:77
force2_cfg_setup
void force2_cfg_setup(force2_cfg_t *cfg)
Config Object Initialization function.
force2_cfg_t
Click configuration structure definition.
Definition: force2.h:93
application_task
void application_task(void)
Definition: main.c:66
force2_val_conv
int32_t force2_val_conv(int32_t x, int32_t in_max, int32_t out_min, int32_t out_max)
Definition: main.c:34
force2_init
FORCE2_RETVAL force2_init(force2_t *ctx, force2_cfg_t *cfg)
Initialization function.
force2_generic_read
force2_data_t force2_generic_read(force2_t *ctx)
Generic read function.
application_init
void application_init(void)
Definition: main.c:41