mirror of https://github.com/ARMmbed/mbed-os.git
expose WsfTimerNextExpiration in the wsf api
parent
313651bb2e
commit
59528d6a18
|
|
@ -112,6 +112,19 @@ void WsfTimerStop(wsfTimer_t *pTimer);
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
void WsfTimerUpdate(wsfTimerTicks_t ticks);
|
void WsfTimerUpdate(wsfTimerTicks_t ticks);
|
||||||
|
|
||||||
|
/*************************************************************************************************/
|
||||||
|
/*!
|
||||||
|
* \brief Return the number of ticks until the next timer expiration. Note that this
|
||||||
|
* function can return zero even if a timer is running, indicating the timer
|
||||||
|
* has expired but has not yet been serviced.
|
||||||
|
*
|
||||||
|
* \param pTimerRunning Returns TRUE if a timer is running, FALSE if no timers running.
|
||||||
|
*
|
||||||
|
* \return The number of ticks until the next timer expiration.
|
||||||
|
*/
|
||||||
|
/*************************************************************************************************/
|
||||||
|
wsfTimerTicks_t WsfTimerNextExpiration(bool_t *pTimerRunning);
|
||||||
|
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
* \brief Service expired timers for the given task. This function is typically called only
|
* \brief Service expired timers for the given task. This function is typically called only
|
||||||
|
|
|
||||||
|
|
@ -201,10 +201,12 @@ static uint32_t wsfTimerTicksToRtc(wsfTimerTicks_t wsfTicks)
|
||||||
* function can return zero even if a timer is running, indicating a timer
|
* function can return zero even if a timer is running, indicating a timer
|
||||||
* has expired but has not yet been serviced.
|
* has expired but has not yet been serviced.
|
||||||
*
|
*
|
||||||
|
* \param pTimerRunning Returns TRUE if a timer is running, FALSE if no timers running.
|
||||||
|
*
|
||||||
* \return The number of ticks until the next timer expiration.
|
* \return The number of ticks until the next timer expiration.
|
||||||
*/
|
*/
|
||||||
/*************************************************************************************************/
|
/*************************************************************************************************/
|
||||||
static wsfTimerTicks_t wsfTimerNextExpiration(void)
|
wsfTimerTicks_t WsfTimerNextExpiration(bool_t *pTimerRunning)
|
||||||
{
|
{
|
||||||
wsfTimerTicks_t ticks;
|
wsfTimerTicks_t ticks;
|
||||||
|
|
||||||
|
|
@ -213,10 +215,12 @@ static wsfTimerTicks_t wsfTimerNextExpiration(void)
|
||||||
|
|
||||||
if (wsfTimerTimerQueue.pHead == NULL)
|
if (wsfTimerTimerQueue.pHead == NULL)
|
||||||
{
|
{
|
||||||
|
*pTimerRunning = FALSE;
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*pTimerRunning = TRUE;
|
||||||
ticks = ((wsfTimer_t *) wsfTimerTimerQueue.pHead)->ticks;
|
ticks = ((wsfTimer_t *) wsfTimerTimerQueue.pHead)->ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,9 +395,10 @@ void WsfTimerSleep(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextExpiration = wsfTimerNextExpiration();
|
bool_t running;
|
||||||
|
nextExpiration = WsfTimerNextExpiration(&running);
|
||||||
|
|
||||||
if (nextExpiration > 0)
|
if (running)
|
||||||
{
|
{
|
||||||
uint32_t awake = wsfTimerTicksToRtc(nextExpiration);
|
uint32_t awake = wsfTimerTicksToRtc(nextExpiration);
|
||||||
uint32_t rtcCurrentTicks = PalRtcCounterGet();
|
uint32_t rtcCurrentTicks = PalRtcCounterGet();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue