Display list for hardware SPI devices. More...

#include <SpiDisplayList.h>

Inheritance diagram for Graphics::SpiDisplayList:
Collaboration diagram for Graphics::SpiDisplayList:

Classes

struct  Commands
 Commonly-used display-specific command codes. More...
 

Public Member Functions

template<typename... Params>
 SpiDisplayList (const Commands &commands, Params &&... params)
 
bool isBusy () const
 
bool fillRequest ()
 Called from interrupt context to re-fill the SPI request packet. More...
 
void prepare (Callback callback, void *param)
 
- Public Member Functions inherited from Graphics::DisplayList
 DisplayList (AddressWindow &addrWindow, size_t bufferSize)
 
 DisplayList (AddressWindow &addrWindow, const FSTR::ObjectBase &data)
 Create pre-defined display list from flash data. More...
 
 DisplayList (AddressWindow &addrWindow, const void *data, size_t length)
 Create initialised display list from RAM data. More...
 
void reset ()
 Reset the display list ready for re-use List MUST NOT be in use! More...
 
bool isEmpty () const
 Determine if any commands have been stored for execution. More...
 
uint16_t freeSpace () const
 Get number of bytes remaining in buffer. More...
 
uint16_t readOffset () const
 Get current read position. More...
 
uint16_t used () const
 Get number of bytes stored in buffer. More...
 
const uint8_tgetContent () const
 Get read-only pointer to start of buffer. More...
 
uint8_tgetBuffer (uint16_t &available)
 Get some space in the list to write pixel data. More...
 
uint8_tgetBuffer (uint16_t minBytes, uint16_t &available)
 Get some space in the list to write pixel data. More...
 
void commit (uint16_t length)
 Commit block of data to the list. More...
 
bool writeCommand (uint8_t command, uint32_t data, uint8_t length)
 Write command with 1-4 bytes of parameter data. More...
 
bool writeCommand (uint8_t command, const void *data, uint16_t length)
 Write command with variable amount of parameter data. More...
 
bool writeData (const void *data, uint16_t length)
 Add WRITE command plus data. More...
 
bool writeDataBuffer (SharedBuffer &data, size_t offset, uint16_t length)
 Add WRITE command plus external data. More...
 
bool blockFill (const void *data, uint16_t length, uint32_t repeat)
 Perform a block fill operation with repeat, e.g. multiple pixel fill or repeated pattern. More...
 
bool setAddrWindow (const Rect &rect)
 Set window for read/write operations. More...
 
bool setPixel (PackedColor color, uint8_t bytesPerPixel, Point pt)
 Set a single pixel. More...
 
bool readMem (void *buffer, uint16_t length)
 Read a block of display memory. More...
 
bool writeCallback (Callback callback, void *params, uint16_t paramLength)
 Request a callback. More...
 
bool fill (const Rect &rect, PackedColor color, uint8_t bytesPerPixel, FillInfo::Callback callback)
 Perform a block fill operation with blending. More...
 
bool canLockBuffer ()
 Enforce maximum number of locked buffers to conserve memory. More...
 
bool lockBuffer (SharedBuffer &buffer)
 Lock a shared buffer by storing a reference to it. This will be released when reset() is called. More...
 
bool require (uint16_t length)
 Check if list has space for the given number of bytes. More...
 
bool readEntry (Entry &info)
 Read next command list entry. More...
 
void prepare (Callback callback, void *param)
 Prepare for playback. More...
 

Public Attributes

HSPI::Request request
 The HSPI request packet used by this list. More...
 

Static Protected Member Functions

static bool staticRequestCallback (HSPI::Request &request)
 

Protected Attributes

const Commandscommands
 
uint16_t datalen {0}
 Size of data at current position. More...
 
uint16_t repeats {0}
 How many remaining repeats for this data block. More...
 
Code code {}
 Command being executed. More...
 
uint8_t repeatBuffer [64]
 Buffer to fill out small repeated data chunks. More...
 
- Protected Attributes inherited from Graphics::DisplayList
Callback callback {nullptr}
 
void * param {nullptr}
 
std::unique_ptr< uint8_t[]> buffer
 
uint16_t size {0}
 Number of bytes stored in buffer. More...
 
uint16_t offset {0}
 Current read position. More...
 

Additional Inherited Members

- Public Types inherited from Graphics::DisplayList
enum  Code : uint8_t { XX }
 
enum  CodeArgLengths : uint8_t { XX }
 Obtain maximum size for command, not including variable data which may be added. More...
 
using Callback = void(*)(void *parameterData)
 Queued callback. More...
 
- Static Public Member Functions inherited from Graphics::DisplayList
static String toString (Code code)
 
- Protected Member Functions inherited from Graphics::DisplayList
void write (uint8_t c)
 Write a byte into the display list buffer. More...
 
void writeHeader (Code code, uint16_t length)
 Write a Header structure to the buffer. More...
 
void write16 (uint16_t c)
 Write a value as 2 bytes. More...
 
void write (const void *data, uint16_t length)
 Write a block of data into the display list buffer. More...
 
void writeVar (uint16_t count)
 Write a value using 1 or 2 bytes as required. More...
 
Code getWriteCode ()
 Get the appropriate command code to use for a write operation. More...
 
Code getReadCode ()
 Get the appropriate command code to use for a read operation. More...
 
void internalSetAddrWindow (const Rect &rect)
 
void read (void *data, uint16_t len)
 Read block of data from buffer. More...
 
- Static Protected Attributes inherited from Graphics::DisplayList
static constexpr size_t maxLockedBuffers {8}
 

Detailed Description

Display list for hardware SPI devices.

A single HSPI request packet is used for all requests and is re-filled in interrupt context from this list.

Constructor & Destructor Documentation

◆ SpiDisplayList()

template<typename... Params>
Graphics::SpiDisplayList::SpiDisplayList ( const Commands commands,
Params &&...  params 
)
inline

Member Function Documentation

◆ fillRequest()

bool Graphics::SpiDisplayList::fillRequest ( )

Called from interrupt context to re-fill the SPI request packet.

Return values
booltrue on success, false if there are no further requests

◆ isBusy()

bool Graphics::SpiDisplayList::isBusy ( ) const
inline

◆ prepare()

void Graphics::SpiDisplayList::prepare ( Callback  callback,
void *  param 
)
inline

◆ staticRequestCallback()

static bool Graphics::SpiDisplayList::staticRequestCallback ( HSPI::Request request)
staticprotected

Member Data Documentation

◆ code

Code Graphics::SpiDisplayList::code {}
protected

Command being executed.

◆ commands

const Commands& Graphics::SpiDisplayList::commands
protected

◆ datalen

uint16_t Graphics::SpiDisplayList::datalen {0}
protected

Size of data at current position.

◆ repeatBuffer

uint8_t Graphics::SpiDisplayList::repeatBuffer[64]
protected

Buffer to fill out small repeated data chunks.

◆ repeats

uint16_t Graphics::SpiDisplayList::repeats {0}
protected

How many remaining repeats for this data block.

◆ request

HSPI::Request Graphics::SpiDisplayList::request

The HSPI request packet used by this list.


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