aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-03-08 17:41:14 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-03-08 17:41:14 +0000
commit004c5bac0656683f315cf4baf57c2bb90e9453fb (patch)
treebb9af5fd72de61298dd9bfb68df2fac9749e58f4
parent6bc9f636b5488434375da0296a3d90285dc1cec4 (diff)
downloadChibiOS-004c5bac0656683f315cf4baf57c2bb90e9453fb.tar.gz
ChibiOS-004c5bac0656683f315cf4baf57c2bb90e9453fb.tar.bz2
ChibiOS-004c5bac0656683f315cf4baf57c2bb90e9453fb.zip
GPT is usable without callbacks now (trigger, counter).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6760 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c3
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h2
-rw-r--r--os/hal/src/gpt.c1
3 files changed, 5 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c
index 2852f383a..75c19f6b2 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c
+++ b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c
@@ -716,7 +716,8 @@ void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval) {
SR bit 0 goes to 1. This is because the clearing of CNT has been inserted
before the clearing of SR, to give it some time.*/
gptp->tim->SR = 0; /* Clear pending IRQs. */
- gptp->tim->DIER |= STM32_TIM_DIER_UIE; /* Update Event IRQ enabled.*/
+ if (NULL != gptp->config->callback)
+ gptp->tim->DIER |= STM32_TIM_DIER_UIE; /* Update Event IRQ enabled.*/
gptp->tim->CR1 = STM32_TIM_CR1_URS | STM32_TIM_CR1_CEN;
}
diff --git a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h
index 9f0b16980..7146a9c3c 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h
+++ b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h
@@ -383,6 +383,8 @@ typedef struct {
/**
* @brief Timer callback pointer.
* @note This callback is invoked on GPT counter events.
+ * @note This callback can be set to @p NULL but in that case the
+ * one-shot mode cannot be used.
*/
gptcallback_t callback;
/* End of the mandatory fields.*/
diff --git a/os/hal/src/gpt.c b/os/hal/src/gpt.c
index d654a3c4a..52bf6610f 100644
--- a/os/hal/src/gpt.c
+++ b/os/hal/src/gpt.c
@@ -198,6 +198,7 @@ void gptStartOneShotI(GPTDriver *gptp, gptcnt_t interval) {
osalDbgCheckClassI();
osalDbgCheck(gptp != NULL);
+ osalDbgCheck(gptp->config->callback != NULL);
osalDbgAssert(gptp->state == GPT_READY,
"invalid state");