
SIMPLE CLEAN: cleanup code and add printf handler FIX: counters ADD: motor ENH: temporary disable can ADD: dummy foc, but creepy work
22 lines
735 B
C
22 lines
735 B
C
#include "motor.h"
|
|
|
|
void start_motor_control(TIM_HandleTypeDef *htim, uint32_t channel1, uint32_t channel2, uint32_t channel3)
|
|
{
|
|
HAL_TIM_PWM_Start(htim, channel1);
|
|
HAL_TIM_PWM_Start(htim, channel2);
|
|
HAL_TIM_PWM_Start(htim, channel3);
|
|
}
|
|
|
|
void stop_motor_control(TIM_HandleTypeDef *htim, uint32_t channel1, uint32_t channel2, uint32_t channel3)
|
|
{
|
|
HAL_TIM_PWM_Stop(htim, channel1);
|
|
HAL_TIM_PWM_Stop(htim, channel2);
|
|
HAL_TIM_PWM_Stop(htim, channel3);
|
|
}
|
|
|
|
void set_pwm(TIM_HandleTypeDef *htim, uint32_t phaseA, uint32_t phaseB, uint32_t phaseC)
|
|
{
|
|
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_1, phaseA);
|
|
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_2, phaseB);
|
|
__HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_3, phaseC);
|
|
}
|