Virtual timers new functionality added.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8363 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2015-10-15 14:59:55 +00:00
parent 0c49958d77
commit 50c33f3fdb
2 changed files with 37 additions and 0 deletions

View File

@ -324,6 +324,41 @@ static inline bool chVTIsSystemTimeWithin(systime_t start, systime_t end) {
return chVTIsTimeWithinX(chVTGetSystemTime(), start, end); return chVTIsTimeWithinX(chVTGetSystemTime(), start, end);
} }
/**
* @brief Returns the time interval until the next timer event.
* @note The return value is not perfectly accurate and can report values
* in excess of @p CH_CFG_ST_TIMEDELTA ticks.
* @note The interval returned by this function is only meaningful if
* more timers are not added to the list until the returned time.
*
* @param[out] timep pointer to a variable that will contain the time
* interval until the next timer elapses. This pointer
* can be @p NULL if the information is not required.
* @return The time, in ticks, until next time event.
* @retval false if the timers list is empty.
* @retbal true if the timers list contains at least one timer.
*
* @iclass
*/
static inline bool chVTGetTimersStateI(systime_t *timep) {
chDbgCheckClassI();
if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next)
return false;
if (timep != NULL) {
#if CH_CFG_ST_TIMEDELTA == 0
*timep = ch.vtlist.vt_next->vt_delta;
#else
*timep = ch.vtlist.vt_lasttime + ch.vtlist.vt_next->vt_delta +
CH_CFG_ST_TIMEDELTA - chVTGetSystemTimeX();
#endif
}
return true;
}
/** /**
* @brief Returns @p true if the specified timer is armed. * @brief Returns @p true if the specified timer is armed.
* @pre The timer must have been initialized using @p chVTObjectInit() * @pre The timer must have been initialized using @p chVTObjectInit()

View File

@ -73,6 +73,8 @@
***************************************************************************** *****************************************************************************
*** 3.1.0 *** *** 3.1.0 ***
- RT: Added new function chVTGetTimersStateI() returning the state of the
timers list.
- HAL: Now STM32 USARTv2 driver initializes the ISR vectors statically on - HAL: Now STM32 USARTv2 driver initializes the ISR vectors statically on
initialization. Disabling them was not necessary and added to initialization. Disabling them was not necessary and added to
the code size. the code size.