![]() |
Mbed OS Reference
|
The Mail class allows you to control, send, receive or wait for mail. More...
#include <Mail.h>
Public Member Functions | |
Mail ()=default | |
Create and initialize Mail queue. | |
bool | empty () const |
Check if the mail queue is empty. | |
bool | full () const |
Check if the mail queue is full. | |
T * | alloc (MBED_UNUSED uint32_t millisec=0) |
Allocate a memory block of type T, without blocking. | |
T * | try_alloc () |
Allocate a memory block of type T, without blocking. | |
T * | try_alloc_for (Kernel::Clock::duration_u32 rel_time) |
Allocate a memory block of type T, optionally blocking. | |
T * | alloc_for (uint32_t millisec) |
Allocate a memory block of type T, optionally blocking. | |
T * | try_alloc_until (Kernel::Clock::time_point abs_time) |
Allocate a memory block of type T, blocking. | |
T * | alloc_until (uint64_t millisec) |
Allocate a memory block of type T, blocking. | |
T * | calloc (MBED_UNUSED uint32_t millisec=0) |
Allocate a memory block of type T, and set memory block to zero. | |
T * | try_calloc () |
Allocate a memory block of type T, and set memory block to zero. | |
T * | try_calloc_for (Kernel::Clock::duration_u32 rel_time) |
Allocate a memory block of type T, optionally blocking, and set memory block to zero. | |
T * | calloc_for (uint32_t millisec) |
Allocate a memory block of type T, optionally blocking, and set memory block to zero. | |
T * | try_calloc_until (Kernel::Clock::time_point abs_time) |
Allocate a memory block of type T, blocking, and set memory block to zero. | |
T * | calloc_until (uint64_t millisec) |
Allocate a memory block of type T, blocking, and set memory block to zero. | |
osStatus | put (T *mptr) |
Put a mail in the queue. | |
osEvent | get (uint32_t millisec=osWaitForever) |
Get a mail from the queue. | |
T * | try_get () |
Get a mail from the queue. | |
T * | try_get_for (Kernel::Clock::duration_u32 rel_time) |
Get a mail from the queue. | |
osStatus | free (T *mptr) |
Free a memory block from a mail. | |
The Mail class allows you to control, send, receive or wait for mail.
A mail is a memory block that is sent to a thread or interrupt service routine (ISR).
T | Data type of a single mail message element. |
queue_sz | Maximum number of mail messages in queue. |
|
default |
Create and initialize Mail queue.
bool empty | ( | ) | const |
bool full | ( | ) | const |
T * alloc | ( | MBED_UNUSED uint32_t | millisec = 0 | ) |
Allocate a memory block of type T, without blocking.
millisec | Not used (see note). |
T * try_alloc | ( | ) |
Allocate a memory block of type T, without blocking.
T * try_alloc_for | ( | Kernel::Clock::duration_u32 | rel_time | ) |
Allocate a memory block of type T, optionally blocking.
rel_time | Timeout value, or Kernel::wait_for_u32_forever. |
T * alloc_for | ( | uint32_t | millisec | ) |
Allocate a memory block of type T, optionally blocking.
millisec | Timeout value, or osWaitForever. |
5s
rather than 5000
. T * try_alloc_until | ( | Kernel::Clock::time_point | abs_time | ) |
Allocate a memory block of type T, blocking.
abs_time | Absolute timeout time, referenced to Kernel::Clock. |
T * alloc_until | ( | uint64_t | millisec | ) |
Allocate a memory block of type T, blocking.
millisec | Absolute timeout time, referenced to Kernel::get_ms_count(). |
Kernel::Clock::now() + 5s
rather than Kernel::get_ms_count() + 5000
. T * calloc | ( | MBED_UNUSED uint32_t | millisec = 0 | ) |
Allocate a memory block of type T, and set memory block to zero.
millisec | Not used (see note). |
T * try_calloc | ( | ) |
Allocate a memory block of type T, and set memory block to zero.
T * try_calloc_for | ( | Kernel::Clock::duration_u32 | rel_time | ) |
Allocate a memory block of type T, optionally blocking, and set memory block to zero.
rel_time | Timeout value, or Kernel::wait_for_u32_forever. |
T * calloc_for | ( | uint32_t | millisec | ) |
Allocate a memory block of type T, optionally blocking, and set memory block to zero.
millisec | Timeout value, or osWaitForever. |
5s
rather than 5000
. T * try_calloc_until | ( | Kernel::Clock::time_point | abs_time | ) |
Allocate a memory block of type T, blocking, and set memory block to zero.
abs_time | Absolute timeout time, referenced to Kernel::Clock. |
T * calloc_until | ( | uint64_t | millisec | ) |
Allocate a memory block of type T, blocking, and set memory block to zero.
millisec | Absolute timeout time, referenced to Kernel::get_ms_count(). |
Kernel::Clock::now() + 5s
rather than Kernel::get_ms_count() + 5000
. osStatus put | ( | T * | mptr | ) |
Put a mail in the queue.
mptr | Memory block previously allocated with Mail::alloc or Mail::calloc. |
osEvent get | ( | uint32_t | millisec = osWaitForever | ) |
Get a mail from the queue.
millisec | Timeout value (default: osWaitForever). |
millisec
parameter is set to 0. T * try_get | ( | ) |
T * try_get_for | ( | Kernel::Clock::duration_u32 | rel_time | ) |
Get a mail from the queue.
rel_time | Timeout value or Kernel::wait_for_u32_forever. |
osStatus free | ( | T * | mptr | ) |