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 :

  • spirit_power_module Function for power mode of SPIRIT click.
    void spirit_power_module ( spirit_t *ctx, uint8_t power_state );
    void spirit_power_module(spirit_t *ctx, uint8_t power_state)
    Power module function.
  • spirit_reset Function for reseting SPIRIT click.
    void spirit_reset ( spirit_t *ctx );
    void spirit_reset(spirit_t *ctx)
    Software reset function.
  • spirit_set_mode Function for setting mode of SPIRIT click.
    void spirit_set_mode ( spirit_t *ctx, uint8_t mode );
    void spirit_set_mode(spirit_t *ctx, uint8_t mode)
    Set mode function.

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 );
}
#define SPIRIT_CMD_CFG_TXRX_LED
Definition spirit.h:152
#define SPIRIT_MAP_MIKROBUS(cfg, mikrobus)
Definition spirit.h:63
#define SPIRIT_OPERATING_MODE
Definition spirit.h:91
#define SPIRIT_MODULE_WAKE_UP
Definition spirit.h:94
#define SPIRIT_CMD_ENTER_COMMAND_MODE
Definition spirit.h:102
#define SPIRIT_CMD_READ_MODULE_VERSION
Definition spirit.h:104
#define SPIRIT_CMD_STORE_CURRENT_CONFIG
Definition spirit.h:106
#define SPIRIT_CMD_ENTER_OPERATING_MODE
Definition spirit.h:103
#define SPIRIT_PCFG_TXRXLED_OPEN_DRAIN
Definition spirit.h:205
void spirit_send_cmd_with_parameter(spirit_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
void spirit_send_cmd(spirit_t *ctx, char *cmd)
Send command function.
void application_init(void)
Definition main.c:59

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 ( 1000 );
Delay_ms ( 1000 );
#endif
}
void spirit_generic_write(spirit_t *ctx, char *data_buf, uint16_t len)
SPIRIT data writing function.
void application_task(void)
Definition main.c:114
#define TEXT_TO_SEND
Definition main.c:32

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.