forked from waymond91/APM2.5-6_Custom_Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
APM_PPM.h
43 lines (32 loc) · 1.04 KB
/
APM_PPM.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
43
/*
This library configures the pin connected to ATMEGA2560 so that it can read
the PPM signal sent from the ATMEGA32U4.
This library aims to be as "low-level" as possible so that by default the platform
will always function as an effective servo signal gateway.
Although the are lots of tutorials about timers and interrupts online, when using
a new device often times I like to consult the avr-libc user manual!
Excellent example here:
https://stackoverflow.com/questions/31852914/read-rc-pwm-signal-using-atmega2560-in-atmel-avr-studio
*/
#ifndef _APM_PPM_H
#define _APM_PPM_H
#include "Arduino.h"
const int ppmIn = 48; //PL_1
const int numChannel = 8;
extern volatile uint16_t _ppmIn_[numChannel];
extern volatile uint8_t _ppmFlag_;
extern volatile uint8_t _ppmPass_;
class APM_PPM{
public:
APM_PPM();
void initialize();
void read(uint16_t val[numChannel]);
void haltAll();
void startAll();
void halt(uint8_t servoNum);
void start(uint8_t servoNum);
uint8_t checkRunning();
bool newData();
private:
};
#endif