Add electrical specs to motor structs.

More #defines for PWM settings.
This commit is contained in:
2025-10-05 15:06:14 -05:00
parent f8d98bda05
commit fb42baa4c3
5 changed files with 55 additions and 32 deletions

View File

@@ -3,13 +3,15 @@
#include "motor_controller.h"
void BLDC_Init(Cont_Mot_Interface_TypeDef Interface) {
HAL_TIM_PWM_Start(Interface.Driver_PWM_TIM, Interface.U_Phase_TIM_Channel);
HAL_TIMEx_PWMN_Start(Interface.Driver_PWM_TIM, Interface.U_Phase_TIM_Channel);
HAL_TIM_PWM_Start(Interface.Driver_PWM_TIM, Interface.V_Phase_TIM_Channel);
HAL_TIMEx_PWMN_Start(Interface.Driver_PWM_TIM, Interface.V_Phase_TIM_Channel);
HAL_TIM_PWM_Start(Interface.Driver_PWM_TIM, Interface.W_Phase_TIM_Channel);
HAL_TIMEx_PWMN_Start(Interface.Driver_PWM_TIM, Interface.W_Phase_TIM_Channel);
void BLDC_PWM_Init(Cont_Mot_PWMInterface_TypeDef* PWM_Interface) {
//Start High-Side and Low-Side PWM Drivers
HAL_TIM_PWM_Start(PWM_Interface->Driver_PWM_TIM, PWM_Interface->U_Phase_TIM_Channel);
HAL_TIMEx_PWMN_Start(PWM_Interface->Driver_PWM_TIM, PWM_Interface->U_Phase_TIM_Channel);
HAL_TIM_PWM_Start(PWM_Interface->Driver_PWM_TIM, PWM_Interface->V_Phase_TIM_Channel);
HAL_TIMEx_PWMN_Start(PWM_Interface->Driver_PWM_TIM, PWM_Interface->V_Phase_TIM_Channel);
HAL_TIM_PWM_Start(PWM_Interface->Driver_PWM_TIM, PWM_Interface->W_Phase_TIM_Channel);
HAL_TIMEx_PWMN_Start(PWM_Interface->Driver_PWM_TIM, PWM_Interface->W_Phase_TIM_Channel);
}
void BLDC_Loop() {