From d1e50cb0c86608e6e433016ff677c2879b289f7e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Apr 2023 14:34:22 +1000 Subject: [PATCH] AP_HAL: change to 16 bit timeout in event interface prevent issues on 16 bit timers where we can end up with TIME_INFINITE --- libraries/AP_HAL/EventHandle.cpp | 4 ++-- libraries/AP_HAL/EventHandle.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL/EventHandle.cpp b/libraries/AP_HAL/EventHandle.cpp index 001d3386c2..d0dab77d92 100644 --- a/libraries/AP_HAL/EventHandle.cpp +++ b/libraries/AP_HAL/EventHandle.cpp @@ -16,12 +16,12 @@ bool AP_HAL::EventHandle::unregister_event(uint32_t evt_mask) return true; } -bool AP_HAL::EventHandle::wait(uint64_t duration) +bool AP_HAL::EventHandle::wait(uint16_t duration_us) { if (evt_src_ == nullptr) { return false; } - return evt_src_->wait(duration, this); + return evt_src_->wait(duration_us, this); } bool AP_HAL::EventHandle::set_source(AP_HAL::EventSource* src) diff --git a/libraries/AP_HAL/EventHandle.h b/libraries/AP_HAL/EventHandle.h index 3c27d58cb0..c5c676c389 100644 --- a/libraries/AP_HAL/EventHandle.h +++ b/libraries/AP_HAL/EventHandle.h @@ -14,7 +14,7 @@ public: // Wait on an Event handle, method for internal use by EventHandle - virtual bool wait(uint64_t duration, AP_HAL::EventHandle* evt_handle) = 0; + virtual bool wait(uint16_t duration_us, AP_HAL::EventHandle* evt_handle) = 0; }; class AP_HAL::EventHandle { @@ -31,7 +31,7 @@ public: virtual bool unregister_event(uint32_t evt_mask); // return true if event was triggered within the duration - virtual bool wait(uint64_t duration); + virtual bool wait(uint16_t duration_us); virtual uint32_t get_evt_mask() const { return evt_mask_; }