Appiko
S2LP_Timer_ex.c
Go to the documentation of this file.
1 
24 /* Includes ------------------------------------------------------------------*/
25 #include "S2LP_Timer.h"
26 #include "S2LP_Timer_ex.h"
27 #include "S2LP_Regs.h"
28 #include "MCU_Interface.h"
29 
30 
45 void S2LPTimerSetRxTimerMs(float fDesiredMsec)
46 {
47  S2LPTimerSetRxTimerUs((uint32_t)(fDesiredMsec*1000));
48 }
49 
50 void S2LPTimerGetRxTimer(float* pfTimeoutMsec, uint8_t* pcCounter , uint8_t* pcPrescaler)
51 {
52  uint32_t timeoutUsec;
53 
54  S2LPTimerGetRxTimerUs(&timeoutUsec, pcCounter , pcPrescaler);
55 
56  (*pfTimeoutMsec)=((float)timeoutUsec)/1000;
57 }
58 
59 void S2LPTimerSetWakeUpTimerMs(float fDesiredMsec)
60 {
61  S2LPTimerSetWakeUpTimerUs((uint32_t)(fDesiredMsec*1000));
62 }
63 
64 void S2LPTimerSetWakeUpTimerReloadMs(float fDesiredMsec)
65 {
66  S2LPTimerSetWakeUpTimerReloadUs((uint32_t)(fDesiredMsec*1000));
67 }
68 
69 void S2LPTimerGetWakeUpTimer(float* pfWakeUpMsec, uint8_t* pcCounter , uint8_t* pcPrescaler, uint8_t* pcMulti)
70 {
71  uint32_t timeoutUsec;
72 
73  S2LPTimerGetWakeUpTimerUs(&timeoutUsec, pcCounter , pcPrescaler, pcMulti);
74 
75  (*pfWakeUpMsec)=((float)timeoutUsec)/1000;
76 }
77 
78 void S2LPTimerGetWakeUpTimerReload(float* pfWakeUpReloadMsec, uint8_t* pcCounter, uint8_t* pcPrescaler, uint8_t* pcMulti)
79 {
80  uint32_t timeoutUsec;
81 
82  S2LPTimerGetWakeUpTimerReloadUs(&timeoutUsec, pcCounter , pcPrescaler, pcMulti);
83 
84  (*pfWakeUpReloadMsec)=((float)timeoutUsec)/1000;
85 }
86 
87 
88 
107 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
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,...
Definition: S2LP_Timer.c:598
Configuration and management of S2-LP Timers using floating point.
Configuration and management of S2-LP Timers.
void S2LPTimerSetWakeUpTimerReloadUs(uint32_t lDesiredUsec)
Set the LDCR wake up reload timer counter and prescaler from the desired value in ms,...
Definition: S2LP_Timer.c:546
This file contains all the registers address and masks.
void S2LPTimerGetRxTimerUs(uint32_t *plTimeoutUsec, uint8_t *pcCounter, uint8_t *pcPrescaler)
Return the RX timeout timer.
Definition: S2LP_Timer.c:405
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,...
Definition: S2LP_Timer.c:497
Header file for low level S2LP SPI driver.
void S2LPTimerSetWakeUpTimerUs(uint32_t lDesiredUsec)
Set the LDCR wake up timer counter and prescaler from the desired value in ms, according to the formu...
Definition: S2LP_Timer.c:444
void S2LPTimerSetRxTimerUs(uint32_t lDesiredUsec)
Set the RX timeout timer counter and prescaler from the desired value in ms. it is possible to fix th...
Definition: S2LP_Timer.c:362