/** ****************************************************************************** * @file DCMotor.h * @author CAVAILLES, Kevin and GÜLDENSTEIN, Jasper * @brief Service for setting the speed of a DC motor using a PWM signal. ****************************************************************************** */ #ifndef DC_MOTOR_H #define DC_MOTOR_H /** * @brief Initialziation function for the DC_MOTOR module. * Peripherals used: TIM2 * Pins used: PA1 (TIM2 channel 1, PWM Output) * PA2 (GPIO, direction control) */ void DC_MOTOR_Init(void); /** * @brief Sets the speed of the DC motor using a PWM signal with a period of 50us -> frequency of 20kHz and a resolution of 0.5us * @param speed value between -100 (full throttle clockwise), 0 (stop), and 100 (full throttle counterclockwise) */ void DC_MOTOR_SetSpeed(int speed); #endif