Control a robot over the internet using UDP and a Ethernet interface.

Dependencies:   EthernetInterface Motor TextLCD mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Embed: (wiki syntax)

« Back to documentation index

Mail< T, queue_sz > Class Template Reference

Mail< T, queue_sz > Class Template Reference

The Mail class allow to control, send, receive, or wait for mail. More...

#include <Mail.h>

Public Member Functions

 Mail ()
 Create and Initialise Mail queue.
T * alloc (uint32_t millisec=0)
 Allocate a memory block of type T.
T * calloc (uint32_t millisec=0)
 Allocate a memory block of type T 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 a queue.
osStatus free (T *mptr)
 Free a memory block from a mail.

Detailed Description

template<typename T, uint32_t queue_sz>
class rtos::Mail< T, queue_sz >

The Mail class allow to control, send, receive, or wait for mail.

A mail is a memory block that is send to a thread or interrupt service routine.

Template Parameters:
Tdata type of a single message element.
queue_szmaximum number of messages in queue.

Definition at line 38 of file Mail.h.


Constructor & Destructor Documentation

Mail (  )

Create and Initialise Mail queue.

Definition at line 41 of file Mail.h.


Member Function Documentation

T* alloc ( uint32_t  millisec = 0 )

Allocate a memory block of type T.

Parameters:
millisectimeout value or 0 in case of no time-out. (default: 0).
Returns:
pointer to memory block that can be filled with mail or NULL in case error.

Definition at line 60 of file Mail.h.

T* calloc ( uint32_t  millisec = 0 )

Allocate a memory block of type T and set memory block to zero.

Parameters:
millisectimeout value or 0 in case of no time-out. (default: 0).
Returns:
pointer to memory block that can be filled with mail or NULL in case error.

Definition at line 68 of file Mail.h.

osStatus free ( T *  mptr )

Free a memory block from a mail.

Parameters:
mptrpointer to the memory block that was obtained with Mail::get.
Returns:
status code that indicates the execution status of the function.

Definition at line 92 of file Mail.h.

osEvent get ( uint32_t  millisec = osWaitForever )

Get a mail from a queue.

Parameters:
millisectimeout value or 0 in case of no time-out. (default: osWaitForever).
Returns:
event that contains mail information or error code.

Definition at line 84 of file Mail.h.

osStatus put ( T *  mptr )

Put a mail in the queue.

Parameters:
mptrmemory block previously allocated with Mail::alloc or Mail::calloc.
Returns:
status code that indicates the execution status of the function.

Definition at line 76 of file Mail.h.