AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
A driver for (synchronous) SPI communication on ESP platforms. More...
#include <spi_interface_esp.hpp>
Public Member Functions | |
SPIInterfaceESP (const spi_device_interface_config_t *deviceConfig, const spi_host_device_t hostDevice) | |
Constructor of a SPI device on an ESP platform. | |
virtual | ~SPIInterfaceESP () |
Destructor of a SPI device on an ESP platform. | |
bool | init () |
Initialize the SPI device. | |
void | deinit () |
Deinitialize the SPI device. | |
void | transmit (SPITransactionFrame *frame) override |
Write (and read) a frame to the SPI bus. | |
bool | end_transaction () override |
End the transaction. This function returns the status since the last end_transaction(). | |
Public Member Functions inherited from isobus::SPIHardwarePlugin | |
virtual void | begin_transaction () |
Begin a transaction on the SPI bus. This should be called before any of the read/write operations. | |
Static Public Attributes | |
static constexpr std::uint32_t | MAX_TIME_TO_WAIT = 5000 / portTICK_PERIOD_MS |
timeout of 5 seconds for spi related calls, mostly arbitrary. | |
Private Attributes | |
const spi_device_interface_config_t * | deviceConfig |
The configuration of the SPI device. | |
const spi_host_device_t | hostDevice |
The host spi device. | |
const SemaphoreHandle_t | spiMutex |
A mutex to prevent concurrent access to the SPI bus. | |
spi_device_handle_t | spiDevice |
A handle to the SPI device. | |
bool | initialized |
The status of the device. | |
bool | success |
The status of the current transaction. | |
A driver for (synchronous) SPI communication on ESP platforms.
Definition at line 26 of file spi_interface_esp.hpp.
isobus::SPIInterfaceESP::SPIInterfaceESP | ( | const spi_device_interface_config_t * | deviceConfig, |
const spi_host_device_t | hostDevice ) |
Constructor of a SPI device on an ESP platform.
deviceConfig | A pointer to the configuration of the SPI device |
hostDevice | The host device of the SPI device, e.g. SPI2_HOST |
Definition at line 18 of file spi_interface_esp.cpp.
|
virtual |
Destructor of a SPI device on an ESP platform.
Definition at line 25 of file spi_interface_esp.cpp.
void isobus::SPIInterfaceESP::deinit | ( | ) |
Deinitialize the SPI device.
Definition at line 46 of file spi_interface_esp.cpp.
|
overridevirtual |
End the transaction. This function returns the status since the last end_transaction().
Implements isobus::SPIHardwarePlugin.
Definition at line 101 of file spi_interface_esp.cpp.
bool isobus::SPIInterfaceESP::init | ( | ) |
Initialize the SPI device.
Definition at line 31 of file spi_interface_esp.cpp.
|
overridevirtual |
Write (and read) a frame to the SPI bus.
[in,out] | frame | A reference to the frame to transmit/receive |
Implements isobus::SPIHardwarePlugin.
Definition at line 59 of file spi_interface_esp.cpp.
|
private |
The configuration of the SPI device.
Definition at line 55 of file spi_interface_esp.hpp.
|
private |
The host spi device.
Definition at line 56 of file spi_interface_esp.hpp.
|
private |
The status of the device.
Definition at line 59 of file spi_interface_esp.hpp.
|
staticconstexpr |
timeout of 5 seconds for spi related calls, mostly arbitrary.
Definition at line 29 of file spi_interface_esp.hpp.
|
private |
A handle to the SPI device.
Definition at line 58 of file spi_interface_esp.hpp.
|
private |
A mutex to prevent concurrent access to the SPI bus.
Definition at line 57 of file spi_interface_esp.hpp.
|
private |
The status of the current transaction.
Definition at line 60 of file spi_interface_esp.hpp.