From 4bf3ec0e91d1ab4c886337d154b2b7c2d6492412 Mon Sep 17 00:00:00 2001 From: Jonathan Challinger Date: Thu, 10 Mar 2016 13:55:58 -0800 Subject: [PATCH] AP_HAL_PX4: implement RCOutput::read_last_sent --- libraries/AP_HAL_PX4/RCOutput.cpp | 16 ++++++++++++++++ libraries/AP_HAL_PX4/RCOutput.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/libraries/AP_HAL_PX4/RCOutput.cpp b/libraries/AP_HAL_PX4/RCOutput.cpp index c8056da655..6a73dae03e 100644 --- a/libraries/AP_HAL_PX4/RCOutput.cpp +++ b/libraries/AP_HAL_PX4/RCOutput.cpp @@ -285,6 +285,22 @@ void PX4RCOutput::read(uint16_t* period_us, uint8_t len) } } +uint16_t PX4RCOutput::read_last_sent(uint8_t ch) +{ + if (ch >= PX4_NUM_OUTPUT_CHANNELS) { + return 0; + } + + return _period[ch]; +} + +void PX4RCOutput::read_last_sent(uint16_t* period_us, uint8_t len) +{ + for (uint8_t i=0; i