mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
* SdCard HAL refactored (#135) - Refactor SdCard HAL - introduce Lockable * Screenshot and FatFS improvements (#136) - Fix screenshots on ESP32 - Improve Screenshot service - Convert Screenshot app to class-based instead of structs - Screenshot app now automatically updates when task is finished - Enable FatFS long filename support * Re-use common log messages (#138) For consistency and binary size reduction * Toolbar spinner should get margin to the right * More TactilityC features (#139) * Rewrote Loader - Simplified Loader by removing custom threa - Created DispatcherThread - Move auto-starting apps to Boot app - Fixed Dispatcher bug where it could get stuck not processing new messages * Hide AP settings if the AP is not saved * Missing from previous commit * Replace LV_EVENT_CLICKED with LV_EVENT_SHORT_CLICKED * Refactored files app and created InputDialog (#140) - Changed Files app so that it has a View and State - Files app now allows for long-pressing on files to perform actions - Files app now has rename and delete actions - Created InputDialog app - Improved AlertDialog app layout
80 lines
1.9 KiB
C++
80 lines
1.9 KiB
C++
/**
|
|
* @file MessageQueue.h
|
|
*
|
|
* MessageQueue is a wrapper for FreeRTOS xQueue functionality.
|
|
* There is no additional thread-safety on top of the xQueue functionality,
|
|
* so make sure you create a lock if needed.
|
|
*/
|
|
#pragma once
|
|
|
|
#include "CoreTypes.h"
|
|
|
|
#ifdef ESP_PLATFORM
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/queue.h"
|
|
#else
|
|
#include "FreeRTOS.h"
|
|
#include "queue.h"
|
|
#endif
|
|
|
|
namespace tt {
|
|
|
|
/**
|
|
* Message Queue implementation.
|
|
* Calls can be done from ISR/IRQ mode unless otherwise specified.
|
|
*/
|
|
class MessageQueue {
|
|
private:
|
|
QueueHandle_t queue_handle;
|
|
|
|
public:
|
|
/** Allocate message queue
|
|
* @param[in] capacity Maximum messages in queue
|
|
* @param[in] messageSize The size in bytes of a single message
|
|
*/
|
|
MessageQueue(uint32_t capacity, uint32_t messageSize);
|
|
|
|
~MessageQueue();
|
|
|
|
/** Put message into queue
|
|
* @param[in] message A pointer to a message. The message will be copied into a buffer.
|
|
* @param[in] timeoutTicks
|
|
* @return success result
|
|
*/
|
|
bool put(const void* message, uint32_t timeoutTicks);
|
|
|
|
/** Get message from queue
|
|
* @param message A pointer to an already allocated message object
|
|
* @param[in] timeoutTicks
|
|
* @return success result
|
|
*/
|
|
bool get(void* message, uint32_t timeoutTicks);
|
|
|
|
/**
|
|
* @return The maximum amount of messages that can be in the queue at any given time.
|
|
*/
|
|
uint32_t getCapacity() const;
|
|
|
|
/**
|
|
* @return The size of a single message in bytes
|
|
*/
|
|
uint32_t getMessageSize() const;
|
|
|
|
/**
|
|
* @return How many messages are currently in the queue.
|
|
*/
|
|
uint32_t getCount() const;
|
|
|
|
/**
|
|
* @return How many messages can be added to the queue before the put() method starts blocking.
|
|
*/
|
|
uint32_t getSpace() const;
|
|
|
|
/** Reset queue (cannot be called in ISR/IRQ mode)
|
|
* @return success result
|
|
*/
|
|
bool reset();
|
|
};
|
|
|
|
} // namespace
|