33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "Thing.h"
|
|
|
|
/// @brief Support for a DRV8833 motor controller
|
|
namespace RoboidControl {
|
|
class DRV8833 {
|
|
public:
|
|
/// @brief Motor turning direction
|
|
enum class RotationDirection { Clockwise = 1, CounterClockwise = -1 };
|
|
|
|
/// @brief Setup a DRV8833 motor controller
|
|
/// @param pinAIn1 The pin number connected to the AIn1 port
|
|
/// @param pinAIn2 The pin number connected to the AIn2 port
|
|
/// @param pinBIn1 The pin number connected to the BIn1 port
|
|
/// @param pinBIn2 The pin number connceted to the BIn2 port
|
|
/// @param pinStandby The pin number connected to the standby port, 255
|
|
/// indicated that the port is not connected
|
|
/// @param directionA The forward turning direction of motor A
|
|
/// @param directionB The forward turning direction of motor B
|
|
DRV8833(unsigned char pinAIn1,
|
|
unsigned char pinAIn2,
|
|
unsigned char pinBIn1,
|
|
unsigned char pinBIn2,
|
|
unsigned char pinStandby = 255,
|
|
RotationDirection directionA = RotationDirection::Clockwise,
|
|
RotationDirection directionB = RotationDirection::Clockwise);
|
|
|
|
Thing* motorA = nullptr;
|
|
Thing* motorB = nullptr;
|
|
};
|
|
|
|
} // namespace RoboidControl
|