diff --git a/libraries/AP_HAL_Empty/RCOutput.cpp b/libraries/AP_HAL_Empty/RCOutput.cpp index e83047bd3e..51747942cb 100644 --- a/libraries/AP_HAL_Empty/RCOutput.cpp +++ b/libraries/AP_HAL_Empty/RCOutput.cpp @@ -1,5 +1,6 @@ #include "RCOutput.h" +#include using namespace Empty; @@ -18,12 +19,23 @@ void RCOutput::disable_ch(uint8_t chan) {} void RCOutput::write(uint8_t chan, uint16_t period_us) -{} +{ + if (chan < ARRAY_SIZE(value)) { + value[chan] = period_us; + } +} -uint16_t RCOutput::read(uint8_t chan) { +uint16_t RCOutput::read(uint8_t chan) +{ + if (chan < ARRAY_SIZE(value)) { + return value[chan]; + } return 900; } void RCOutput::read(uint16_t* period_us, uint8_t len) -{} +{ + len = MIN(len, ARRAY_SIZE(value)); + memcpy(period_us, value, len*sizeof(value[0])); +} diff --git a/libraries/AP_HAL_Empty/RCOutput.h b/libraries/AP_HAL_Empty/RCOutput.h index 18a823c3f5..8f26536e02 100644 --- a/libraries/AP_HAL_Empty/RCOutput.h +++ b/libraries/AP_HAL_Empty/RCOutput.h @@ -13,4 +13,6 @@ class Empty::RCOutput : public AP_HAL::RCOutput { void read(uint16_t* period_us, uint8_t len) override; void cork(void) override {} void push(void) override {} +private: + uint16_t value[16]; };