This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
XF/src/simplified/xf/port/idf-stm32/eventqueue.cpp

48 lines
798 B
C++

#include <config/xf-config.h>
#if (USE_XF_IDF_STM32_EVENT_QUEUE_CLASS != 0)
#include <cassert>
#include "eventqueue.h"
// TODO done: Implement code for XFEventQueue class
XFEventQueue::XFEventQueue(){
}
XFEventQueue::~XFEventQueue(){
}
bool XFEventQueue::empty() const {
return queue_.empty();
}
bool XFEventQueue::push(const XFEvent *pEvent, bool fromISR) {
(void) fromISR;
mutex_.lock();
queue_.push(pEvent);
mutex_.unlock();
return true;
}
const XFEvent* XFEventQueue::front() {
return queue_.front();
}
void XFEventQueue::pop() {
mutex_.lock();
queue_.pop();
mutex_.unlock();
}
bool XFEventQueue::pend() {
// Method cannot be used in an IDF! Waiting within
// this method would block the whole XF
return false;
}
#endif // USE_XF_IDF_STM32_EVENT_QUEUE_CLASS