-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPololuMC33926.h
38 lines (34 loc) · 1.07 KB
/
PololuMC33926.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
#ifndef POLOLU_MC33926_H
#define POLOLU_MC33926_H
#include <Arduino.h>
class MC33926
{
public:
// Constructors
#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(_SAM3XA_)
// Teensy 3.X and Arduino Due analog pins cannot take 5V
MC33926(uint8_t DIR1, uint8_t DIR2,uint8_t PWM, uint8_t SF);
#else
MC33926(uint8_t DIR1, uint8_t DIR2,uint8_t PWM, uint8_t SF, uint8_t FB);
#endif
// Public functions
void init(); // Initializes the pins
void set_pwm(int16_t desired_pwm); // Sets the desired PWM value
bool fault(); // Checks for an fault and returns true if there is one
void flip_motor_direction();
#if !defined(__MK20DX128__) || !defined(__MK20DX256__) || !defined(_SAM3XA_)
int motor_current();
#endif
private:
// Private pin variables
uint8_t DIR1_;
uint8_t DIR2_;
uint8_t PWM_;
uint8_t SF_;
#if !defined(__MK20DX128__) || !defined(__MK20DX256__) || !defined(_SAM3XA_)
uint8_t FB_;
#endif
// Private variables
int8_t invert_direction_;
};
#endif // POLOLU_MC33926_H