aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-03-27 20:03:40 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-03-27 20:03:40 +0000
commitf571b507132cc77e401dee68535c2b9f3370c60c (patch)
tree396bb2d577e418fdf3424fd1974f28d40ef8c749 /os/hal/platforms/STM32
parentee1eb360863b0dc94fc4a19587d001747c5fb8d5 (diff)
downloadChibiOS-f571b507132cc77e401dee68535c2b9f3370c60c.tar.gz
ChibiOS-f571b507132cc77e401dee68535c2b9f3370c60c.tar.bz2
ChibiOS-f571b507132cc77e401dee68535c2b9f3370c60c.zip
STM32. GPT. Added abillity to change interval of running GPT unit on the fly.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5510 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r--os/hal/platforms/STM32/gpt_lld.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32/gpt_lld.h b/os/hal/platforms/STM32/gpt_lld.h
index 8a8ec4059..3421edbdd 100644
--- a/os/hal/platforms/STM32/gpt_lld.h
+++ b/os/hal/platforms/STM32/gpt_lld.h
@@ -267,6 +267,22 @@ struct GPTDriver {
/* Driver macros. */
/*===========================================================================*/
+/**
+ * @brief Changes the interval of GPT peripheral.
+ * @details This function changes the interval of a running GPT unit.
+ * @pre The GPT unit must have been activated using @p gptStart().
+ * @pre The GPT unit must have been running in continuous mode using
+ * @p gptStartContinuous().
+ * @post The GPT unit interval is changed to the new value.
+ * @note The function has effect at the next cycle start.
+ *
+ * @param[in] gptp pointer to a @p GPTDriver object
+ * @param[in] interval new cycle time in timer ticks
+ * @notapi
+ */
+#define gpt_lld_change_interval(gptp, interval) \
+ ((gptp)->tim->ARR = (uint16_t)((interval) - 1))
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/