semf
semf::CommunicationHardware Class Referenceabstract

This interface standardized the read and write interface between the communication hardware like CAN, SPI and all protocols. More...

#include <communicationhardware.h>

Inheritance diagram for semf::CommunicationHardware:
Inheritance graph
Collaboration diagram for semf::CommunicationHardware:
Collaboration graph

Public Types

enum class  Type { SynchronousMaster = 1 , SynchronousSlave , Asynchronous }
 
enum class  Frame : uint8_t { First = 0x01 , Next = 0x08 , Last = 0x10 , FirstAndLast = 0x11 }
 

Public Member Functions

virtual ~CommunicationHardware ()=default
 
virtual void init ()=0
 
virtual void deinit ()=0
 
virtual Type type () const =0
 Returns the hardware type. More...
 
virtual void setFrame (Frame frame)=0
 Sets the selected usage of start and stop condition. More...
 
- Public Member Functions inherited from semf::app::Communication
virtual ~Communication ()=default
 
virtual void write (const uint8_t data[], size_t dataSize)=0
 For writing data, dataWritten signal will be emitted after successful write. More...
 
virtual void read (uint8_t buffer[], size_t bufferSize)=0
 For reading data, dataAvailable signal will be emitted after successful read. More...
 
virtual void stopRead ()=0
 
virtual void stopWrite ()=0
 
virtual bool isBusyReading () const =0
 Communication hardware is busy reading at the moment. More...
 
virtual bool isBusyWriting () const =0
 Communication hardware is busy writing at the moment. More...
 

Additional Inherited Members

- Public Attributes inherited from semf::app::Communication
Signal dataWritten
 
Signal dataAvailable
 
Signal writeStopped
 
Signal readStopped
 
Signal< Errorerror
 

Detailed Description

This interface standardized the read and write interface between the communication hardware like CAN, SPI and all protocols.

Definition at line 22 of file communicationhardware.h.

Member Enumeration Documentation

◆ Frame

enum class semf::CommunicationHardware::Frame : uint8_t
strong

Frame Modes (used e.g. in SPI and I2C)

Enumerator
First 

start condition, but no stop condition

Next 

no start AND no stop condition

Last 

stop condition

FirstAndLast 

start AND stop condition

Definition at line 33 of file communicationhardware.h.

◆ Type

To identify the hardware type in higher classes like protocols.

Enumerator
SynchronousMaster 

Synchronous master like I2cMasterHardware or SpiMasterHardware.

SynchronousSlave 

Synchronous slave like I2cSlaveHardware or SpiSlaveHardware.

Asynchronous 

Asynchronous interface like UartHardware.

Definition at line 26 of file communicationhardware.h.

Constructor & Destructor Documentation

◆ ~CommunicationHardware()

virtual semf::CommunicationHardware::~CommunicationHardware ( )
virtualdefault

Member Function Documentation

◆ deinit()

virtual void semf::CommunicationHardware::deinit ( )
pure virtual

Deinitializes the hardware

Implemented in semf::SoftI2cMaster, semf::Stm32Can, semf::Stm32I2cMaster, semf::Stm32I2cSlave, semf::Stm32SpiMaster, semf::Stm32SpiSlave, and semf::Stm32Uart.

Here is the caller graph for this function:

◆ init()

virtual void semf::CommunicationHardware::init ( )
pure virtual

Initializes the hardware.

Implemented in semf::SoftI2cMaster, semf::Stm32Can, semf::Stm32I2cMaster, semf::Stm32I2cSlave, semf::Stm32SpiMaster, semf::Stm32SpiSlave, and semf::Stm32Uart.

Here is the caller graph for this function:

◆ setFrame()

virtual void semf::CommunicationHardware::setFrame ( Frame  frame)
pure virtual

Sets the selected usage of start and stop condition.

Parameters
frameframe mode

Implemented in semf::I2cMasterHardware, semf::I2cSlaveHardware, semf::SpiMasterHardware, semf::CommunicationHardwareAsynchronous, and semf::SpiSlaveHardware.

◆ type()

virtual Type semf::CommunicationHardware::type ( ) const
pure virtual