Skip to content

Commit

Permalink
Merge pull request #98 from WattRex/feature/HAL_PWM
Browse files Browse the repository at this point in the history
feature/HAL_PWM Update definition for magic number MIN_PWM
  • Loading branch information
pastorpflores authored Jun 30, 2023
2 parents 78b03f1 + 6f11a12 commit d8f5fab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions firmware/Sources/HAL/HAL_PWM/hal_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/* Definition of local symbolic constants */
/**********************************************************************************/

#define MIN_PWM 96
/**********************************************************************************/
/* Definition of local function like macros */
/**********************************************************************************/
Expand Down Expand Up @@ -89,12 +88,12 @@ HAL_PWM_result_e HAL_PwmSetDuty(const uint32_t duty){

}
//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.
Expand Down
2 changes: 2 additions & 0 deletions firmware/Sources/HAL/HAL_PWM/hal_pwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit d8f5fab

Please sign in to comment.