From 4f98c8cf4c05dd2f7dc6e5e9e135d012f6aa0ab5 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 2 Feb 2018 10:15:24 +0000 Subject: Fixed bug #914. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11422 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c | 16 ++++++++-------- os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'os/hal/ports/STM32/LLD') diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c b/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c index 5d670d14f..3dda5fbea 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c +++ b/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c @@ -677,10 +677,10 @@ void gpt_lld_start(GPTDriver *gptp) { "invalid frequency"); /* Timer configuration.*/ - gptp->tim->CR1 = 0; /* Initially stopped. */ - gptp->tim->CR2 = gptp->config->cr2; - gptp->tim->PSC = psc; /* Prescaler value. */ - gptp->tim->SR = 0; /* Clear pending IRQs. */ + gptp->tim->CR1 = 0; /* Initially stopped. */ + gptp->tim->CR2 = gptp->config->cr2; + gptp->tim->PSC = psc; /* Prescaler value. */ + gptp->tim->SR = 0; /* Clear pending IRQs. */ gptp->tim->DIER = gptp->config->dier & /* DMA-related DIER bits. */ ~STM32_TIM_DIER_IRQ_MASK; } @@ -695,9 +695,9 @@ void gpt_lld_start(GPTDriver *gptp) { void gpt_lld_stop(GPTDriver *gptp) { if (gptp->state == GPT_READY) { - gptp->tim->CR1 = 0; /* Timer disabled. */ + gptp->tim->CR1 = 0; /* Timer disabled. */ gptp->tim->DIER = 0; /* All IRQs disabled. */ - gptp->tim->SR = 0; /* Clear pending IRQs. */ + gptp->tim->SR = 0; /* Clear pending IRQs. */ #if STM32_GPT_USE_TIM1 if (&GPTD1 == gptp) { @@ -819,7 +819,7 @@ void gpt_lld_stop(GPTDriver *gptp) { */ void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval) { - gptp->tim->ARR = (uint32_t)(interval); /* Time constant. */ + gptp->tim->ARR = (uint32_t)interval; /* Time constant. */ gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */ gptp->tim->CNT = 0; /* Reset counter. */ @@ -861,7 +861,7 @@ void gpt_lld_stop_timer(GPTDriver *gptp) { */ void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) { - gptp->tim->ARR = (uint32_t)(interval); /* Time constant. */ + gptp->tim->ARR = (uint32_t)interval; /* Time constant. */ gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */ gptp->tim->SR = 0; /* Clear pending IRQs. */ gptp->tim->CR1 = STM32_TIM_CR1_OPM | STM32_TIM_CR1_URS | STM32_TIM_CR1_CEN; diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.h b/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.h index 16762f38a..f453243cb 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.h +++ b/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.h @@ -541,8 +541,8 @@ struct GPTDriver { * * @notapi */ -#define gpt_lld_change_interval(gptp, interval) \ - ((gptp)->tim->ARR = (uint32_t)((interval) - 1)) +#define gpt_lld_change_interval(gptp, interval) \ + ((gptp)->tim->ARR = (uint32_t)(interval)) /** * @brief Returns the interval of GPT peripheral. @@ -553,7 +553,7 @@ struct GPTDriver { * * @notapi */ -#define gpt_lld_get_interval(gptp) ((gptcnt_t)(gptp)->tim->ARR + 1) +#define gpt_lld_get_interval(gptp) ((gptcnt_t)(gptp)->tim->ARR) /** * @brief Returns the counter value of GPT peripheral. -- cgit v1.2.3