Initial integration with rmt (only wifi works rn)

This commit is contained in:
2025-07-12 22:45:57 -04:00
parent 6d2d646a0f
commit a6b8b57a3b
19 changed files with 412 additions and 56 deletions

View File

@@ -0,0 +1,43 @@
//
// Created by Johnathon Slightham on 2025-07-12.
//
#ifndef PTRQUEUE_H
#define PTRQUEUE_H
#include <memory>
#include <iostream>
// Wrapped FreeRTOS queue to support unique_ptr
template <typename T>
class PtrQueue {
public:
explicit PtrQueue(UBaseType_t queueLength)
: queue(xQueueCreate(queueLength, sizeof(T*))) {}
~PtrQueue() {
if (queue) {
vQueueDelete(queue);
}
}
bool enqueue(std::unique_ptr<T>&& item, const TickType_t timeout = portMAX_DELAY) {
T* rawPtr = item.release(); // Release ownership and get raw pointer
return xQueueSendToBack(queue, &rawPtr, timeout) == pdPASS;
}
std::unique_ptr<T> dequeue(const TickType_t timeout = portMAX_DELAY) {
T* rawPtr = nullptr;
if (xQueueReceive(queue, &rawPtr, timeout) == pdPASS) {
std::unique_ptr<T> ptr(rawPtr);
return ptr;
}
return nullptr;
}
private:
QueueHandle_t queue;
};
#endif //PTRQUEUE_H