Wyatt  1.0.1
Public Member Functions | List of all members
MotorAdapter Class Reference

#include <MotorAdapter.h>

Inheritance diagram for MotorAdapter:
Inheritance graph
[legend]
Collaboration diagram for MotorAdapter:
Collaboration graph
[legend]

Public Member Functions

 MotorAdapter (AdafruitPWMServoHat *m_pwmHat, int forwardPin, int backwardPin)
 
 ~MotorAdapter () override
 
void write (IMessage *msg) override
 
std::list< IMessage * > * read () override
 
- Public Member Functions inherited from IHardwareInterface
virtual ~IHardwareInterface ()
 

Detailed Description

Hardware adapter for communicating with the Pololu motors TODO: Change the MotorMessage type to send data in terms of velocity (cm/s) instead of motor power([-4095, 4095]). This will uncouple the rest of the program from the hardware specifics.

Definition at line 18 of file MotorAdapter.h.

Constructor & Destructor Documentation

MotorAdapter::MotorAdapter ( AdafruitPWMServoHat m_pwmHat,
int  forwardPin,
int  backwardPin 
)

Constructor

Parameters
m_pwmHatPAdafruitPWMServoObject used to communicate with motor
forwardPinSet this pin to PWM to drive motor forward. Set to 0 for backwards.
backwardPinSet this pin to PWM to drive motor backward. Set to 0 for forward.

Definition at line 7 of file MotorAdapter.cpp.

MotorAdapter::~MotorAdapter ( )
override

Deconstructor.

Definition at line 13 of file MotorAdapter.cpp.

Member Function Documentation

std::list<IMessage*>* MotorAdapter::read ( )
inlineoverridevirtual

Read data from the motor. Cannot. Returns empty list.

Returns
An empty list of IMessages.

Implements IHardwareInterface.

Definition at line 45 of file MotorAdapter.h.

void MotorAdapter::write ( IMessage msg)
overridevirtual

Write a message to the motor. Contains an integer representing the speed of the motor [-4095 - 4095] = [Full Backwards, Full Forwards]

Parameters
msgA message wrapping a byte specifying motor speed
Exceptions
MismatchedMessageExceptionMessage is of wrong type

Implements IHardwareInterface.

Definition at line 17 of file MotorAdapter.cpp.


The documentation for this class was generated from the following files: