29 lines
693 B
C++
29 lines
693 B
C++
#include <stdint.h>
|
|
|
|
// TODO: implement class
|
|
|
|
class BrushedMotor {
|
|
/* Driver for native MCPWM controller. */
|
|
// TODO: define default values
|
|
public:
|
|
BrushedMotor(uint32_t PwmAGpioNum, uint32_t PwmBGpioNum, uint32_t PwmFreqHz,
|
|
uint32_t McpwmResolutionHz, int McpwmGroupId = 0);
|
|
void setDuty(uint16_t duty);
|
|
uint16_t maxDuty();
|
|
void enable();
|
|
void disable();
|
|
void forward();
|
|
void reverse();
|
|
void coast();
|
|
void brake();
|
|
|
|
protected:
|
|
/* MCPWM group */
|
|
int _mcpwmGroupId = 0;
|
|
uint32_t _mcpwmResolutionHz;
|
|
|
|
/* Brushed motor properties */
|
|
uint32_t _pwmAGpioNum;
|
|
uint32_t _pwmBGpioNum;
|
|
uint32_t _pwmFreqHz;
|
|
}; |