17: m_chipSelectPin(&chipSelectPin)
23 SEMF_INFO(
"data %p, dataSize is %u", data, dataSize);
52 SEMF_INFO(
"buffer %p, bufferSize is %u", buffer, bufferSize);
59 if (buffer ==
nullptr && bufferSize != 0)
120 m_transmission = transmission;
164 SEMF_INFO(
"write data %p, read data %p, size is %u", writeData, readBuffer, size);
171 if (writeData ==
nullptr)
177 if (readBuffer ==
nullptr)
207 m_chipSelectPin = &chipSelectPin;
212 if (m_chipSelectPin !=
nullptr)
215 m_chipSelectPin->
reset();
221 if (m_chipSelectPin !=
nullptr)
224 m_chipSelectPin->
set();
262 m_transmission = mode;
@ FirstAndLast
start AND stop condition
@ Next
no start AND no stop condition
@ First
start condition, but no stop condition
Class for representing errors. Every error should have a unique source code. As a user feel encourage...
Interface class for using a GPIO pin of the microcontroller.
@ WriteOnlyWires
CLK and MOSI pins used (no master receive)
@ ReadOnlyWires
CLK and MISO pins used (no master write)
void setWireMode(WireMode mode)
Sets the wire mode.
void setTransmissionMode(TransmissionMode mode)
Sets the transmission mode.
void onError(Error thrown)
Is called if an error occurred by hardware read or write access. Will throw error signal.
CommunicationHardware::Frame frame() const
Returns the actual frame mode setting.
void setFrame(CommunicationHardware::Frame frame) override
Sets the selected usage of start and stop condition.
virtual void stopWriteHardware()=0
bool isBusyWriting() const override
Communication hardware is busy writing at the moment.
virtual void writeHardware(const uint8_t data[], size_t dataSize)=0
Hardware will write data.
virtual void readHardware(uint8_t buffer[], size_t bufferSize)=0
Hardware will read data.
void setBusy(bool isBusy)
Sets the busy flag.
void writeRead(const uint8_t writeData[], uint8_t readBuffer[], size_t size) override
For writing and reading data parallel through the communication hardware 1) For interrupt or one shot...
bool isBusyReading() const override
Communication hardware is busy reading at the moment.
@ WriteRead_ReadBufferIsNullptr
@ SetChipSelectPin_IsBusy
@ WriteRead_WriteDataIsNullptr
void write(const uint8_t data[], size_t dataSize) override
For writing data, dataWritten signal will be emitted after successful write.
virtual void writeReadHardware(const uint8_t writeData[], uint8_t readBuffer[], size_t size)=0
Hardware will read and write data parallel.
SpiMasterHardware()=default
virtual void setFormatHardware(uint8_t bits, TransmissionMode transmission, WireMode wire)=0
Configures the hardware for insuring the given configuration.
virtual void stopReadHardware()=0
void setFormat(uint8_t bits, TransmissionMode transmission, WireMode wire) override
Sets the format for the spi slave device.
void read(uint8_t buffer[], size_t bufferSize) override
For reading data, dataAvailable signal will be emitted after successful read.
void stopWrite() override
virtual void setChipSelectPin(Gpio &chipSelectPin)
Sets a new chip select pin read and write operations.
#define SEMF_WARNING(...)