Arduino-Scheduler
Portable Collaborative Multi-Tasking Scheduler for Arduino
Channel Class Reference

#include <Channel.h>

Collaboration diagram for Channel:
Collaboration graph

Public Member Functions

 Channel ()
 
int send (const void *buf, size_t size)
 
int recv (void *buf, size_t size)
 

Protected Attributes

void * m_buf
 Message buffer. More...
 
volatile size_t m_max
 Max message size. More...
 
volatile size_t m_size
 Actual message size. More...
 
volatile uint8_t m_ticket
 Sender ticket. More...
 
volatile uint8_t m_serving
 Next sender ticket. More...
 

Detailed Description

Definition at line 24 of file Channel.h.

Constructor & Destructor Documentation

Channel::Channel ( )
inline

Initiate channel for message passing between tasks.

Definition at line 29 of file Channel.h.

Member Function Documentation

int Channel::recv ( void *  buf,
size_t  size 
)
inline

Receive message from channel. Wait for sender task to copy message into given receive buffer. Returns received message size.

Parameters
[in]bufmessage buffer.
[in]sizemessage size.
Returns
received message size.

Definition at line 71 of file Channel.h.

int Channel::send ( const void *  buf,
size_t  size 
)
inline

Send given message, buffer and size, to receiving task. Wait until receiver task is ready before copying message to receiver buffer. Multiple senders will queue in order. Returns message size if successful otherwise negative error code.

Parameters
[in]bufmessage buffer.
[in]sizemessage size.
Returns
message size or negative error code.

Definition at line 46 of file Channel.h.

Member Data Documentation

void* Channel::m_buf
protected

Message buffer.

Definition at line 92 of file Channel.h.

volatile size_t Channel::m_max
protected

Max message size.

Definition at line 93 of file Channel.h.

volatile uint8_t Channel::m_serving
protected

Next sender ticket.

Definition at line 96 of file Channel.h.

volatile size_t Channel::m_size
protected

Actual message size.

Definition at line 94 of file Channel.h.

volatile uint8_t Channel::m_ticket
protected

Sender ticket.

Definition at line 95 of file Channel.h.


The documentation for this class was generated from the following file: