10#ifndef SEMF_COMMUNICATION_I2CMASTERHARDWARE_H_
11#define SEMF_COMMUNICATION_I2CMASTERHARDWARE_H_
34 Read_BufferSizeIsZero,
52 void write(
const uint8_t data[],
size_t dataSize)
override;
59 void read(uint8_t buffer[],
size_t bufferSize)
override;
66 uint8_t
address()
const override;
122 uint8_t m_address = 0;
124 bool m_isBusy =
false;
128 static constexpr Error::ClassID kSemfClassId = Error::ClassID::I2cMasterHardware;
@ FirstAndLast
start AND stop condition
This interface standardized the read and write interface for synchronous master hardware,...
Class for representing errors. Every error should have a unique source code. As a user feel encourage...
Interface for I2C specific functionalities, which are not solved in a generic way in CommunicationHar...
For using the I2C in master mode.
void setAddress(uint8_t address) override
void write(const uint8_t data[], size_t dataSize) override
For writing data, dataWritten signal will be emitted after successful write.
void setFrame(CommunicationHardware::Frame frame) override
Sets the selected usage of start and stop condition.
virtual void setFrequencyHardware(uint32_t hz)=0
Configures the frequency of the bus.
bool isBusyReading() const override
Communication hardware is busy reading at the moment.
CommunicationHardware::Frame frame() const
Returns the actual frame mode setting.
virtual void checkAddress(uint8_t address)=0
Checks if the given address is available on the bus. Emits address found if successful (ACK)....
uint8_t address() const override
Returns the I2C slave device address.
virtual ~I2cMasterHardware()=default
void onError(Error thrown)
Is called if an error occurred by hardware read or write access. Will emit error signal.
virtual void writeHardware(const uint8_t data[], size_t dataSize)=0
Hardware will write data. After finished write operation, onDataWritten() function will be called.
bool isBusyWriting() const override
Communication hardware is busy writing at the moment.
virtual void readHardware(uint8_t buffer[], size_t bufferSize)=0
Hardware will read data. After finished read operation, onDataAvailable() function will be called.
ErrorCode
Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring...
void setBusy(bool isBusy)
Sets the busy flag.
semf::Signal addressFound
void read(uint8_t buffer[], size_t bufferSize) override
For reading data, dataAvailable signal will be emitted after successful read.
Signal for lightweight signal/slot implementation. One signal can be connected to multiple slots and ...