|
|
|
@ -10,6 +10,7 @@
@@ -10,6 +10,7 @@
|
|
|
|
|
#include <AP_RcChannel.h> // ArduPilot Mega RC Library |
|
|
|
|
#include <APM_RC.h> |
|
|
|
|
#include <AP_Vector.h> |
|
|
|
|
#include <Arduino_Mega_ISR_Registry.h> |
|
|
|
|
FastSerialPort0(Serial) |
|
|
|
|
; // make sure this proceeds variable declarations |
|
|
|
|
|
|
|
|
@ -33,38 +34,40 @@ private:
@@ -33,38 +34,40 @@ private:
|
|
|
|
|
ch8Key |
|
|
|
|
}; |
|
|
|
|
Vector<AP_RcChannel *> ch; |
|
|
|
|
APM_RC_APM1 radio; |
|
|
|
|
Arduino_Mega_ISR_Registry isr_registry; |
|
|
|
|
public: |
|
|
|
|
RadioTest() : |
|
|
|
|
testPosition(2), testSign(1) { |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(rollKey, PSTR("ROLL"), APM_RC, 0, 1100, 1500, |
|
|
|
|
new AP_RcChannel(rollKey, PSTR("ROLL"), &radio, 0, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(pitchKey, PSTR("PITCH"), APM_RC, 1, 1100, |
|
|
|
|
new AP_RcChannel(pitchKey, PSTR("PITCH"), &radio, 1, 1100, |
|
|
|
|
1500, 1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(thrKey, PSTR("THR"), APM_RC, 2, 1100, 1500, |
|
|
|
|
new AP_RcChannel(thrKey, PSTR("THR"), &radio, 2, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(yawKey, PSTR("YAW"), APM_RC, 3, 1100, 1500, |
|
|
|
|
new AP_RcChannel(yawKey, PSTR("YAW"), &radio, 3, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(ch5Key, PSTR("CH5"), APM_RC, 4, 1100, 1500, |
|
|
|
|
new AP_RcChannel(ch5Key, PSTR("CH5"), &radio, 4, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(ch6Key, PSTR("CH6"), APM_RC, 5, 1100, 1500, |
|
|
|
|
new AP_RcChannel(ch6Key, PSTR("CH6"), &radio, 5, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(ch7Key, PSTR("CH7"), APM_RC, 6, 1100, 1500, |
|
|
|
|
new AP_RcChannel(ch7Key, PSTR("CH7"), &radio, 6, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
ch.push_back( |
|
|
|
|
new AP_RcChannel(ch8Key, PSTR("CH8"), APM_RC, 7, 1100, 1500, |
|
|
|
|
new AP_RcChannel(ch8Key, PSTR("CH8"), &radio, 7, 1100, 1500, |
|
|
|
|
1900, RC_MODE_INOUT, false)); |
|
|
|
|
|
|
|
|
|
radio.Init(&isr_registry); |
|
|
|
|
|
|
|
|
|
Serial.begin(57600); |
|
|
|
|
delay(2000); |
|
|
|
|
Serial.println("ArduPilot RC Channel test"); |
|
|
|
|
APM_RC.Init(); // APM Radio initialization |
|
|
|
|
delay(2000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|