AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
isobus::SPIInterfaceESP Class Reference

A driver for (synchronous) SPI communication on ESP platforms. More...

#include <spi_interface_esp.hpp>

Inheritance diagram for isobus::SPIInterfaceESP:
[legend]
Collaboration diagram for isobus::SPIInterfaceESP:
[legend]

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.
 

Detailed Description

A driver for (synchronous) SPI communication on ESP platforms.

Definition at line 26 of file spi_interface_esp.hpp.

Constructor & Destructor Documentation

◆ SPIInterfaceESP()

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.

Parameters
deviceConfigA pointer to the configuration of the SPI device
hostDeviceThe host device of the SPI device, e.g. SPI2_HOST

Definition at line 18 of file spi_interface_esp.cpp.

◆ ~SPIInterfaceESP()

isobus::SPIInterfaceESP::~SPIInterfaceESP ( )
virtual

Destructor of a SPI device on an ESP platform.

Definition at line 25 of file spi_interface_esp.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ deinit()

void isobus::SPIInterfaceESP::deinit ( )

Deinitialize the SPI device.

Definition at line 46 of file spi_interface_esp.cpp.

Here is the caller graph for this function:

◆ end_transaction()

bool isobus::SPIInterfaceESP::end_transaction ( )
overridevirtual

End the transaction. This function returns the status since the last end_transaction().

Returns
True if the transaction was successful, false otherwise

Implements isobus::SPIHardwarePlugin.

Definition at line 101 of file spi_interface_esp.cpp.

◆ init()

bool isobus::SPIInterfaceESP::init ( )

Initialize the SPI device.

Returns
True if the initialization was successful, false otherwise

Definition at line 31 of file spi_interface_esp.cpp.

◆ transmit()

void isobus::SPIInterfaceESP::transmit ( SPITransactionFrame * frame)
overridevirtual

Write (and read) a frame to the SPI bus.

Parameters
[in,out]frameA reference to the frame to transmit/receive

Implements isobus::SPIHardwarePlugin.

Definition at line 59 of file spi_interface_esp.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ deviceConfig

const spi_device_interface_config_t* isobus::SPIInterfaceESP::deviceConfig
private

The configuration of the SPI device.

Definition at line 55 of file spi_interface_esp.hpp.

◆ hostDevice

const spi_host_device_t isobus::SPIInterfaceESP::hostDevice
private

The host spi device.

Definition at line 56 of file spi_interface_esp.hpp.

◆ initialized

bool isobus::SPIInterfaceESP::initialized
private

The status of the device.

Definition at line 59 of file spi_interface_esp.hpp.

◆ MAX_TIME_TO_WAIT

constexpr std::uint32_t isobus::SPIInterfaceESP::MAX_TIME_TO_WAIT = 5000 / portTICK_PERIOD_MS
staticconstexpr

timeout of 5 seconds for spi related calls, mostly arbitrary.

Definition at line 29 of file spi_interface_esp.hpp.

◆ spiDevice

spi_device_handle_t isobus::SPIInterfaceESP::spiDevice
private

A handle to the SPI device.

Definition at line 58 of file spi_interface_esp.hpp.

◆ spiMutex

const SemaphoreHandle_t isobus::SPIInterfaceESP::spiMutex
private

A mutex to prevent concurrent access to the SPI bus.

Definition at line 57 of file spi_interface_esp.hpp.

◆ success

bool isobus::SPIInterfaceESP::success
private

The status of the current transaction.

Definition at line 60 of file spi_interface_esp.hpp.


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