tmrmixsens 2.0.0.0
Main Page

TMR mix-sens click

The TMR mix-sens Click is an add-on board equipped with the TMR digital push-pull and analog magnetic sensors, as well as intensity of magnetic field indicator.

click Product page


Click library

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

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    ‍void tmrmixsens_cfg_setup ( tmrmixsens_cfg_t *cfg );

    - Initialization function.

    ‍TMRMIXSENS_RETVAL tmrmixsens_init ( tmrmixsens_t *ctx, tmrmixsens_cfg_t *cfg );

    Example key functions :

  • Generic read function.

    ‍tmrmixsens_data_t tmrmixsens_generic_read ( tmrmixsens_t *ctx );

    - Get state of the omnipolar ( OMN ) pin function.

    ‍uint8_t tmrmixsens_get_omnipolar ( tmrmixsens_t *ctx );

  • Get state of the bipolar ( BI ) pin function.

    ‍uint8_t tmrmixsens_get_bipolar ( tmrmixsens_t *ctx );

    Examples Description

‍The TMR mix-sens Click has three types of magnetic field sensors: Two digital and one analog sensor.

The demo application is composed of two sections :

Application Init

‍Initializes the driver and logger and makes an initial log.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
TMRMIXSENS_MAP_MIKROBUS( cfg, MIKROBUS_1 );
tmrmixsens_init( &tmrmixsens, &cfg );
}
#define TMRMIXSENS_MAP_MIKROBUS(cfg, mikrobus)
Definition tmrmixsens.h:67
void tmrmixsens_cfg_setup(tmrmixsens_cfg_t *cfg)
Config Object Initialization function.
TMRMIXSENS_RETVAL tmrmixsens_init(tmrmixsens_t *ctx, tmrmixsens_cfg_t *cfg)
Initialization function.
void application_init(void)
Definition main.c:35
Click configuration structure definition.
Definition tmrmixsens.h:124

Application Task

‍Displays the ADC value of linear output and the states of bipolar and omnipolar indicators on the USB UART each second.

void application_task ( void )
{
tmp = tmrmixsens_generic_read ( &tmrmixsens );
log_printf( &logger, " ADC value of linear output : %d \r\n", tmp );
log_printf( &logger, " Bipolar response: " );
{
log_printf( &logger, " North pole is detected!\r\n" );
}
else if( tmrmixsens_get_bipolar( &tmrmixsens ) == TMRMIXSENS_SOUTH_POLE )
{
log_printf( &logger, " South pole is detected!\r\n" );
}
if ( tmrmixsens_get_omnipolar ( &tmrmixsens ) == 0 )
{
log_printf( &logger, " Omnipolar response: Either South or North pole is detected!\r\n" );
}
log_printf( &logger, "--------------------------------------\r\n" );
Delay_ms ( 1000 );
}
uint8_t tmrmixsens_get_omnipolar(tmrmixsens_t *ctx)
Get state of the omnipolar ( OMN ) pin function.
tmrmixsens_data_t tmrmixsens_generic_read(tmrmixsens_t *ctx)
Generic read function.
uint8_t tmrmixsens_get_bipolar(tmrmixsens_t *ctx)
Get state of the bipolar ( BI ) pin function.
#define TMRMIXSENS_NORTH_POLE
Definition tmrmixsens.h:89
#define TMRMIXSENS_SOUTH_POLE
Definition tmrmixsens.h:88
uint16_t tmrmixsens_data_t
Analog data type.
Definition tmrmixsens.h:102
void application_task(void)
Definition main.c:60

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

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.