modm API documentation
modm::sab::Interface< Device > Class Template Reference

SAB interface. More...

#include <modm/communication/sab/interface.hpp>

Static Public Member Functions

static void initialize ()
 Initialize the interface. More...
 
static void sendMessage (uint8_t address, Flags flags, uint8_t command, const void *payload, uint8_t payloadLength)
 Send a message. More...
 
template<typename T >
static void sendMessage (uint8_t address, Flags flags, uint8_t command, const T &payload)
 Send a message.
 
static void sendMessage (uint8_t address, Flags flags, uint8_t command)
 Send a empty message.
 
static bool isMessageAvailable ()
 Check if a message was received. More...
 
static uint8_t getAddress ()
 
static uint8_t getCommand ()
 
static bool isResponse ()
 
static bool isAcknowledge ()
 Check if the message is an ACK or NACK. More...
 
static const uint8_t * getPayload ()
 Access the data of a received message. More...
 
static uint8_t getPayloadLength ()
 
static void dropMessage ()
 End processing of the current message.
 
static void update ()
 Update internal status. More...
 

Detailed Description

template<typename Device>
class modm::sab::Interface< Device >

SAB interface.

Example:

Author
Fabian Greif

Member Function Documentation

template<typename Device >
static const uint8_t* modm::sab::Interface< Device >::getPayload ( )
inlinestatic

Access the data of a received message.

Data access is only valid after isMessageAvailable() returns true and before any call of dropMessage() or update()

template<typename Device >
static uint8_t modm::sab::Interface< Device >::getPayloadLength ( )
inlinestatic
Returns
Size of the received message. Zero if no message is available at the moment.
template<typename Device >
static void modm::sab::Interface< Device >::initialize ( )
static

Initialize the interface.

The UART has the be configured before calling this method.

template<typename Device >
static bool modm::sab::Interface< Device >::isAcknowledge ( )
inlinestatic

Check if the message is an ACK or NACK.

Returns
true if the message is an ACK, false on NACK.
template<typename Device >
static bool modm::sab::Interface< Device >::isMessageAvailable ( )
inlinestatic

Check if a message was received.

Reset the status with a call of dropMessage().

template<typename Device >
static void modm::sab::Interface< Device >::sendMessage ( uint8_t  address,
Flags  flags,
uint8_t  command,
const void *  payload,
uint8_t  payloadLength 
)
static

Send a message.

Parameters
addressreceiver address
flagssee modm::sab::Flags
commandcommand byte
*payloaddata field
payloadLengthsize of the data field
template<typename Device >
static void modm::sab::Interface< Device >::update ( )
static

Update internal status.

Has to be called periodically. Encodes received messages.


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