Tick OS to Tick LSE Conversion
Hi
This is a general question regarding entering sleep, so whatever part you know and can explain will benefit greatly.
The questions are much around the function LpTimerStart, which in general converts OS ticks to LSE clock ticks.
The number 1e12 ( or 1,000,000,000,000) is used commonly, why is that specific number chosen?
What is "ps" as referred to in CFG_TS_TICK_VAL_PS, time_ps ?
Can you explain the formula :
#define CFG_TS_TICK_VAL_PS DIVR( ((uint64_t)CFG_RTCCLK_DIV * 1e12), (uint64_t)LSE_VALUE )
#define CFG_TS_TICK_VAL_PS DIVR( ((uint64_t)CFG_RTCCLK_DIV * 1e12), (uint64_t)LSE_VALUE )
And this: ( this one is from LpGetElapsedTime)
time_ps = (uint64_t)((CFG_TS_TICK_VAL_PS) * (uint64_t)(LpTimerContext.LpTimeLeftOnEntry - LpTimeLeftOnExit));
time_ps = (uint64_t)((CFG_TS_TICK_VAL_PS) * (uint64_t)(LpTimerContext.LpTimeLeftOnEntry - LpTimeLeftOnExit));
Thanks
