From 7ea75aaf95bf66ffcdde2e125992570ac349db1e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Oct 2016 08:06:36 +1100 Subject: [PATCH] HAL_QURT: implement cork() and push() for RCOutput --- libraries/AP_HAL_QURT/RCOutput.cpp | 14 +++++++++++++- libraries/AP_HAL_QURT/RCOutput.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_QURT/RCOutput.cpp b/libraries/AP_HAL_QURT/RCOutput.cpp index 0b211c0347..58d45d1fac 100644 --- a/libraries/AP_HAL_QURT/RCOutput.cpp +++ b/libraries/AP_HAL_QURT/RCOutput.cpp @@ -51,7 +51,9 @@ void RCOutput::write(uint8_t ch, uint16_t period_us) return; } period[ch] = period_us; - need_write = true; + if (!corked) { + need_write = true; + } } uint16_t RCOutput::read(uint8_t ch) @@ -108,6 +110,16 @@ void RCOutput::timer_update(void) ::write(fd, (uint8_t *)&frame, sizeof(frame)); } +void RCOutput::cork(void) +{ + corked = true; +} + +void RCOutput::push(void) +{ + need_write = true; + corked = false; +} #endif // CONFIG_HAL_BOARD_SUBTYPE diff --git a/libraries/AP_HAL_QURT/RCOutput.h b/libraries/AP_HAL_QURT/RCOutput.h index 1476569963..bbef8eb7e3 100644 --- a/libraries/AP_HAL_QURT/RCOutput.h +++ b/libraries/AP_HAL_QURT/RCOutput.h @@ -24,6 +24,8 @@ public: void write(uint8_t ch, uint16_t period_us); uint16_t read(uint8_t ch); void read(uint16_t *period_us, uint8_t len); + void cork(void) override; + void push(void) override; void timer_update(void); @@ -36,6 +38,7 @@ private: uint16_t enable_mask; uint16_t period[channel_count]; volatile bool need_write; + bool corked; }; #endif // CONFIG_HAL_BOARD