git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12138 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
gdisirio 2018-07-07 09:50:34 +00:00
parent d8c1554717
commit 3d7b366fd0
3 changed files with 7 additions and 5 deletions

View File

@ -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 - 1U); /* Time constant. */
gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */
gptp->tim->CNT = 0; /* Reset counter. */
@ -861,9 +861,9 @@ 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 - 1U); /* Time constant. */
gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */
gptp->tim->SR = 0; /* Clear pending IRQs. */
gptp->tim->SR = 0; /* Clear pending IRQs. */
gptp->tim->CR1 = STM32_TIM_CR1_OPM | STM32_TIM_CR1_URS | STM32_TIM_CR1_CEN;
while (!(gptp->tim->SR & STM32_TIM_SR_UIF))
;

View File

@ -542,7 +542,7 @@ struct GPTDriver {
* @notapi
*/
#define gpt_lld_change_interval(gptp, interval) \
((gptp)->tim->ARR = (uint32_t)(interval))
((gptp)->tim->ARR = (uint32_t)((interval) - 1U))
/**
* @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)
#define gpt_lld_get_interval(gptp) ((gptcnt_t)((gptp)->tim->ARR + 1U))
/**
* @brief Returns the counter value of GPT peripheral.

View File

@ -138,6 +138,8 @@
- EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1).
- EX: Updated LPS25H to 1.1.0 (backported to 18.2.1).
- EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1).
- HAL: Fixed invalid period calculation in STM32 GPT driver (bug #957)
(backported to 18.2.2 and 17.6.5).
- HAL: Fixed missing USART7/8 definitions in STM32F0 HAL (bug #956)(backported
to 18.2.2).
- LIB: Fixed heap allocation issue (bug #955)(backported to 18.2.2 and 17.6.5).