-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoveHBridge.h
42 lines (29 loc) · 986 Bytes
/
RoveHBridge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef ROVEHBRIDGE_H
#define ROVEHBRIDGE_H
#include "RoveMotor.h"
#include <cstdint>
class RoveHBridge : public RoveMotor {
private:
uint8_t m_forwardPin, m_reversePin;
public:
/**
* @brief Construct a new RoveHBridge object.
*
* @param forwardPin The Arduino pin number for the forward PWM signal.
* @param reversePin The Arduino pin number for the reverse PWM signal.
*/
RoveHBridge(const uint8_t forwardPin, const uint8_t reversePin) : m_forwardPin(forwardPin), m_reversePin(reversePin) {}
/**
* @brief Configure the Arduino analogWriteFrequency() for the forward and reverse pins.
*
* @param frequency Desired frequency, in Hz.
*/
void configFrequency(const float frequency);
/**
* @brief Write the provided drive signal to the motor via Arduino analogWrite().
*
* @param decipercent Motor output [-1000, 1000].
*/
void drive(int16_t decipercent) const override;
};
#endif