HT32SX Monarch Scan
Monarch Scan application for HT32SX
st_rf_api.h File Reference

Sigfox manufacturer functions. More...

#include "sigfox_types.h"

Go to the source code of this file.

Macros

#define ST_RF_ERR_API_ERROR   (sfx_u8)(0x01)
 
#define TIMER_START   0
 
#define TIMER_STOP   1
 

Functions

sfx_u8 ST_RF_API_set_xtal_freq (sfx_u32 xtal)
 Sets the XTAL frequency of the S2-LP in Hertz (default is 50MHz). More...
 
sfx_u8 ST_RF_API_get_xtal_freq (sfx_u32 *xtal)
 Gets the RF frequency offset of the S2-LP XTAL in Hertz. More...
 
sfx_u8 ST_RF_API_set_freq_offset (sfx_s32 offset)
 Sets the RF frequency offset in Hertz (default is 0 Hz). More...
 
sfx_u8 ST_RF_API_get_freq_offset (sfx_s32 *offset)
 
sfx_u8 ST_RF_API_set_rssi_offset (sfx_s8 rssi_off)
 Set an RSSI offset for the RSSI. More...
 
sfx_u8 ST_RF_API_get_rssi_offset (sfx_s8 *rssi_off)
 Get the RSSI offset for the RSSI. More...
 
sfx_u8 ST_RF_API_set_lbt_thr_offset (sfx_s8 lbt_thr_off)
 Set an offset (dB) for tuning the LBT mechanism. More...
 
sfx_u8 ST_RF_API_get_lbt_thr_offset (sfx_s8 *lbt_thr_off)
 Get the LBT offset (dB) for the LBT mechanism. More...
 
sfx_u8 ST_RF_API_gpio_irq_pin (sfx_u8 gpio_pin)
 Configures one of the S2-LP pin to be an IRQ pin. More...
 
sfx_u8 ST_RF_API_gpio_tx_rx_pin (sfx_u8 gpio_pin)
 Configures one of the S2-LP pin to be to be configured as (RX or TX) signal. More...
 
sfx_u8 ST_RF_API_gpio_rx_pin (sfx_u8 gpio_pin)
 Configures one of the S2-LP pin to be configured as RX signal. More...
 
sfx_u8 ST_RF_API_gpio_tx_pin (sfx_u8 gpio_pin)
 Configures one of the S2-LP pin to be configured as TX signal. More...
 
sfx_u8 ST_RF_API_reduce_output_power (sfx_s16 reduction)
 Reduces the output power of the transmitted signal by a facor (reduction*0.5dB against the actual value). More...
 
sfx_u8 ST_RF_API_set_tcxo (sfx_u8 tcxo)
 Instructs the library to configure the S2-LP for a TCXO or for a XTAL. More...
 
sfx_u8 ST_RF_API_smps (sfx_u8 mode)
 Instructs the library to configure the S2-LP with a user defined smps frequency. More...
 
sfx_u8 ST_RF_API_set_pa (sfx_u8 pa)
 Instructs the library to configure the S2-LP for a external PA (Power Amplifier). More...
 
sfx_u8 ST_RF_API_get_ramp_duration (void)
 Returns the duration of the initial (or final) ramp in ms. More...
 
void ST_RF_API_S2LP_IRQ_CB (void)
 This is a callback exported by the RF_API library. The RF_API module configures the S2-LP to raise interrupts and to notify them on a GPIO. When the interrupt of that GPIO is raised, this function must be called. It must be called when the S2-LP raises the IRQ via GPIO. More...
 
void ST_RF_API_Timer_CB (sfx_u8 state)
 
void ST_RF_API_Timer_Channel_Clear_CB (void)
 This is a callback exported by the RF_API library. It must be called when the timer started by MCU_API_timer_start_carrier_sense expires. More...
 
sfx_u8 ST_RF_API_Get_Continuous_TX_or_MONARCH_Scan_Flag (void)
 
sfx_u8 ST_RF_API_StartTx (void)
 This is a function to force S2LP to switch in TX mode.
It is called from Monarch detection algorithm. More...
 
sfx_u8 ST_RF_API_StartRx (void)
 This is a function to force S2LP to switch in RX mode.
