Raharja Agie / Mbed 2 deprecated FlightController

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rcrx.h Source File

rcrx.h

00001 Timer tick;
00002 InterruptIn rc(p11);
00003 short buf_ppm[5];
00004 char i = 0;
00005 
00006 void PPM_rise() {
00007     tick.stop();                        // Stop timer
00008     buf_ppm[i]=tick.read_us();          // Read timer to buffer[i] i=turns
00009     tick.reset();                       // Reset timer
00010     i++;                                // increment i.
00011     if (i==6) i = 0;
00012     return;
00013 }
00014 
00015 void PPM_fall() {                      // Rising edge on the serial comm
00016     tick.start();                      // Start the timer
00017     return;
00018 }