A Mailbox that can be used in an freertos task to receive fixed size messages.
More...
#include <Imt.Base.OS.FreeRTOS/Mailbox.h>
template<typename MessageType, const size_t MailboxSize>
class imt::base::os::freertos::Mailbox< MessageType, MailboxSize >
A Mailbox that can be used in an freertos task to receive fixed size messages.
See https://www.freertos.org/Embedded-RTOS-Queues.html for more informations on queues.
This template is used to create a mailbox of the required size in the context of the task.
◆ Mailbox()
template<typename MessageType , const size_t MailboxSize>
Constructor.
- Parameters
-
pHandle | The OS handle for the mailbox. |
pQueueInfo | The internal queue structure to allocate static queues. |
◆ ~Mailbox()
template<typename MessageType , const size_t MailboxSize>
◆ clear()
template<typename MessageType , const size_t MailboxSize>
Removes all messages from the mailbox.
◆ deinitialize()
template<typename MessageType , const size_t MailboxSize>
◆ getMail()
template<typename MessageType , const size_t MailboxSize>
Gets the next message from the mailbox.
This removes the message from the mailbox. If the mailbox is empty the task will be suspended until the mailbox contains a message.
- Returns
- The received message.
◆ getMailConditional()
template<typename MessageType , const size_t MailboxSize>
Gets the next message from the mailbox.
This removes the message from the mailbox. If the mailbox is empty the method will return false but not suspend the task.
- Parameters
-
- Returns
- False if there is no message, true if there is one.
◆ getWaitingMails()
template<typename MessageType , const size_t MailboxSize>
Gets the number of mails in this mailbox.
- Returns
- The number of mail
◆ initialize()
template<typename MessageType , const size_t MailboxSize>
Init the mailbox.
Must be called before using any other method.
◆ putMail()
template<typename MessageType , const size_t MailboxSize>
Adds a message to the mailbox.
This can be used from any task. If the mailbox is full the task will be suspended until the mailbox can hold the new message. The data is copied.
- Parameters
-
message | The message to put into the mailbox |
◆ putMailConditional()
template<typename MessageType , const size_t MailboxSize>
Adds a message to the mailbox.
This can be used from any task or interrupt handler. If the mailbox is full the mthod returns false but task will not be suspended. The data is copied.
- Parameters
-
message | The message to put into the mailbox. |
- Returns
- False if there is no space left for the message, true otherwise.
The documentation for this class was generated from the following file:
- D:/_Work/10/s/Imt.Base/Imt.Base.OS.FreeRTOS/Mailbox.h