Appiko
Enumerations | Functions
S2LP_Timer.h File Reference

Configuration and management of S2-LP Timers. More...

#include "S2LP_Regs.h"
#include "S2LP_Types.h"

Go to the source code of this file.

Enumerations

enum  RxTimeoutStopCondition {
  NO_TIMEOUT_STOP = 0x00, PQI_ABOVE_THRESHOLD = 0x01, SQI_ABOVE_THRESHOLD = 0x02, SQI_AND_PQI_ABOVE_THRESHOLD = 0x03,
  RSSI_ABOVE_THRESHOLD = 0x04, RSSI_AND_PQI_ABOVE_THRESHOLD = 0x05, RSSI_AND_SQI_ABOVE_THRESHOLD = 0x06, ALL_ABOVE_THRESHOLD = 0x07,
  TIMEOUT_ALWAYS_STOPPED = 0x08, SQI_OR_PQI_ABOVE_THRESHOLD = 0x0B, RSSI_OR_PQI_ABOVE_THRESHOLD = 0x0D, RSSI_OR_SQI_ABOVE_THRESHOLD = 0x0E,
  ANY_ABOVE_THRESHOLD = 0x0F
}
 All the possible RX timeout stop conditions enumeration. More...
 

Functions

void S2LPTimerSetRxTimerStopCondition (RxTimeoutStopCondition xStopCondition)
 Set the RX timeout stop conditions. More...
 
void S2LPTimerLdcrMode (SFunctionalState xNewState)
 Enables or Disables the LDCR mode. More...
 
void S2LPTimerLdcrAutoReload (SFunctionalState xNewState)
 Enables or Disables the LDCR timer reloading with the value stored in the LDCR_RELOAD registers. More...
 
SFunctionalState S2LPTimerLdcrGetAutoReload (void)
 Return the LDCR timer reload bit. More...
 
void S2LpTimerFastRxTermTimer (SFunctionalState xNewState)
 Enables the Fast RX termination timer. More...
 
void S2LpSetTimerFastRxTermTimer (uint8_t fast_rx_word)
 Set the Fast RX termination timer word. When the timer counter will reach this word, the timer expires. The timer counter is clocked at frequency: fCLK/24/2^CHFLT_E. More...
 
void S2LpSetTimerFastRxTermTimerUs (uint32_t fast_rx_us)
 Set the Fast RX termination timer word starting from a us value. The timer counter is clocked at frequency: fCLK/24/2^CHFLT_E. More...
 
void S2LPTimerSetRxTimer (uint8_t cCounter, uint8_t cPrescaler)
 Set the RX timeout timer initialization registers with the values of COUNTER and PRESCALER according to the formula: Trx=PRESCALER*COUNTER*Tck. Remember that it is possible to have infinite RX_Timeout writing 0 in the RX_Timeout_Counter and/or RX_Timeout_Prescaler registers. More...
 
void S2LPTimerSetRxTimerUs (uint32_t lDesiredUsec)
 Set the RX timeout timer counter and prescaler from the desired value in ms. it is possible to fix the RX_Timeout to a minimum value of 50.417us to a maximum value of about 3.28 s. More...
 
void S2LPTimerSetRxTimerCounter (uint8_t cCounter)
 Set the RX timeout timer counter. If it is equal to 0 the timeout is infinite. More...
 
void S2LPTimerSetRxTimerPrescaler (uint8_t cPrescaler)
 Set the RX timeout timer prescaler. If it is equal to 0 the timeout is infinite. More...
 
void S2LPTimerGetRxTimerUs (uint32_t *plTimeoutUsec, uint8_t *pcCounter, uint8_t *pcPrescaler)
 Return the RX timeout timer. More...
 
void S2LPTimerSetWakeUpTimer (uint8_t cCounter, uint8_t cPrescaler)
 Set the LDCR wake up timer initialization registers with the values of COUNTER and PRESCALER according to the formula: Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. The minimum vale of the wakeup timeout is 28.818us (PRESCALER and COUNTER equals to 0) and the maximum value is about 1.89 s (PRESCALER anc COUNTER equals to 255). More...
 
