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

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

Static Public Member Functions

static void initialize ()
 
template<typename T >
static void query (uint8_t slaveAddress, uint8_t command, const T &payload, uint8_t responseLength)
 Start a new query with a payload. More...
 
static void query (uint8_t slaveAddress, uint8_t command, const void *payload, uint8_t payloadLength, uint8_t responseLength)
 
static void query (uint8_t slaveAddress, uint8_t command, uint8_t responseLength)
 Start a new query without any payload.
 
static bool isQueryCompleted ()
 
static bool isSuccess ()
 Check if the last query could be performed successfully. More...
 
static uint8_t getErrorCode ()
 Check error code. More...
 
template<typename T >
static const T * getResponse ()
 
static const uint8_t * getResponse ()
 
static void update ()
 

Protected Types

enum  QueryStatus {
  IN_PROGRESS, SUCCESS, ERROR_RESPONSE = 0x40, ERROR_TIMEOUT = 0x41,
  ERROR_PAYLOAD = 0x42
}
 

Static Protected Attributes

static Interface interface
 
static QueryStatus queryStatus
 
static uint8_t expectedResponseLength
 
static modm::ShortTimeout timer
 
static constexpr std::chrono::milliseconds timeout {10}
 timeout value in milliseconds
 

Detailed Description

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

Requires modm::Clock to be implemented.

See also
modm::Clock
Author
Fabian Greif

Member Enumeration Documentation

template<typename Interface >
enum modm::sab::Master::QueryStatus
protected
Enum ValuesDocumentation
IN_PROGRESS 

Query in progress.

SUCCESS 

Response successfully received.

ERROR_RESPONSE 

Error in the received message.

ERROR_TIMEOUT 

No message received within the timeout window.

ERROR_PAYLOAD 

Wrong payload size.

Member Function Documentation

template<typename Interface >
static uint8_t modm::sab::Master< Interface >::getErrorCode ( )
static

Check error code.

Only valid if isQueryCompleted() returns true while isSuccess() returns false.

Returns
Error code
See also
modm::sab::Error
template<typename Interface >
static bool modm::sab::Master< Interface >::isSuccess ( )
static

Check if the last query could be performed successfully.

Only valid if isQueryCompleted() returns true.

Returns
true if the query was successful. Use getResponse() to access the result.
template<typename Interface >
template<typename T >
static void modm::sab::Master< Interface >::query ( uint8_t  slaveAddress,
uint8_t  command,
const T &  payload,
uint8_t  responseLength 
)
static

Start a new query with a payload.

Parameters
slaveAddress
command
payload
responseLengthExpected payload length of the response

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