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

SAB Slave. More...

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

Inheritance diagram for modm::sab::Slave< Interface >:
modm::sab::Transmitter

Public Member Functions

 Slave (uint8_t address, modm::accessor::Flash< Action > list, uint8_t count)
 Initialize the slave. More...
 
void update ()
 Receive and process messages. More...
 

Protected Member Functions

void send (bool acknowledge, const void *payload, std::size_t payloadLength)
 

Protected Attributes

uint8_t ownAddress
 
modm::accessor::Flash< ActionactionList
 
uint8_t actionCount
 
uint8_t currentCommand
 
Response response
 

Detailed Description

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

SAB Slave.

{
SAB_ACTION(0x57, object, Object::method1, 0),
SAB_ACTION(0x03, object, Object::method2, 2),
};
int
main()
{
// initialize the interface
Slave slave(0x02,
sizeof(actionList) / sizeof(modm::sab::Action));
while (true)
{
slave.update();
}
}

A complete example is available in the example/sab folder.

Author
Fabian Greif

Constructor & Destructor Documentation

template<typename Interface >
modm::sab::Slave< Interface >::Slave ( uint8_t  address,
modm::accessor::Flash< Action list,
uint8_t  count 
)

Initialize the slave.

Parameters
addressOwn address
listList of all action callbacks, need to be stored in flash-memory
countNumber of entries in actionList
See also
sab::modm::Action
SAB_ACTION()

Member Function Documentation

template<typename Interface >
void modm::sab::Slave< Interface >::update ( )

Receive and process messages.

This method will decode the incoming messages and call the corresponding callback methods from the action list. It must be called periodically, best in every main loop cycle.


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