You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
630 B
34 lines
630 B
5 years ago
|
#include "EventHandle.h"
|
||
|
#include <AP_HAL/AP_HAL.h>
|
||
|
|
||
|
|
||
|
bool AP_HAL::EventHandle::register_event(uint32_t evt_mask)
|
||
|
{
|
||
|
WITH_SEMAPHORE(sem);
|
||
|
evt_mask_ |= evt_mask;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool AP_HAL::EventHandle::unregister_event(uint32_t evt_mask)
|
||
|
{
|
||
|
WITH_SEMAPHORE(sem);
|
||
|
evt_mask_ &= ~evt_mask;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool AP_HAL::EventHandle::wait(uint64_t duration)
|
||
|
{
|
||
|
if (evt_src_ == nullptr) {
|
||
|
return false;
|
||
|
}
|
||
|
return evt_src_->wait(duration, this);
|
||
|
}
|
||
|
|
||
|
bool AP_HAL::EventHandle::set_source(AP_HAL::EventSource* src)
|
||
|
{
|
||
|
WITH_SEMAPHORE(sem);
|
||
|
evt_src_ = src;
|
||
|
evt_mask_ = 0;
|
||
|
return true;
|
||
|
}
|