GM6000 Digital Heater Controller Branch: main
SDX-1330
List of all members | Public Member Functions
Driver::SPI::Master Class Referenceabstract

This class defines a non-platform specific interface for an SPI master device driver. More...

Detailed Description

This class defines a non-platform specific interface for an SPI master device driver.

The intended usage is to create ONE driver per physical SPI bus, i.e. the driver instance can be shared with multiple clients.

The class does NOT manage the chip/slave select signal, i.e. the client is responsible for asserting and de-asserting the chip/slave select before and after a transaction.

The driver is NOT thread safe. It is the responsibility of the Application to ensure thread safety when driver is used and/or shared with multiple clients.

#include <Master.h>

Inheritance diagram for Driver::SPI::Master:
[legend]

Public Member Functions

virtual bool start (size_t newBaudRateHz=0) noexcept=0
 This method is used initialize/start the driver.
 
virtual void stop () noexcept=0
 This method is used to stop/shutdown the driver.
 
virtual bool transfer (size_t numBytes, const void *srcData, void *dstData=nullptr) noexcept=0
 This method writes 'numBytes' and reads 'numBytes' to/from the peripheral device.
 
virtual ~Master ()
 Virtual destructor.
 

Constructor & Destructor Documentation

◆ ~Master()

virtual Driver::SPI::Master::~Master ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ start()

virtual bool Driver::SPI::Master::start ( size_t  newBaudRateHz = 0)
pure virtualnoexcept

This method is used initialize/start the driver.

To 'restart' the driver, the application must call stop(), then start().

When 'newBaudRateHz' is non-zero, the SPI's transfer frequency is updated (from what was provided in the constructor). When the driver is stopped and restarted, the default baudrate on restart will be the value provided in the constructor.

The method returns true if successful; else false is returned when an error occurred. If false is returned, future read/write calls will always return a failure.

Implemented in Driver::SPI::Arduino::Master, and Driver::SPI::STM32::Master.

◆ stop()

virtual void Driver::SPI::Master::stop ( )
pure virtualnoexcept

This method is used to stop/shutdown the driver.

Implemented in Driver::SPI::Arduino::Master, and Driver::SPI::STM32::Master.

◆ transfer()

virtual bool Driver::SPI::Master::transfer ( size_t  numBytes,
const void *  srcData,
void *  dstData = nullptr 
)
pure virtualnoexcept

This method writes 'numBytes' and reads 'numBytes' to/from the peripheral device.

The buffer pointed to by 'dstData' must be at least 'numBytes' in size. If 'dstData' is nullptr, then the incoming bytes are NOT copied.

Returns true if successful; else false is returned.

Implemented in Driver::SPI::Arduino::Master, and Driver::SPI::STM32::Master.


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