Added converters from realtime ticks to time values.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4130 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
barthess 2012-04-23 18:33:18 +00:00
parent 10a0e20974
commit 226d140bb9
1 changed files with 33 additions and 0 deletions

View File

@ -114,6 +114,39 @@
*/
#define US2RTT(usec) (((halGetCounterFrequency() + 999999UL) / 1000000UL) * \
(usec))
/**
* @brief Realtime ticks to seconds to.
* @details Converts from realtime ticks number to seconds.
*
* @param[in] ticks number of ticks
* @return The number of seconds.
*
* @api
*/
#define RTT2S(ticks) ((ticks) / halGetCounterFrequency())
/**
* @brief Realtime ticks to milliseconds.
* @details Converts from realtime ticks number to milliseconds.
*
* @param[in] ticks number of ticks
* @return The number of milliseconds.
*
* @api
*/
#define RTT2MS(ticks) ((ticks) / (halGetCounterFrequency() / 1000UL))
/**
* @brief Realtime ticks to microseconds.
* @details Converts from realtime ticks number to microseconds.
*
* @param[in] ticks number of ticks
* @return The number of microseconds.
*
* @api
*/
#define RTT2US(ticks) ((ticks) / (halGetCounterFrequency() / 1000000UL))
/** @} */
/**