aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-02-02 10:15:24 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-02-02 10:15:24 +0000
commit4f98c8cf4c05dd2f7dc6e5e9e135d012f6aa0ab5 (patch)
tree921fc3f1b7decb3b84cf63b5260718ecdb441b51 /os/hal
parentba9b7671a05e8476e66ec5fd779e29d55040ce97 (diff)
downloadChibiOS-4f98c8cf4c05dd2f7dc6e5e9e135d012f6aa0ab5.tar.gz
ChibiOS-4f98c8cf4c05dd2f7dc6e5e9e135d012f6aa0ab5.tar.bz2
ChibiOS-4f98c8cf4c05dd2f7dc6e5e9e135d012f6aa0ab5.zip
Fixed bug #914.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11422 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c16
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.h6
2 files changed, 11 insertions, 11 deletions
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.