Appiko
S2LP_Timer.c
Go to the documentation of this file.
1 
24 /* Includes ------------------------------------------------------------------*/
25 
26 #include "S2LP_Config.h"
27 #include "MCU_Interface.h"
28 
29 
57 #define LDC_FREQ_CLK S2LPTimerGetRcoFrequency()
58 
59 
70 #define IS_RX_TIMEOUT_STOP_CONDITION(COND) ( COND == NO_TIMEOUT_STOP || \
71  COND == TIMEOUT_ALWAYS_STOPPED || \
72  COND == RSSI_ABOVE_THRESHOLD || \
73  COND == SQI_ABOVE_THRESHOLD || \
74  COND == PQI_ABOVE_THRESHOLD || \
75  COND == RSSI_AND_SQI_ABOVE_THRESHOLD || \
76  COND == RSSI_AND_PQI_ABOVE_THRESHOLD || \
77  COND == SQI_AND_PQI_ABOVE_THRESHOLD || \
78  COND == ALL_ABOVE_THRESHOLD || \
79  COND == RSSI_OR_SQI_ABOVE_THRESHOLD || \
80  COND == RSSI_OR_PQI_ABOVE_THRESHOLD || \
81  COND == SQI_OR_PQI_ABOVE_THRESHOLD || \
82  COND == ANY_ABOVE_THRESHOLD )
83 
104 void S2LPTimerComputeWakeupTimerValues(uint32_t* plWakeUpUsec , uint8_t cCounter , uint8_t cPrescaler, uint8_t cMulti);
105 void S2LPTimerComputeRxTimerValues(uint32_t* plDesiredUsec, uint8_t pcCounter, uint8_t pcPrescaler);
106 void S2LPTimerComputeRxTimerRegValues(uint32_t plDesiredUsec , uint8_t* pcCounter , uint8_t* pcPrescaler);
107 void S2LPTimerComputeWakeupTimerRegValues(uint32_t plDesiredUsec , uint8_t* pcCounter , uint8_t* pcPrescaler, uint8_t* pcMulti);
108 
109 
128 void S2LPTimerComputeWakeupTimerValues(uint32_t* plWakeUpUsec , uint8_t cCounter , uint8_t cPrescaler, uint8_t cMulti)
129 {
130  (*plWakeUpUsec) = (uint32_t)((uint64_t)1000000*(cCounter+1)*(cPrescaler+1)/LDC_FREQ_CLK*cMulti);
131 }
132 
146 void S2LPTimerComputeWakeupTimerRegValues(uint32_t lDesiredUsec, uint8_t* pcCounter , uint8_t* pcPrescaler, uint8_t* pcMulti)
147 {
148  uint32_t n;
149  uint8_t i;
150 
151  for(i=0;i<4;i++)
152  {
153  if(lDesiredUsec<(((uint32_t)((uint64_t)1000000*65536/LDC_FREQ_CLK))<<i))
154  break;
155  }
156  (*pcMulti)=i;
157 
158 
159  /* N cycles in the time base of the timer:
160  - clock of the timer is RCO frequency
161  - divide times 1000000 more because we have an input in us
162  */
163  n = (uint32_t)((uint64_t)lDesiredUsec*(LDC_FREQ_CLK>>i)/1000000);
164 
165  /* check if it is possible to reach that target with prescaler and counter of S2LP */
166  if(n/0xFF>0xFD) {
167  /* if not return the maximum possible value */
168  (*pcCounter) = 0xFF;
169  (*pcPrescaler) = 0xFF;
170  return;
171  }
172 
173  /* prescaler is really 2 as min value */
174  (*pcPrescaler) = (n/0xFF)+2;
175  (*pcCounter) = n / (*pcPrescaler);
176 
177 // /* check if the error is minimum */
178 // err = S_ABS((float)((*pcCounter)*(*pcPrescaler)/rco_freq)-fDesiredMsec);
179 //
180 // if((*pcCounter)<=254) {
181 // if(S_ABS((float)((*pcCounter)+1)*(*pcPrescaler)/rco_freq-fDesiredMsec)<err)
182 // (*pcCounter) = (*pcCounter)+1;
183 // }
184 
185  /* decrement prescaler and counter according to the logic of this timer in S2LP */
186  (*pcPrescaler)--;
187  if((*pcCounter)>1)
188  (*pcCounter)--;
189  else
190  (*pcCounter)=1;
191 }
192 
206 void S2LPTimerComputeRxTimerRegValues(uint32_t lDesiredUsec , uint8_t* pcCounter , uint8_t* pcPrescaler)
207 {
208  uint32_t f_dig = S2LPRadioGetXtalFrequency();
209  uint32_t n;
210  uint64_t tgt,tgt1,tgt2;
211 
212  /* if xtal is doubled divide it by 2 */
213  if(f_dig>DIG_DOMAIN_XTAL_THRESH) {
214  f_dig >>= 1;
215  }
216 
217  /* N cycles in the time base of the timer:
218  - clock of the timer is f_dig/1210
219  - divide times 1000000 more because we have an input in us
220  */
221  tgt=(uint64_t)lDesiredUsec*f_dig;
222  n=(uint32_t)(tgt/1210000000);
223  tgt1=(uint64_t)1210000000*n;
224  tgt2=(uint64_t)1210000000*(n+1);
225 
226  n=((tgt2-tgt)<(tgt-tgt1))?(n+1):(n);
227 
228  /* check if it is possible to reach that target with prescaler and counter of S2LP */
229  if(n/0xFF>0xFD) {
230  /* if not return the maximum possible value */
231  (*pcCounter) = 0xFF;
232  (*pcPrescaler) = 0xFF;
233  return;
234  }
235 
236  /* prescaler is really 2 as min value */
237  (*pcPrescaler)=(n/0xFF)+2;
238  (*pcCounter) = n / (*pcPrescaler);
239 
240 
241  /* decrement prescaler and counter according to the logic of this timer in S2LP */
242  (*pcPrescaler)--;
243 
244  if((*pcCounter)==0)
245  (*pcCounter)=1;
246 }
247 
259 void S2LPTimerComputeRxTimerValues(uint32_t* pulDesiredUsec, uint8_t cCounter, uint8_t cPrescaler)
260 {
261  uint32_t f_dig = S2LPRadioGetXtalFrequency();
262 
263  /* if xtal is doubled divide it by 2 */
264  if(f_dig>DIG_DOMAIN_XTAL_THRESH) {
265  f_dig >>= 1;
266  }
267 
268  (*pulDesiredUsec) = (uint32_t)((uint64_t)1000000*(cPrescaler+1)*cCounter*1210/f_dig);
269 
270 }
271 
290 {
291  uint8_t tmp;
292  s_assert_param(IS_SFUNCTIONAL_STATE(xNewState));
293 
294  S2LPSpiReadRegisters(PROTOCOL1_ADDR, 1, &tmp);
295  if(xNewState==S_ENABLE) {
296  tmp |= LDC_MODE_REGMASK;
297  }
298  else {
299  tmp &= ~LDC_MODE_REGMASK;
300  }
301  g_xStatus = S2LPSpiWriteRegisters(PROTOCOL1_ADDR, 1, &tmp);
302 }
303 
304 
312 {
313  uint8_t tmp;
314  s_assert_param(IS_SFUNCTIONAL_STATE(xNewState));
315 
316  S2LPSpiReadRegisters(PROTOCOL1_ADDR, 1, &tmp);
317  if(xNewState==S_ENABLE) {
318  tmp |= LDC_RELOAD_ON_SYNC_REGMASK;
319  }
320  else {
321  tmp &= ~LDC_RELOAD_ON_SYNC_REGMASK;
322  }
323  g_xStatus = S2LPSpiWriteRegisters(PROTOCOL1_ADDR, 1, &tmp);
324 }
325 
326 
333 {
334  uint8_t tmp;
335  g_xStatus = S2LPSpiReadRegisters(PROTOCOL1_ADDR, 1, &tmp);
336  return (SFunctionalState)((tmp & LDC_RELOAD_ON_SYNC_REGMASK)!=0);
337 }
338 
348 void S2LPTimerSetRxTimer(uint8_t cCounter , uint8_t cPrescaler)
349 {
350  uint8_t tmpBuffer[2] = {cCounter, cPrescaler};
351  g_xStatus = S2LPSpiWriteRegisters(TIMERS5_ADDR, 2, tmpBuffer);
352 }
353 
354 
362 void S2LPTimerSetRxTimerUs(uint32_t lDesiredUsec)
363 {
364  uint8_t tmpBuffer[2];
365  S2LPTimerComputeRxTimerRegValues(lDesiredUsec , &tmpBuffer[0] , &tmpBuffer[1]);
366  g_xStatus = S2LPSpiWriteRegisters(TIMERS5_ADDR, 2, tmpBuffer);
367 }
368 
369 
376 void S2LPTimerSetRxTimerCounter(uint8_t cCounter)
377 {
378  g_xStatus = S2LPSpiWriteRegisters(TIMERS5_ADDR, 1, &cCounter);
379 }
380 
381 
388 void S2LPTimerSetRxTimerPrescaler(uint8_t cPrescaler)
389 {
390  g_xStatus = S2LPSpiWriteRegisters(TIMERS4_ADDR, 1, &cPrescaler);
391 }
392 
393 
405 void S2LPTimerGetRxTimerUs(uint32_t* plTimeoutUsec, uint8_t* pcCounter , uint8_t* pcPrescaler)
406 {
407  uint8_t tmpBuffer[2];
408 
409  g_xStatus = S2LPSpiReadRegisters(TIMERS5_ADDR, 2, tmpBuffer);
410 
411  (*pcCounter) = tmpBuffer[0];
412  (*pcPrescaler) = tmpBuffer[1];
413  S2LPTimerComputeRxTimerValues(plTimeoutUsec, tmpBuffer[0], tmpBuffer[1]);
414 }
415 
428 void S2LPTimerSetWakeUpTimer(uint8_t cCounter , uint8_t cPrescaler)
429 {
430  uint8_t tmpBuffer[2] = {cPrescaler, cCounter};
431  g_xStatus = S2LPSpiWriteRegisters(TIMERS3_ADDR, 2, tmpBuffer);
432 }
433 
434 
444 void S2LPTimerSetWakeUpTimerUs(uint32_t lDesiredUsec)
445 {
446  uint8_t tmpBuffer[2], multi, tmp;
447 
448  /* Computes counter and prescaler */
449  S2LPTimerComputeWakeupTimerRegValues(lDesiredUsec , &tmpBuffer[1] , &tmpBuffer[0], &multi);
450 
451  S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);
452  tmp &= ~LDC_TIMER_MULT_REGMASK;
453  tmp |= multi;
454  S2LPSpiWriteRegisters(PROTOCOL2_ADDR, 1, &tmp);
455 
456  g_xStatus = S2LPSpiWriteRegisters(TIMERS3_ADDR, 2, tmpBuffer);
457 
458 }
459 
460 
468 void S2LPTimerSetWakeUpTimerCounter(uint8_t cCounter)
469 {
470  g_xStatus = S2LPSpiWriteRegisters(TIMERS2_ADDR, 1, &cCounter);
471 }
472 
473 
481 void S2LPTimerSetWakeUpTimerPrescaler(uint8_t cPrescaler)
482 {
483  g_xStatus = S2LPSpiWriteRegisters(TIMERS3_ADDR, 1, &cPrescaler);
484 }
485 
486 
497 void S2LPTimerGetWakeUpTimerUs(uint32_t* plWakeUpUsec, uint8_t* pcCounter, uint8_t* pcPrescaler, uint8_t* pcMulti)
498 {
499  uint8_t tmpBuffer[2], tmp;
500 
501  S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);
502  tmp &= LDC_TIMER_MULT_REGMASK;
503  *pcMulti = tmp;
504 
505  g_xStatus = S2LPSpiReadRegisters(TIMERS3_ADDR, 2, tmpBuffer);
506  *pcCounter = tmpBuffer[1];
507  *pcPrescaler = tmpBuffer[0];
508 
509  S2LPTimerComputeWakeupTimerValues(plWakeUpUsec, tmpBuffer[0], tmpBuffer[1], tmp);
510 }
511 
512 
525 void S2LPTimerSetWakeUpTimerReload(uint8_t cCounter , uint8_t cPrescaler, uint8_t cMulti)
526 {
527  uint8_t tmpBuffer[2] = {cPrescaler, cCounter}, tmp;
528 
529  S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);
530  tmp &= (~LDC_TIMER_MULT_REGMASK);
531  tmp |= cMulti;
532  S2LPSpiWriteRegisters(PROTOCOL2_ADDR, 1, &tmp);
533 
534  g_xStatus = S2LPSpiWriteRegisters(TIMERS1_ADDR, 2, tmpBuffer);
535 }
536 
537 
546 void S2LPTimerSetWakeUpTimerReloadUs(uint32_t lDesiredUsec)
547 {
548  uint8_t tmpBuffer[2], multi, tmp;
549 
550  /* Computes counter and prescaler */
551  S2LPTimerComputeWakeupTimerRegValues(lDesiredUsec , &tmpBuffer[1] , &tmpBuffer[0], &multi);
552 
553  S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);
554  tmp &= ~LDC_TIMER_MULT_REGMASK;
555  tmp |= multi;
556  S2LPSpiWriteRegisters(PROTOCOL2_ADDR, 1, &tmp);
557 
558  g_xStatus = S2LPSpiWriteRegisters(TIMERS1_ADDR, 2, tmpBuffer);
559 }
560 
561 
570 {
571  g_xStatus = S2LPSpiWriteRegisters(TIMERS0_ADDR, 1, &cCounter);
572 }
573 
574 
583 {
584  g_xStatus = S2LPSpiWriteRegisters(TIMERS1_ADDR, 1, &cPrescaler);
585 }
586 
587 
598 void S2LPTimerGetWakeUpTimerReloadUs(uint32_t* plWakeUpReloadUsec, uint8_t* pcCounter, uint8_t* pcPrescaler, uint8_t* pcMulti)
599 {
600  uint8_t tmpBuffer[2], tmp;
601 
602  S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);
603  tmp &= LDC_TIMER_MULT_REGMASK;
604  *pcMulti = tmp;
605 
606  g_xStatus = S2LPSpiReadRegisters(TIMERS3_ADDR, 2, tmpBuffer);
607  *pcCounter = tmpBuffer[1];
608  *pcPrescaler = tmpBuffer[0];
609 
610  S2LPTimerComputeWakeupTimerValues(plWakeUpReloadUsec, tmpBuffer[1], tmpBuffer[0], tmp);
611 }
612 
613 
621 {
622  uint8_t tmp;
623  s_assert_param(IS_RX_TIMEOUT_STOP_CONDITION(xStopCondition));
624 
625  S2LPSpiReadRegisters(PROTOCOL2_ADDR, 1, &tmp);
626  tmp &= ~(CS_TIMEOUT_MASK_REGMASK | SQI_TIMEOUT_MASK_REGMASK | PQI_TIMEOUT_MASK_REGMASK);
627  tmp |= (((uint8_t)xStopCondition) << 5);
628  S2LPSpiWriteRegisters(PROTOCOL2_ADDR, 1, &tmp);
629 
630  S2LPSpiReadRegisters(PCKT_FLT_OPTIONS_ADDR, 1, &tmp);
631  tmp &= ~RX_TIMEOUT_AND_OR_SEL_REGMASK;
632  tmp |= (((uint8_t)xStopCondition) >> 1);
633  g_xStatus = S2LPSpiWriteRegisters(PCKT_FLT_OPTIONS_ADDR, 1, &tmp);
634 }
635 
636 
643 {
644  uint32_t xtal=S2LPRadioGetXtalFrequency();
645 
646  switch(xtal)
647  {
648  case 24000000:
649  case 48000000:
650  return 32000;
651  case 25000000:
652  case 50000000:
653  return 33300;
654  }
655  return 34700;
656 }
657 
658 
665 {
666  uint8_t tmp;
667  s_assert_param(IS_SFUNCTIONAL_STATE(xNewState));
668 
669  S2LPSpiReadRegisters(PROTOCOL1_ADDR, 1, &tmp);
670  if(xNewState == S_ENABLE) {
671  tmp |= FAST_CS_TERM_EN_REGMASK;
672  }
673  else {
674  tmp &= ~FAST_CS_TERM_EN_REGMASK;
675  }
676  g_xStatus = S2LPSpiWriteRegisters(PROTOCOL1_ADDR, 1, &tmp);
677 }
678 
679 
687 void S2LpSetTimerFastRxTermTimer(uint8_t fast_rx_word)
688 {
689  g_xStatus = S2LPSpiWriteRegisters(FAST_RX_TIMER_ADDR, 1, &fast_rx_word);
690 }
691 
692 
700 void S2LpSetTimerFastRxTermTimerUs(uint32_t fast_rx_us)
701 {
702  uint8_t tmp,fast_rx_word;
703 
704  S2LPSpiReadRegisters(CHFLT_ADDR, 1, &tmp);
705 
706  uint32_t f_dig=S2LPRadioGetXtalFrequency();
707  if(f_dig > DIG_DOMAIN_XTAL_THRESH) {
708  f_dig = f_dig/2;
709  }
710 
711  s_assert_param(fast_rx_us<(1000000*0xff)/(f_dig/24/(1<<(tmp&0x0F))));
712 
713 
714  fast_rx_word=((f_dig/24/(1<<(tmp&0x0F)))*fast_rx_us)/1000000;
715  g_xStatus = S2LPSpiWriteRegisters(FAST_RX_TIMER_ADDR, 1, &fast_rx_word);
716 }
717 
718 
727 {
728  uint8_t tmp;
729 
730  s_assert_param(IS_SFUNCTIONAL_STATE(xCalibration));
731 
732  S2LPSpiReadRegisters(XO_RCO_CONF0_ADDR, 1, &tmp);
733 
734  if(xCalibration == S_ENABLE) {
735  tmp |= RCO_CALIBRATION_REGMASK;
736  } else {
737  tmp &= ~RCO_CALIBRATION_REGMASK;
738  }
739  g_xStatus = S2LPSpiWriteRegisters(XO_RCO_CONF0_ADDR, 1, &tmp);
740 }
741 
750 {
751  uint8_t tmp;
752 
753  s_assert_param(IS_SFUNCTIONAL_STATE(en));
754 
755  S2LPSpiReadRegisters(PM_CONF0_ADDR, 1, &tmp);
756 
757  if(en == S_ENABLE) {
758  tmp |= SLEEP_MODE_SEL_REGMASK;
759  } else {
760  tmp &= ~SLEEP_MODE_SEL_REGMASK;
761  }
762  g_xStatus = S2LPSpiWriteRegisters(PM_CONF0_ADDR, 1, &tmp);
763 }
764 
765 void S2LPTimerLdcIrqWa(SFunctionalState en)
766 {
767  uint8_t tmp[2]={0x00,0x60};
768 
769  if(en)
770  {
771  tmp[0]=0x01; tmp[1]=0x64;
772 
773  do
774  {
776  }
777  while(g_xStatus.MC_STATE!=0x7C);
778  }
779 
780  g_xStatus = S2LPSpiWriteRegisters(0x7B, 1, &tmp[1]);
781  g_xStatus = S2LPSpiWriteRegisters(0x7A, 1, &tmp[0]);
782 }
783 
784 
801 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
uint16_t S2LPTimerGetRcoFrequency(void)
Computes and Return the RCO frequency. This frequency depends on the xtal frequency and the XTAL bit ...
Definition: S2LP_Timer.c:642
void S2LPTimerSetRxTimer(uint8_t cCounter, uint8_t cPrescaler)
Set the RX timeout timer initialization registers with the values of COUNTER and PRESCALER according ...
Definition: S2LP_Timer.c:348
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 ...
Definition: S2LP_Timer.c:525
void S2LPTimerComputeRxTimerRegValues(uint32_t plDesiredUsec, uint8_t *pcCounter, uint8_t *pcPrescaler)
Computes the values of the rx_timeout timer counter and prescaler from the user time expressed in mil...
Definition: S2LP_Timer.c:206
SFunctionalState S2LPTimerLdcrGetAutoReload(void)
Return the LDCR timer reload bit.
Definition: S2LP_Timer.c:332
S2LPState MC_STATE
Definition: S2LP_Types.h:119
#define PROTOCOL2_ADDR
PROTOCOL2 register.
Definition: S2LP_Regs.h:660
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 freq...
Definition: S2LP_Timer.c:700
void S2LpTimerFastRxTermTimer(SFunctionalState xNewState)
Enables the Fast RX termination timer.
Definition: S2LP_Timer.c:664
SFunctionalState
S2LP Functional state. Used to enable or disable a specific option.
Definition: S2LP_Types.h:67
uint32_t S2LPRadioGetXtalFrequency(void)
Return the XTAL frequency.
Definition: S2LP_Radio.c:1173
void S2LPTimerSetRxTimerStopCondition(RxTimeoutStopCondition xStopCondition)
Set the RX timeout stop conditions.
Definition: S2LP_Timer.c:620
#define PROTOCOL1_ADDR
PROTOCOL1 register.
Definition: S2LP_Regs.h:685
void S2LPTimerSleepB(SFunctionalState en)
Enable the SLEEP_B mode. SLEEP_A and SLEEP_B are mutually exclusive.
Definition: S2LP_Timer.c:749
void S2LPTimerGetRxTimerUs(uint32_t *plTimeoutUsec, uint8_t *pcCounter, uint8_t *pcPrescaler)
Return the RX timeout timer.
Definition: S2LP_Timer.c:405
void S2LPTimerLdcrMode(SFunctionalState xNewState)
Enables or Disables the LDCR mode.
Definition: S2LP_Timer.c:289
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
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 S2LPTimerLdcrAutoReload(SFunctionalState xNewState)
Enables or Disables the LDCR timer reloading with the value stored in the LDCR_RELOAD registers.
Definition: S2LP_Timer.c:311
#define TIMERS4_ADDR
TIMERS4 register.
Definition: S2LP_Regs.h:884
void S2LPTimerSetRxTimerPrescaler(uint8_t cPrescaler)
Set the RX timeout timer prescaler. If it is equal to 0 the timeout is infinite.
Definition: S2LP_Timer.c:388
#define DIG_DOMAIN_XTAL_THRESH
Definition: S2LP_Config.h:86
void S2LPTimerSetWakeUpTimerPrescaler(uint8_t cPrescaler)
Set the LDCR wake up timer prescaler. Remember that this value is incresead by one in the Twu calcula...
Definition: S2LP_Timer.c:481
#define TIMERS3_ADDR
TIMERS3 register.
Definition: S2LP_Regs.h:897
#define TIMERS5_ADDR
TIMERS5 register.
Definition: S2LP_Regs.h:871
#define FAST_RX_TIMER_ADDR
FAST_RX_TIMER register.
Definition: S2LP_Regs.h:1059
void S2LPTimerComputeRxTimerValues(uint32_t *plDesiredUsec, uint8_t pcCounter, uint8_t pcPrescaler)
Computes the values of the rx_timeout given the timer counter and prescaler.
Definition: S2LP_Timer.c:259
#define TIMERS1_ADDR
TIMERS1 register.
Definition: S2LP_Regs.h:923
void S2LPRefreshStatus(void)
Updates the gState (the global variable used to maintain memory of S2LP Status) reading the MC_STATE ...
Definition: S2LP_Types.c:133
void S2LPTimerSetWakeUpTimerCounter(uint8_t cCounter)
Set the LDCR wake up timer counter. Remember that this value is incresead by one in the Twu calculati...
Definition: S2LP_Timer.c:468
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
void S2LPTimerComputeWakeupTimerValues(uint32_t *plWakeUpUsec, uint8_t cCounter, uint8_t cPrescaler, uint8_t cMulti)
Computes the wake up timer.
Definition: S2LP_Timer.c:128
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
RxTimeoutStopCondition
All the possible RX timeout stop conditions enumeration.
Definition: S2LP_Timer.h:83
#define PM_CONF0_ADDR
PM_CONF0 register.
Definition: S2LP_Regs.h:1447
S2LP Configuration and useful defines .
void S2LPTimerSetWakeUpTimer(uint8_t cCounter, uint8_t cPrescaler)
Set the LDCR wake up timer initialization registers with the values of COUNTER and PRESCALER accordin...
Definition: S2LP_Timer.c:428
void S2LPTimerSetWakeUpTimerReloadCounter(uint8_t cCounter)
Set the LDCR wake up timer reload counter. Remember that this value is incresead by one in the Twu ca...
Definition: S2LP_Timer.c:569
#define CHFLT_ADDR
CHFLT register.
Definition: S2LP_Regs.h:293
void S2LPTimerSetRxTimerCounter(uint8_t cCounter)
Set the RX timeout timer counter. If it is equal to 0 the timeout is infinite.
Definition: S2LP_Timer.c:376
volatile S2LPStatus g_xStatus
S2LP Status global variable. This global variable of S2LPStatus type is updated on every SPI transact...
Definition: S2LP_Types.c:82
#define TIMERS2_ADDR
TIMERS2 register.
Definition: S2LP_Regs.h:910
void S2LPTimerComputeWakeupTimerRegValues(uint32_t plDesiredUsec, uint8_t *pcCounter, uint8_t *pcPrescaler, uint8_t *pcMulti)
Computes the values of the wakeup timer counter and prescaler from the user time expressed in millise...
Definition: S2LP_Timer.c:146
#define PCKT_FLT_OPTIONS_ADDR
PCKT_FLT_OPTIONS register.
Definition: S2LP_Regs.h:788
void S2LpSetTimerFastRxTermTimer(uint8_t fast_rx_word)
Set the Fast RX termination timer word. When the timer counter will reach this word,...
Definition: S2LP_Timer.c:687
#define XO_RCO_CONF0_ADDR
XO_RCO_CONF0 register.
Definition: S2LP_Regs.h:1325
Header file for low level S2LP SPI driver.
#define TIMERS0_ADDR
TIMERS0 register.
Definition: S2LP_Regs.h:936
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
void S2LPTimerCalibrationRco(SFunctionalState xCalibration)
Enables the RCO autocalibration when the device make the transition READY -> SLEEP.
Definition: S2LP_Timer.c:726
void S2LPTimerSetWakeUpTimerReloadPrescaler(uint8_t cPrescaler)
Set the LDCR wake up timer reload prescaler. Remember that this value is incresead by one in the Twu ...
Definition: S2LP_Timer.c:582