Manages a specific SPI device instance attached to a controller. More...

#include <Device.h>

Inheritance diagram for HSPI::Device:
Collaboration diagram for HSPI::Device:

Public Member Functions

 Device (Controller &controller)
 
virtual ~Device ()
 
bool begin (PinSet pinSet, uint8_t chipSelect, uint32_t clockSpeed)
 Register device with controller and prepare for action. More...
 
void end ()
 
bool isReady () const
 Determine if the device is initialised. More...
 
PinSet getPinSet () const
 
uint8_t getChipSelect () const
 
uint32_t getSpeed () const
 
void setBitOrder (BitOrder bitOrder)
 
BitOrder getBitOrder () const
 
void setClockMode (ClockMode mode)
 
ClockMode getClockMode () const
 
virtual IoModes getSupportedIoModes () const =0
 Return set of IO modes supported by a device implementation. More...
 
bool isSupported (IoMode mode) const
 Determine if the device/controller combination supports an IO mode Must be called after begin() as other settings (e.g. pinset) can affect support. More...
 
virtual bool setIoMode (IoMode mode)
 
IoMode getIoMode () const
 
size_t getBitsPerClock () const
 
void execute (Request &request)
 
void onTransfer (Callback callback)
 Set a callback to be invoked before a request is started, and when it has finished. More...
 
void wait (Request &request)
 

Public Attributes

Controllercontroller
 

Protected Member Functions

void transferStarting (Request &request)
 
bool transferComplete (Request &request)
 

Protected Attributes

friend Controller
 

Detailed Description

Manages a specific SPI device instance attached to a controller.

Constructor & Destructor Documentation

◆ Device()

HSPI::Device::Device ( Controller controller)
inline

◆ ~Device()

virtual HSPI::Device::~Device ( )
inlinevirtual

Member Function Documentation

◆ begin()

bool HSPI::Device::begin ( PinSet  pinSet,
uint8_t  chipSelect,
uint32_t  clockSpeed 
)
inline

Register device with controller and prepare for action.

Parameters
pinSetUse PinSet::normal for Esp32, other values for Esp8266
chipSelectIdentifies the CS number for ESP8266, or the GPIO pin for ESP32
clockSpeedBus speed

◆ end()

void HSPI::Device::end ( )
inline

◆ execute()

void HSPI::Device::execute ( Request request)
inline

◆ getBitOrder()

BitOrder HSPI::Device::getBitOrder ( ) const
inline

◆ getBitsPerClock()

size_t HSPI::Device::getBitsPerClock ( ) const
inline

◆ getChipSelect()

uint8_t HSPI::Device::getChipSelect ( ) const
inline

◆ getClockMode()

ClockMode HSPI::Device::getClockMode ( ) const
inline

◆ getIoMode()

IoMode HSPI::Device::getIoMode ( ) const
inline

◆ getPinSet()

PinSet HSPI::Device::getPinSet ( ) const
inline

◆ getSpeed()

uint32_t HSPI::Device::getSpeed ( ) const
inline

◆ getSupportedIoModes()

virtual IoModes HSPI::Device::getSupportedIoModes ( ) const
pure virtual

Return set of IO modes supported by a device implementation.

Implemented in HSPI::RAM::PSRAM64, HSPI::RAM::IS62_65, and Graphics::SpiDisplay.

◆ isReady()

bool HSPI::Device::isReady ( ) const
inline

Determine if the device is initialised.

Return values
bool

◆ isSupported()

bool HSPI::Device::isSupported ( IoMode  mode) const
inline

Determine if the device/controller combination supports an IO mode Must be called after begin() as other settings (e.g. pinset) can affect support.

◆ onTransfer()

void HSPI::Device::onTransfer ( Callback  callback)
inline

Set a callback to be invoked before a request is started, and when it has finished.

Parameters
callbackInvoked in interrupt context, MUST be in IRAM

◆ setBitOrder()

void HSPI::Device::setBitOrder ( BitOrder  bitOrder)
inline

◆ setClockMode()

void HSPI::Device::setClockMode ( ClockMode  mode)
inline

◆ setIoMode()

virtual bool HSPI::Device::setIoMode ( IoMode  mode)
inlinevirtual

Reimplemented in HSPI::RAM::PSRAM64, and HSPI::RAM::IS62_65.

◆ transferComplete()

bool HSPI::Device::transferComplete ( Request request)
inlineprotected

◆ transferStarting()

void HSPI::Device::transferStarting ( Request request)
inlineprotected

◆ wait()

void HSPI::Device::wait ( Request request)
inline

Member Data Documentation

◆ controller

Controller& HSPI::Device::controller

◆ Controller

friend HSPI::Device::Controller
protected

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