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
master
gdisirio 2014-03-08 17:41:14 +00:00
parent 6bc9f636b5
commit 004c5bac06
3 changed files with 5 additions and 1 deletions

View File

@ -716,6 +716,7 @@ 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. */
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;
}

View File

@ -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.*/

View File

@ -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");