spirit  2.0.0.0
Main Page

SPIRIT click

SPIRIT click carries the SP1ML 868MHz ultra low-power RF module. The board is designed to use 3.3V power supply and 3.3V or 5V I/O voltage levels. It communicates with the target MCU over UART interface, with additional functionality provided by the following pins on the mikroBUS™ line: PWM, RST, CS.

click Product page


Click library

  • Author : Jelena Milosavljevic
  • Date : Jun 2021.
  • Type : UART type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example reads and processes data from SPIRIT clicks.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the click board.

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.
SPIRIT_MAP_MIKROBUS( cfg, MIKROBUS_1 );
spirit_init( &spirit, &cfg );
Delay_ms( 1000 );
log_info( &logger, "---- Configuring the module ----" );
spirit_reset( &spirit );
Delay_ms( 1000 );
log_printf( &logger, "COMMAND MODE\r\n" );
spirit_process( );
log_printf( &logger, "FIRMWARE VERSION\r\n" );
spirit_process( );
log_printf( &logger, "TXRX LED - OPEN DRAIN OUTPUT\r\n" );
spirit_process( );
log_printf( &logger, "STORE CONFIG\r\n" );
spirit_process( );
log_printf( &logger, "OPERATING MODE\r\n" );
spirit_process( );
log_info( &logger, "---- The module has been configured ----" );
#ifdef DEMO_APP_RECEIVER
log_info( &logger, "---- RECEIVER MODE ----" );
#endif
#ifdef DEMO_APP_TRANSMITTER
log_info( &logger, "---- TRANSMITTER MODE ----" );
#endif
Delay_ms( 1000 );
}

Application Task

Depending on the selected mode, it reads all the received data or sends the desired message every 2 seconds.

void application_task ( void ) {
#ifdef DEMO_APP_RECEIVER
spirit_process( );
#endif
#ifdef DEMO_APP_TRANSMITTER
log_info( &logger, "---- The message has been sent ----" );
Delay_ms( 2000 );
#endif
}

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

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.


spirit_t
SPIRIT Click context object.
Definition: spirit.h:231
spirit_send_cmd_with_parameter
void spirit_send_cmd_with_parameter(spirit_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
SPIRIT_MAP_MIKROBUS
#define SPIRIT_MAP_MIKROBUS(cfg, mikrobus)
Definition: spirit.h:59
application_task
void application_task(void)
Definition: main.c:114
spirit_cfg_setup
void spirit_cfg_setup(spirit_cfg_t *cfg)
SPIRIT configuration object setup function.
spirit_send_cmd
void spirit_send_cmd(spirit_t *ctx, char *cmd)
Send command function.
SPIRIT_CMD_ENTER_OPERATING_MODE
#define SPIRIT_CMD_ENTER_OPERATING_MODE
Definition: spirit.h:99
SPIRIT_CMD_STORE_CURRENT_CONFIG
#define SPIRIT_CMD_STORE_CURRENT_CONFIG
Definition: spirit.h:102
SPIRIT_CMD_CFG_TXRX_LED
#define SPIRIT_CMD_CFG_TXRX_LED
Definition: spirit.h:148
SPIRIT_PCFG_TXRXLED_OPEN_DRAIN
#define SPIRIT_PCFG_TXRXLED_OPEN_DRAIN
Definition: spirit.h:201
spirit_set_mode
void spirit_set_mode(spirit_t *ctx, uint8_t mode)
Set mode function.
spirit_init
err_t spirit_init(spirit_t *ctx, spirit_cfg_t *cfg)
SPIRIT initialization function.
spirit_generic_write
void spirit_generic_write(spirit_t *ctx, char *data_buf, uint16_t len)
SPIRIT data writing function.
TEXT_TO_SEND
#define TEXT_TO_SEND
Definition: main.c:32
SPIRIT_OPERATING_MODE
#define SPIRIT_OPERATING_MODE
Definition: spirit.h:87
SPIRIT_CMD_READ_MODULE_VERSION
#define SPIRIT_CMD_READ_MODULE_VERSION
Definition: spirit.h:100
application_init
void application_init(void)
Definition: main.c:59
spirit_cfg_t
SPIRIT Click configuration object.
Definition: spirit.h:251
spirit_reset
void spirit_reset(spirit_t *ctx)
Software reset function.
SPIRIT_MODULE_WAKE_UP
#define SPIRIT_MODULE_WAKE_UP
Definition: spirit.h:90
spirit_power_module
void spirit_power_module(spirit_t *ctx, uint8_t power_state)
Power module function.
SPIRIT_CMD_ENTER_COMMAND_MODE
#define SPIRIT_CMD_ENTER_COMMAND_MODE
Definition: spirit.h:98