stm32/stm32_foc: do not enable PWM outputs that are not in use
This commit is contained in:
parent
d1307aa34f
commit
13f62d15cc
@ -607,15 +607,32 @@
|
|||||||
|
|
||||||
#define ADC_FROM_FOC_DEV_GET(d) (STM32_FOC_DEV_FROM_DEV_GET(d)->adc)
|
#define ADC_FROM_FOC_DEV_GET(d) (STM32_FOC_DEV_FROM_DEV_GET(d)->adc)
|
||||||
|
|
||||||
|
/* Define PWM all outputs */
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_FOC_HAS_PWM_COMPLEMENTARY
|
||||||
|
# define PMW_OUTPUTS_ALL_COMP (STM32_PWM_OUT1N| \
|
||||||
|
STM32_PWM_OUT2N| \
|
||||||
|
STM32_PWM_OUT3N)
|
||||||
|
#else
|
||||||
|
# define PMW_OUTPUTS_ALL_COMP (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_FOC_ADC_CCR4) || (CONFIG_MOTOR_FOC_PHASES > 3)
|
||||||
|
# define PMW_OUTPUTS_ALL_OUT4 (STM32_PWM_OUT4)
|
||||||
|
#else
|
||||||
|
# define PMW_OUTPUTS_ALL_OUT4 (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PWM_OUTPUTS_ALL (STM32_PWM_OUT1| \
|
||||||
|
STM32_PWM_OUT2| \
|
||||||
|
STM32_PWM_OUT3| \
|
||||||
|
PMW_OUTPUTS_ALL_COMP| \
|
||||||
|
PMW_OUTPUTS_ALL_OUT4)
|
||||||
|
|
||||||
/* Enable all PWM outputs at once (include CHAN4 for ADC trigger) */
|
/* Enable all PWM outputs at once (include CHAN4 for ADC trigger) */
|
||||||
|
|
||||||
#define PWM_ALL_OUTPUTS_ENABLE(pwm, state) \
|
#define PWM_ALL_OUTPUTS_ENABLE(pwm, state) \
|
||||||
PWM_OUTPUTS_ENABLE(pwm, \
|
PWM_OUTPUTS_ENABLE(pwm, PWM_OUTPUTS_ALL, state);
|
||||||
STM32_PWM_OUT1|STM32_PWM_OUT1N| \
|
|
||||||
STM32_PWM_OUT2|STM32_PWM_OUT2N| \
|
|
||||||
STM32_PWM_OUT3|STM32_PWM_OUT3N| \
|
|
||||||
STM32_PWM_OUT4, \
|
|
||||||
state);
|
|
||||||
|
|
||||||
/* Enable/disable ADC interrupts (FOC worker loop) */
|
/* Enable/disable ADC interrupts (FOC worker loop) */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user