diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c | 3 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/TIMv1/gpt_lld.h | 2 | ||||
-rw-r--r-- | os/hal/src/gpt.c | 1 |
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");
|