Defines an SPI Request Packet. More...

#include <Request.h>

Collaboration diagram for HSPI::Request:
[legend]

Public Member Functions

 Request ()
 
void prepare ()
 MUST call this first before attempting to re-use a request. More...
 
void setAsync (Callback callback=nullptr, void *param=nullptr)
 Set request to asynchronous execution with optional callback. More...
 
Set value for command phase
void setCommand (uint16_t command, uint8_t bitCount)
 
void setCommand8 (uint8_t command)
 Set 8-bit command. More...
 
void setCommand16 (uint16_t command)
 Set 16-bit command. More...
 
Set value for address phase
void setAddress (uint32_t address, uint8_t bitCount)
 
void setAddress24 (uint32_t address)
 Set 24-bit address. More...
 

Public Attributes

Devicedevice {nullptr}
 Target device for this request. More...
 
Requestnext {nullptr}
 Controller uses this to queue requests. More...
 
uint16_t cmd {0}
 Command value. More...
 
uint8_t cmdLen {0}
 Command bits, 0 - 16. More...
 
uint8_t maxTransactionSize {0}
 Limit size of data in each transaction (excludes command/address/dummy) More...
 
uint8_t async: 1
 Set for asynchronous operation. More...
 
uint8_t task: 1
 Controller will execute this request in task mode. More...
 
volatile uint8_t busy: 1
 Request in progress. More...
 
uint32_t addr {0}
 Address value. More...
 
uint8_t addrLen {0}
 Address bits, 0 - 32. More...
 
uint8_t dummyLen {0}
 Dummy read bits between address and read data, 0 - 255. More...
 
Data out
 Outgoing data. More...
 
Data in
 Incoming data. More...
 
Callback callback {nullptr}
 Completion routine. More...
 
void * param {nullptr}
 User parameter. More...
 

Detailed Description

Defines an SPI Request Packet.

Request fields may be accessed directly or by use of helper methods.

Application is responsible for managing Request object construction/destruction. Queuing is managed as a linked list so the objects aren't copied.

Applications will typically only require a couple of Request objects, so one can be prepared whilst the other is in flight. This helps to minimises the setup latency between SPI transactions.

Constructor & Destructor Documentation

◆ Request()

HSPI::Request::Request ( )
inline

Member Function Documentation

◆ prepare()

void HSPI::Request::prepare ( )
inline

MUST call this first before attempting to re-use a request.

Note
If the request is already queued then this method will block until it's completed

◆ setAddress()

void HSPI::Request::setAddress ( uint32_t  address,
uint8_t  bitCount 
)
inline
Parameters
address
bitCountLength of address in bits

◆ setAddress24()

void HSPI::Request::setAddress24 ( uint32_t  address)
inline

Set 24-bit address.

Parameters
address

◆ setAsync()

void HSPI::Request::setAsync ( Callback  callback = nullptr,
void *  param = nullptr 
)
inline

Set request to asynchronous execution with optional callback.

◆ setCommand()

void HSPI::Request::setCommand ( uint16_t  command,
uint8_t  bitCount 
)
inline
Parameters
command
bitCountLength of command in bits

◆ setCommand16()

void HSPI::Request::setCommand16 ( uint16_t  command)
inline

Set 16-bit command.

Parameters
command

◆ setCommand8()

void HSPI::Request::setCommand8 ( uint8_t  command)
inline

Set 8-bit command.

Parameters
command

Member Data Documentation

◆ addr

uint32_t HSPI::Request::addr {0}

Address value.

◆ addrLen

uint8_t HSPI::Request::addrLen {0}

Address bits, 0 - 32.

◆ async

uint8_t HSPI::Request::async

Set for asynchronous operation.

◆ busy

volatile uint8_t HSPI::Request::busy

Request in progress.

◆ callback

Callback HSPI::Request::callback {nullptr}

Completion routine.

◆ cmd

uint16_t HSPI::Request::cmd {0}

Command value.

◆ cmdLen

uint8_t HSPI::Request::cmdLen {0}

Command bits, 0 - 16.

◆ device

Device* HSPI::Request::device {nullptr}

Target device for this request.

◆ dummyLen

uint8_t HSPI::Request::dummyLen {0}

Dummy read bits between address and read data, 0 - 255.

◆ in

Data HSPI::Request::in

Incoming data.

◆ maxTransactionSize

uint8_t HSPI::Request::maxTransactionSize {0}

Limit size of data in each transaction (excludes command/address/dummy)

◆ next

Request* HSPI::Request::next {nullptr}

Controller uses this to queue requests.

◆ out

Data HSPI::Request::out

Outgoing data.

◆ param

void* HSPI::Request::param {nullptr}

User parameter.

◆ task

uint8_t HSPI::Request::task

Controller will execute this request in task mode.


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