Library to use remote control Spektrum AR6210
AR6210.cpp
- Committer:
- Joram
- Date:
- 2013-11-20
- Revision:
- 0:9a1f7660704d
- Child:
- 1:25aad26619fb
File content as of revision 0:9a1f7660704d:
#include "mbed.h" #include "AR6210.h" // Original code: https://mbed.org/users/BlazeX/code/AR8000/ // Modified by Joram Querner for Spektrum AR6210 AR6210::AR6210() : ChInt0(InterruptIn(p6)), // throttle ChInt1(InterruptIn(p8)), // aileron ChInt2(InterruptIn(p7)), // elevator ChInt3(InterruptIn(p5)), // rudder ChInt4(InterruptIn(p9)), // gear ChInt5(InterruptIn(p10)) // aux {} void AR6210::init() { Time.start(); for(int i= 0; i < 6; i++) { LastRise[i]= 0; dTime[i]= 1000; } ChInt0.mode(PullDown); ChInt0.rise<AR6210>(this, &AR6210::Rise0); ChInt0.fall<AR6210>(this, &AR6210::Fall0); ChInt1.mode(PullDown); ChInt1.rise<AR6210>(this, &AR6210::Rise1); ChInt1.fall<AR6210>(this, &AR6210::Fall1); ChInt2.mode(PullDown); ChInt2.rise<AR6210>(this, &AR6210::Rise2); ChInt2.fall<AR6210>(this, &AR6210::Fall2); ChInt3.mode(PullDown); ChInt3.rise<AR6210>(this, &AR6210::Rise3); ChInt3.fall<AR6210>(this, &AR6210::Fall3); ChInt4.mode(PullDown); ChInt4.rise<AR6210>(this, &AR6210::Rise4); ChInt4.fall<AR6210>(this, &AR6210::Fall4); ChInt5.mode(PullDown); ChInt5.rise<AR6210>(this, &AR6210::Rise5); ChInt5.fall<AR6210>(this, &AR6210::Fall5); update(); } void AR6210::update() { //Rohdaten �hmen for(int i= 0; i<6; i++) RawChannels[i]= dTime[i]; //Steuerbefehle berechnen Throttle= float(dTime[0]-1000) * 0.001; Aileron= float(dTime[1]-1500) * 0.002; Elevator= float(dTime[2]-1500) * 0.002; Rudder= float(dTime[3]-1500) * 0.002; Gear= float(dTime[4]-1500) * 0.002; Aux= float(dTime[5]-1500) * 0.002; }