HT32SX Generic Push Button
Generic Push Button application for HT32SX
monarch_api.h File Reference

Sigfox manufacturer functions. More...

#include "sigfox_types.h"
#include "sigfox_monarch_api.h"
Include dependency graph for monarch_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MONARCH_ERR_API_MALLOC   (sfx_u8)(0x80)
 
#define MONARCH_ERR_API_FREE   (sfx_u8)(0x81)
 
#define MONARCH_ERR_API_TIMER_START   (sfx_u8)(0x82)
 
#define MONARCH_ERR_API_TIMER_STOP   (sfx_u8)(0x83)
 
#define MONARCH_ERR_API_CONFIGURE_SEARCH_PATTERN   (sfx_u8)(0x84)
 
#define MONARCH_ERR_API_STOP_SEARCH_PATTERN   (sfx_u8)(0x85)
 
#define MONARCH_ERR_API_GET_VERSION   (sfx_u8)(0x86)
 

Functions

sfx_u8 MONARCH_API_malloc (sfx_u16 size, sfx_u8 **returned_pointer)
 Allocate memory for MONARCH library usage (Memory usage = size (Bytes)) This function is only called once at RC Scan. More...
 
sfx_u8 MONARCH_API_free (sfx_u8 *ptr)
 Free memory allocated to library with the MONARCH_API_malloc. More...
 
sfx_u8 MONARCH_API_timer_start (sfx_u16 timer_value, sfx_timer_unit_enum_t unit, sfx_error_t(*timeout_callback_handler)(void))
 This function starts a timer based on timer_value and the units. When the timer expires the manufacturer has to call the timer callback function (sigfox_callback_timeout_handler) More...
 
sfx_u8 MONARCH_API_timer_stop (void)
 This function stops the timer. More...
 
sfx_u8 MONARCH_API_configure_search_pattern (sfx_monarch_pattern_search_t list_freq_pattern[], sfx_u8 size, sfx_monarch_listening_mode_t mode, sfx_error_t(*monarch_pattern_freq_result_callback_handler)(sfx_u32 freq, sfx_pattern_enum_t pattern, sfx_s16 rssi))
 This function is used to configure a search pattern action from on the MCU/RF side. The list of frequencies to scan and associated pattern is given as parameter. When a pattern is found or the timeout ( set with MONARCH_API_timer_start ) occurs, the callback function has to be called. More...
 
sfx_u8 MONARCH_API_stop_search_pattern (void)
 This function stops the scan. More...
 
sfx_u8 MONARCH_API_get_version (sfx_u8 **version, sfx_u8 *size)
 This function returns current MONARCH API version. More...
 

Detailed Description

Sigfox manufacturer functions.

\if SIGFOX PATTERN


/ ___/ | | / ___| | ___| / _ \ \ \ / /
| |___ | | | | | |__ | | | | \ \/ /
___ \ | | | | _ | __| | | | | } {
___| | | | | |_| | | | | |_| | / /\ \ /_____/ |_| _____/ |_| _____/ /_/ _\


!!!! DO NOT MODIFY THIS FILE !!!!


 \endif

Author
Version
Date

This file defines the manufacturer's MONARCH functions to be implemented for library usage.

Function Documentation

◆ MONARCH_API_configure_search_pattern()

sfx_u8 MONARCH_API_configure_search_pattern ( sfx_monarch_pattern_search_t  list_freq_pattern[],
sfx_u8  size,
sfx_monarch_listening_mode_t  mode,
sfx_error_t(*)(sfx_u32 freq, sfx_pattern_enum_t pattern, sfx_s16 rssi)  monarch_pattern_freq_result_callback_handler 
)

This function is used to configure a search pattern action from on the MCU/RF side. The list of frequencies to scan and associated pattern is given as parameter. When a pattern is found or the timeout ( set with MONARCH_API_timer_start ) occurs, the callback function has to be called.


There are 2 modes that can be used : LISTENING_SWEEP and LISTENING_WINDOW modes. They are detailed in the sfx_monarch_listening_mode_t description

Parameters
[in]sfx_monarch_pattern_search_tlist_freq_pattern[] Tab of the frequencies / patterns to check
[in]sfx_u8size Size of the list (list_freq_pattern)
[in]sfx_monarch_listening_mode_tmode Mode of the scan
[in]monarch_pattern_freq_result_callback_handlerCallback function when a pattern is found or when the timer expires with the following parameters :
[in]sfx_u32freq Report the Frequency on which the pattern has been found
[in]sfx_pattern_enum_tpattern Pattern which has been found
[in]sfx_s16rssi RSSI level of the found pattern
Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_CONFIGURE_SEARCH_PATTERNSearch pattern error

◆ MONARCH_API_free()

sfx_u8 MONARCH_API_free ( sfx_u8 *  ptr)

Free memory allocated to library with the MONARCH_API_malloc.


Parameters
[in]sfx_u8*ptr pointer to buffer
[out]none
Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_FREEFree error

◆ MONARCH_API_get_version()

sfx_u8 MONARCH_API_get_version ( sfx_u8 **  version,
sfx_u8 *  size 
)

This function returns current MONARCH API version.


Parameters
[out]sfx_u8**version Pointer to Byte array (ASCII format) containing library version
[out]sfx_u8*size Size of the byte array pointed by *version
Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_GET_VERSIONGet Version error

◆ MONARCH_API_malloc()

sfx_u8 MONARCH_API_malloc ( sfx_u16  size,
sfx_u8 **  returned_pointer 
)

Allocate memory for MONARCH library usage (Memory usage = size (Bytes)) This function is only called once at RC Scan.


IMPORTANT NOTE:

The address reported need to be aligned with architecture of the microprocessor used. For a Microprocessor of:

  • 8 bits => any address is allowed
  • 16 bits => only address multiple of 2 are allowed
  • 32 bits => only address multiple of 4 are allowed
Parameters
[in]sfx_u16size size of buffer to allocate in bytes
[out]sfx_u8**returned_pointer pointer to buffer (can be static)
Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_MALLOCMalloc error

◆ MONARCH_API_stop_search_pattern()

sfx_u8 MONARCH_API_stop_search_pattern ( void  )

This function stops the scan.


Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_STOP_SEARCH_PATTERNStop seach pattern error

◆ MONARCH_API_timer_start()

sfx_u8 MONARCH_API_timer_start ( sfx_u16  timer_value,
sfx_timer_unit_enum_t  unit,
sfx_error_t(*)(void)  sigfox_callback_timeout_handler 
)

This function starts a timer based on timer_value and the units. When the timer expires the manufacturer has to call the timer callback function (sigfox_callback_timeout_handler)


Parameters
[in]sfx_u16timer_value Scan duration value ( with the unit parameter information )
[in]sfx_timer_unit_enum_tunit Unit to be considered for the scan time computation
[in]timeout_callback_handlerThis is the function that needs to be called when the timer expires ( either when RC Found or when Timeout )
Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_TIMER_STARTTimer Start error

◆ MONARCH_API_timer_stop()

sfx_u8 MONARCH_API_timer_stop ( void  )

This function stops the timer.


Return values
SFX_ERR_NONENo error
MONARCH_ERR_API_TIMER_STOPStop Timer error