From f571b507132cc77e401dee68535c2b9f3370c60c Mon Sep 17 00:00:00 2001 From: barthess Date: Wed, 27 Mar 2013 20:03:40 +0000 Subject: 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 --- os/hal/src/gpt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'os/hal/src') diff --git a/os/hal/src/gpt.c b/os/hal/src/gpt.c index 48db68174..9b7c0d9a6 100644 --- a/os/hal/src/gpt.c +++ b/os/hal/src/gpt.c @@ -116,6 +116,30 @@ void gptStop(GPTDriver *gptp) { chSysUnlock(); } +/** + * @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. + * + * @param[in] gptp pointer to a @p GPTDriver object + * @param[in] interval new cycle time in timer ticks + * + * @api + */ +void stm32_gptChangeInterval(GPTDriver *gptp, gptcnt_t interval) { + + chDbgCheck(gptp != NULL, "gptChangeInterval"); + + chSysLock(); + chDbgAssert(gptp->state == GPT_CONTINUOUS, + "gptChangeInterval(), #1", "invalid state"); + stm32_gptChangeIntervalI(gptp, interval); + chSysUnlock(); +} + /** * @brief Starts the timer in continuous mode. * -- cgit v1.2.3