From be3b8019892b40443d7ff54c64e5d9c9fc2fd1b7 Mon Sep 17 00:00:00 2001 From: Roberto Aldea Date: Fri, 30 Jun 2023 11:52:20 +0200 Subject: [PATCH] Update definition for magic number MIN_PWM --- firmware/Sources/HAL/HAL_PWM/hal_pwm.c | 6 +++--- firmware/Sources/HAL/HAL_PWM/hal_pwm.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/firmware/Sources/HAL/HAL_PWM/hal_pwm.c b/firmware/Sources/HAL/HAL_PWM/hal_pwm.c index 64d439e..2a30fc7 100644 --- a/firmware/Sources/HAL/HAL_PWM/hal_pwm.c +++ b/firmware/Sources/HAL/HAL_PWM/hal_pwm.c @@ -22,7 +22,7 @@ /**********************************************************************************/ /* Definition of local symbolic constants */ /**********************************************************************************/ -#define MIN_PWM 96 + /**********************************************************************************/ /* Definition of local function like macros */ /**********************************************************************************/ @@ -84,12 +84,12 @@ HAL_PWM_result_e HAL_PwmSetDuty(const uint32_t duty){ pwm_duty = HAL_PWM_period -1; } //If duty between max and min values - else if (duty>=MIN_PWM){ + else if (duty>=HAL_PWM_MIN_PWM){ pwm_duty = duty; } else{ // Minimum duty to apply to the pwm is 96 by hardware with the actual configuration. - pwm_duty = MIN_PWM; + pwm_duty = HAL_PWM_MIN_PWM; } // Write the value to compare in the register. diff --git a/firmware/Sources/HAL/HAL_PWM/hal_pwm.h b/firmware/Sources/HAL/HAL_PWM/hal_pwm.h index ddb4e6c..0f57cc4 100644 --- a/firmware/Sources/HAL/HAL_PWM/hal_pwm.h +++ b/firmware/Sources/HAL/HAL_PWM/hal_pwm.h @@ -16,6 +16,8 @@ /**********************************************************************************/ /* Definition of local symbolic constants */ /**********************************************************************************/ +#define HAL_PWM_MIN_PWM 96 +/* This value depends on the prescaler of the HRTIM, go to documentation for more info */ /**********************************************************************************/ /* Definition of local function like macros */