void S2LPTimerSetWakeUpTimerUs (uint32_t lDesiredUsec)
 Set the LDCR wake up timer counter and prescaler from the desired value in ms, according to the formula: Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. The minimum vale of the wakeup timeout is 28.818us (PRESCALER and COUNTER equals to 0) and the maximum value is about 1.89 s (PRESCALER anc COUNTER equals to 255). More...
 
void S2LPTimerSetWakeUpTimerCounter (uint8_t cCounter)
 Set the LDCR wake up timer counter. Remember that this value is incresead by one in the Twu calculation. Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. More...
 
void S2LPTimerSetWakeUpTimerPrescaler (uint8_t cPrescaler)
 Set the LDCR wake up timer prescaler. Remember that this value is incresead by one in the Twu calculation. Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. More...
 
void S2LPTimerSetWakeUpTimerReloadUs (uint32_t lDesiredUsec)
 Set the LDCR wake up reload timer counter and prescaler from the desired value in ms, according to the formula: Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. The minimum vale of the wakeup timeout is 28.818us (PRESCALER and COUNTER equals to 0) and the maximum value is about 1.89 s (PRESCALER anc COUNTER equals to 255). More...
 
void S2LPTimerGetWakeUpTimerUs (uint32_t *plWakeUpUsec, uint8_t *pcCounter, uint8_t *pcPrescaler, uint8_t *pcMulti)
 Return the LDCR wake up timer, according to the formula: Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. More...
 
void S2LPTimerSetWakeUpTimerReload (uint8_t cCounter, uint8_t cPrescaler, uint8_t cMulti)
 Set the LDCR wake up timer reloading registers with the values of COUNTER and PRESCALER according to the formula: Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. The minimum vale of the wakeup timeout is 28.818us (PRESCALER and COUNTER equals to 0) and the maximum value is about 1.89 s (PRESCALER anc COUNTER equals to 255). More...
 
void S2LPTimerSetWakeUpTimerReloadCounter (uint8_t cCounter)
 Set the LDCR wake up timer reload counter. Remember that this value is incresead by one in the Twu calculation. Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. More...
 
void S2LPTimerSetWakeUpTimerReloadPrescaler (uint8_t cPrescaler)
 Set the LDCR wake up timer reload prescaler. Remember that this value is incresead by one in the Twu calculation. Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. More...
 
void S2LPTimerGetWakeUpTimerReloadUs (uint32_t *plWakeUpReloadUsec, uint8_t *pcCounter, uint8_t *pcPrescaler, uint8_t *pcMulti)
 Return the LDCR wake up reload timer, according to the formula: Twu=(PRESCALER +1)*(COUNTER+1)*Tck, where Tck = 28.818 us. More...
 
uint16_t S2LPTimerGetRcoFrequency (void)
 Computes and Return the RCO frequency. This frequency depends on the xtal frequency and the XTAL bit in register 0x01. More...
 
void S2LPTimerCalibrationRco (SFunctionalState xCalibration)
 Enables the RCO autocalibration when the device make the transition READY -> SLEEP. More...
 
void S2LPTimerSleepB (SFunctionalState en)
 Enable the SLEEP_B mode. SLEEP_A and SLEEP_B are mutually exclusive. More...
 

Detailed Description

Author
LowPower RF BU - AMG
Version
1.2.1
Date
16-April-2018

This module provides API to configure the S2-LP timing mechanisms. They allow the user to set the timer registers using raw values or compute them since the desired timer value is expressed in ms. Moreover the management of the S2-LP LDCR mode can be done using these API.

Example:

...
S2LPTimerSetRxTimeoutMs(50.0);
// IRQ configuration for RX_TIMEOUT and WAKEUP_TIMEOUT
...
S2LPTimerLdcrMode(S_ENABLE);
...

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

THIS SOURCE CODE IS PROTECTED BY A LICENSE. FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.

© COPYRIGHT 2016 STMicroelectronics

Definition in file S2LP_Timer.h.