aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-04-23 18:33:18 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-04-23 18:33:18 +0000
commit226d140bb9a39f17f4f5da6217b4d43017095682 (patch)
tree7cb88c755183576d3f0b36f73d089e8c00dec6e0 /os/hal/include
parent10a0e209745507d0e97b9d7e2e877f2fbc788e80 (diff)
downloadChibiOS-226d140bb9a39f17f4f5da6217b4d43017095682.tar.gz
ChibiOS-226d140bb9a39f17f4f5da6217b4d43017095682.tar.bz2
ChibiOS-226d140bb9a39f17f4f5da6217b4d43017095682.zip
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
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/hal.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h
index ff0c489a7..170c2bc03 100644
--- a/os/hal/include/hal.h
+++ b/os/hal/include/hal.h
@@ -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))
/** @} */
/**