forked from murproject/HighROV_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPWMController.h
34 lines (27 loc) · 824 Bytes
/
PWMController.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
#pragma once
#include <Wire.h>
#include <SparkFun_PCA9536_Arduino_Library.h>
#include <Servo.h>
class PWMController
{
public:
static void init();
static void set_servo_angle(int idx, int angle);
static void set_servo_power(int idx, int power);
static void set_thruster(int idx, int power);
static void set_manipulator(int ch, int power);
static void set_video_multiplexer(bool state);
PWMController(const PWMController&) = delete;
private:
static const int pulse_min = 1000;
static const int pulse_med = 1500;
static const int pulse_max = 2000;
static PWMController &inst();
PWMController();
PCA9536 m_pca;
/* controlled by SAMD_ISR_SERVO lib: */
int m_pins[8];
int m_isr_servos[8];
/* controlled by Arduino Servo.h lib:*/
Servo m_servos[4];
};