It is called from Monarch detection algorithm. More...
 
sfx_u8 ST_RF_API_StopRxTx (void)
 This is a function to force S2LP to switch in Ready mode.
It is called from Monarch detection algorithm. More...
 
sfx_s16 ST_RF_API_GetRSSI (void)
 This is a function to Get the latest detected RSSI
It is called from Monarch detection algorithm. More...
 
void ST_RF_API_ReadFifo (sfx_u8 n_bytes, sfx_u8 *buffer, sfx_u8 flush)
 
sfx_u8 ST_RF_API_ReadFifoStatus (void)
 
void ST_RF_API_SetFifoLength (sfx_u8 n_bytes)
 

Detailed Description

Sigfox manufacturer functions.

Author
AMG - RF Application team
Version
2.2.2
Date
November 24, 2017

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

Macro Definition Documentation

◆ ST_RF_ERR_API_ERROR

#define ST_RF_ERR_API_ERROR   (sfx_u8)(0x01)

Error on ST_RF_API

Function Documentation

◆ ST_RF_API_get_lbt_thr_offset()

sfx_u8 ST_RF_API_get_lbt_thr_offset ( sfx_s8 *  lbt_thr_off)

Get the LBT offset (dB) for the LBT mechanism.


Parameters
[in]sfx_s8*lbt_thr_off: a pointer to the integer representing the offset in dB. Default value is 0.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_get_ramp_duration()

sfx_u8 ST_RF_API_get_ramp_duration ( void  )

Returns the duration of the initial (or final) ramp in ms.


Parameters
[in]None.
Return values
Rampduration in ms.

◆ ST_RF_API_get_rssi_offset()

sfx_u8 ST_RF_API_get_rssi_offset ( sfx_s8 *  rssi_off)

Get the RSSI offset for the RSSI.


Parameters
[in]sfx_s8*rssi_off: a pointer to the integer representing the offset in dB. Default value is 0.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_get_xtal_freq()

sfx_u32 ST_RF_API_get_xtal_freq ( sfx_u32 *  xtal)

Gets the RF frequency offset of the S2-LP XTAL in Hertz.


Parameters
[in]sfx_s32*xtal: a pointer to the integer representing the S2-LP XTAL frequency in Hertz.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_GetRSSI()

void ST_RF_API_GetRSSI ( void  )

This is a function to Get the latest detected RSSI
It is called from Monarch detection algorithm.


Parameters
[in]None.
Return values
RSSIlevel.

◆ ST_RF_API_gpio_irq_pin()

sfx_u8 ST_RF_API_gpio_irq_pin ( sfx_u8  gpio_pin)

Configures one of the S2-LP pin to be an IRQ pin.


Parameters
[in]sfx_u8gpio_pin: an integer in the range [0,3] representing the GPIO to be used as IRQ. Default value is 3.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_gpio_rx_pin()

sfx_u8 ST_RF_API_gpio_rx_pin ( sfx_u8  gpio_pin)

Configures one of the S2-LP pin to be configured as RX signal.


Parameters
[in]sfx_u8gpio_pin: an integer in the range [0,3] representing the GPIO to be configured as RX signal. Pass the value 0xFF if the GPIO should not be configured.
Note
Only for RCZ2/4. Uneffective for RCZ1. This function must be called before ST_SIGFOX_API_open .
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_gpio_tx_pin()

sfx_u8 ST_RF_API_gpio_tx_pin ( sfx_u8  gpio_pin)

Configures one of the S2-LP pin to be configured as TX signal.


Parameters
[in]sfx_u8gpio_pin: an integer in the range [0,3] representing the GPIO to be configured as TX signal. Pass the value 0xFF if the GPIO should not be configured.
Note
Only for RCZ2/4. Uneffective for RCZ1. This function must be called before ST_SIGFOX_API_open .
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_gpio_tx_rx_pin()

sfx_u8 ST_RF_API_gpio_tx_rx_pin ( sfx_u8  gpio_pin)

Configures one of the S2-LP pin to be to be configured as (RX or TX) signal.


Parameters
[in]sfx_u8gpio_pin: an integer in the range [0,3] representing the GPIO to be configured as (RX or TX) signal. Pass the value 0xFF if the GPIO should not be configured.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_reduce_output_power()

