InfiniSim/sim/queue.h
mark9064 5ad8c0356e
Fixes for PR 2043 (LCD delay) (#142)
Refactor sim code to be closer to FreeRTOS.

Add some defines needed for LCD delay PR
2024-05-03 10:30:10 +02:00

30 lines
1008 B
C++

#pragma once
#include <mutex>
#include <vector>
/**
* Type by which queues are referenced. For example, a call to xQueueCreate()
* returns an QueueHandle_t variable that can then be used as a parameter to
* xQueueSend(), xQueueReceive(), etc.
*/
//typedef void * QueueHandle_t;
struct QueueHandle_t {
std::mutex mutex;
std::vector<uint8_t> queue;
QueueHandle_t() {}
QueueHandle_t(const QueueHandle_t &o) {
queue=o.queue;
}
QueueHandle_t &operator=(const QueueHandle_t &o) {
queue=o.queue;
return *this;
}
};
//using QueueHandle_t = std::vector<uint8_t>;
QueueHandle_t xQueueCreate(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize);
BaseType_t xQueueSend(QueueHandle_t &xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait);
BaseType_t xQueueSendFromISR(QueueHandle_t &xQueue, const void * const pvItemToQueue, BaseType_t *xHigherPriorityTaskWoken);
BaseType_t xQueueReceive(QueueHandle_t &xQueue, void * const pvBuffer, TickType_t xTicksToWait );