26 lines
356 B
C++
26 lines
356 B
C++
#ifndef MOTOR_DRIVER_H
|
|
#define MOTOR_DRIVER_H
|
|
|
|
class Motor_driver
|
|
{
|
|
public:
|
|
void init();
|
|
|
|
// Range: -255 ... +255
|
|
void set_command(double command);
|
|
|
|
void coast();
|
|
|
|
void brake();
|
|
|
|
double command() const;
|
|
|
|
private:
|
|
double currentCommand;
|
|
|
|
void enable_pwm_outputs();
|
|
|
|
unsigned char magnitude(double value) const;
|
|
};
|
|
|
|
#endif |