sfx_u8 ST_RF_API_reduce_output_power ( sfx_s16  reduction)

Reduces the output power of the transmitted signal by a facor (reduction*0.5dB against the actual value).


Each positive step of 1 reduces the power at S2-LP level of about 0.5dB. A negative value increase the power level of the same quantity.
The function returns an error if the output power is bigger than the one used dutring cerification.

Parameters
[in]sfx_s16reduction: the reduction factor.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_S2LP_IRQ_CB()

void ST_RF_API_S2LP_IRQ_CB ( void  )

This is a callback exported by the RF_API library. The RF_API module configures the S2-LP to raise interrupts and to notify them on a GPIO. When the interrupt of that GPIO is raised, this function must be called. It must be called when the S2-LP raises the IRQ via GPIO.


Parameters
[in]None.
Return values
None.

◆ ST_RF_API_set_freq_offset()

sfx_u8 ST_RF_API_set_freq_offset ( sfx_s32  offset)

Sets the RF frequency offset in Hertz (default is 0 Hz).


Parameters
[in]sfx_s32offset: frequency offset in Hz as an integer.
Note
If this function is not called, the default frequency offset is 0 Hz.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_set_lbt_thr_offset()

sfx_u8 ST_RF_API_set_lbt_thr_offset ( sfx_s8  lbt_thr_off)

Set an offset (dB) for tuning the LBT mechanism.


Parameters
[in]sfx_s8lbt_thr_off: an integer representing the offset in dB. Default value is 0.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_set_pa()

sfx_u8 ST_RF_API_set_pa ( sfx_u8  pa)

Instructs the library to configure the S2-LP for a external PA (Power Amplifier).


Parameters
[in]sfx_u8pa: 1 if a PA, 0 if not.
Note
If this function is not called, the default is not configure an external PA.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_set_rssi_offset()

sfx_u8 ST_RF_API_set_rssi_offset ( sfx_s8  rssi_off)

Set an RSSI offset for the RSSI.


Parameters
[in]sfx_s8rssi_off: an integer representing the offset in dB. Default value is 0.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_set_tcxo()

sfx_u8 ST_RF_API_set_tcxo ( sfx_u8  tcxo)

Instructs the library to configure the S2-LP for a TCXO or for a XTAL.


Parameters
[in]sfx_u8tcxo: 1 if a TCXO, 0 if XTAL.
Note
If this function is not called, the default is to use the S2-LP in XTAL mode.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_set_xtal_freq()

sfx_u8 ST_RF_API_set_xtal_freq ( sfx_u32  xtal)

Sets the XTAL frequency of the S2-LP in Hertz (default is 50MHz).


Parameters
[in]sfx_u32xtal: the xtal frequency of the S2-LP in Hz as an integer.
Note
If this function is not called, the default xtal frequency is 50MHz.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_smps()

sfx_u8 ST_RF_API_smps ( sfx_u8  mode)

Instructs the library to configure the S2-LP with a user defined smps frequency.


Parameters
[in]sfx_u8mode: from 1 (1.2V) to 7 (1.8V).
Note
If this function is not called, the default is to use the S2-LP at 1.5V.
Return values
0if no error, 1 otherwise.

◆ ST_RF_API_StartRx()

void ST_RF_API_StartRx ( void  )

This is a function to force S2LP to switch in RX mode.
It is called from Monarch detection algorithm.


Parameters
[in]None.
Return values
None.

◆ ST_RF_API_StartTx()

void ST_RF_API_StartTx ( void  )

This is a function to force S2LP to switch in TX mode.
It is called from Monarch detection algorithm.


Parameters
[in]None.
Return values
None.

◆ ST_RF_API_StopRxTx()

void ST_RF_API_StopRxTx ( void  )

This is a function to force S2LP to switch in Ready mode.
It is called from Monarch detection algorithm.


Parameters
[in]None.
Return values
None.

◆ ST_RF_API_Timer_Channel_Clear_CB()

void ST_RF_API_Timer_Channel_Clear_CB ( void  )

This is a callback exported by the RF_API library. It must be called when the timer started by MCU_API_timer_start_carrier_sense expires.


Parameters
[in]None.
Return values
None.