NetBurner 3.5.6
PDF Version
SPI_QSPI Class Reference

The Single-Bit SPI mode QSPI Peripheral Class. More...

#include <quadspi.h>

Inherits SPIModule.

Public Member Functions

 SPI_QSPI (uint8_t QuadSPIModule=DEFAULT_QUADSPI_MODULE)
 Create a SPI object.
 
 SPI_QSPI (uint8_t QuadSPIModule, uint32_t baudRateInBps, uint8_t transferSizeInBits=8, uint8_t peripheralChipSelects=0x00, uint8_t chipSelectPolarity=0x0F, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0)
 Create a SPI object and Initialize with parameters.
 
virtual uint8_t Init (uint32_t baudRateInBps=2000000, uint8_t transferSizeInBits=8, uint8_t peripheralChipSelects=0x00, uint8_t chipSelectPolarity=0x0F, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0) override
 Initialize an existing SPI object.
 
virtual uint32_t SetBusSpeed (uint32_t maxSpeed) override
 Set the SPI bus speed Will attempt to set the desired bus speed. It may be different based on the available system characteristics.
 
virtual uint8_t Start (uint8_t *transmitBufferPtr, volatile uint8_t *receiveBufferPtr, uint32_t byteCount, int csReturnToInactive=DEASSERT_AFTER_LAST) override
 Start a SPI transfer.
 
virtual uint8_t Tx (uint8_t *transmitBufferPtr, uint32_t byteCount, int csReturnToInactive=DEASSERT_AFTER_LAST) override
 Convenience function for unidirectional transmit.
 
uint8_t Rx (uint8_t *receiveBufferPtr, uint32_t byteCount, int csReturnToInactive=DEASSERT_AFTER_LAST)
 Convenience function for unidirectional receive.
 
virtual bool SetCS (uint8_t CS) override
 Set the chip select configuration for the SPI object's bus transactions.
 
- Public Member Functions inherited from SPIModule
 SPIModule (uint8_t SPIModule)
 Create a SPI object.
 
 SPIModule (uint8_t SPIModule, uint32_t baudRateInBps, uint8_t transferSizeInBits=8, uint8_t peripheralChipSelects=0x00, uint8_t chipSelectPolarity=0x0F, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0, uint8_t delayBetweenTransfer=0)
 Create a SPI object and Initialize with parameters.
 
virtual bool RegisterSem (OS_SEM *finishedSem)
 Register a semaphore for the SPI module.
 
virtual bool ClrSem ()
 Clear a semaphore registration.
 
virtual OS_SEMGetSem ()
 Obtain a pointer to the SPI finished semaphore.
 
virtual bool Done ()
 Function to check SPI status.
 
virtual uint32_t GetActualBaudrate ()
 Returns the active baud rate.
 
 SPIModule (uint8_t SPIModule)
 Create a SPI object.
 
 SPIModule (uint8_t SPIModule, uint32_t baudRateInBps, uint8_t transferSizeInBits=8, uint8_t peripheralChipSelects=0x00, uint8_t chipSelectPolarity=0x0F, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0)
 Create a SPI object and Initialize with parameters.
 
 SPIModule (uint8_t SPIModule, uint32_t baudRateInBps, uint8_t transferSizeInBits=8, PinIO gpioChipSelect=PinDef_INVALID, uint8_t chipSelectPolarity=0x0F, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0)
 Create a SPI object and Initialize with parameters.
 
virtual uint8_t Init (uint32_t baudRateInBps=2000000, uint8_t transferSizeInBits=8, PinIO gpioChipSelect=PinDef_INVALID, uint8_t chipSelectPolarity=0x0F, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0)
 Initialize an existing SPI object.
 
virtual bool RegisterSem (OS_SEM *finishedSem)
 Register a semaphore for the SPI module.
 
virtual bool ClrSem ()
 Clear a semaphore registration.
 
virtual OS_SEMGetSem ()
 Obtain a pointer to the SPI finished semaphore.
 
virtual bool Done ()
 Function to check SPI status.
 
virtual uint32_t GetActualBaudrate ()
 Returns the active baud rate.
 

Additional Inherited Members

- Static Public Member Functions inherited from SPIModule
static BOOL Done (uint8_t SPIModule)
 Static function to check SPI status.
 
static BOOL Done (uint8_t SPIModule)
 Static function to check SPI status.
 

Detailed Description

The Single-Bit SPI mode QSPI Peripheral Class.

Class definition for SPI module objects

Constructor & Destructor Documentation

◆ SPI_QSPI() [1/2]

SPI_QSPI::SPI_QSPI ( uint8_t QuadSPIModule = DEFAULT_QUADSPI_MODULE)

Create a SPI object.

This constructor will create the object, but will not initialize the SPI module. You must call the Init() member function to initialize.

Parameters
QuadSPIModuleQSPI module number (0). The SAME70 only has one QuadSPI module.

◆ SPI_QSPI() [2/2]

SPI_QSPI::SPI_QSPI ( uint8_t QuadSPIModule,
uint32_t baudRateInBps,
uint8_t transferSizeInBits = 8,
uint8_t peripheralChipSelects = 0x00,
uint8_t chipSelectPolarity = 0x0F,
uint8_t clockPolarity = 0,
uint8_t clockPhase = 1,
BOOL doutHiz = TRUE,
uint8_t csToClockDelay = 0,
uint8_t delayAfterTransfer = 0 )

Create a SPI object and Initialize with parameters.

Creates a SPI object and initializes the SPI module. You do not need to call the Init() member function.

  • If configured for 8 bits per transfer then the data must be uint8_t aligned
  • If configured for > than 8 bits per transfer then the data must be uint16_t aligned
Parameters
QuadSPIModuleQSPI module number (0). The SAME70 has only one QuadSPI module
baudRateInBpsMaximum baud rate requested
transferSizeInBitsNumber of bits per transfer: 8-bit up to 16-bit transfer sizes are valid
peripheralChipSelectsSPI chip selects to use for transfer. Only one chip select is available to the QuadSPI peripheral on pin P2[48].
chipSelectPolarityParameter not supported on the MODM7AE70. Chip select asserts with logic level low. spiChipSelectPolarity
clockPolarity0 = inactive logic level low, 1 = high
clockPhase0 = data captured leading edge clock, changed following edge. 1 = data changed leading edge clock, captured following edge.
doutHizData output high impedance between transfers
csToClockDelayDelay from chip select to valid clock (default is 0). When 0, the delay is half the clock period.
delayAfterTransferWhen 0, no delay between consecutive transfers is inserted and the clock keeps its duty cycle over the character transfers.

Member Function Documentation

◆ Init()

virtual uint8_t SPI_QSPI::Init ( uint32_t baudRateInBps = 2000000,
uint8_t transferSizeInBits = 8,
uint8_t peripheralChipSelects = 0x00,
uint8_t chipSelectPolarity = 0x0F,
uint8_t clockPolarity = 0,
uint8_t clockPhase = 1,
BOOL doutHiz = TRUE,
uint8_t csToClockDelay = 0,
uint8_t delayAfterTransfer = 0 )
overridevirtual

Initialize an existing SPI object.

  • If configured for 8 bits per transfer then the data must be uint8_t aligned
  • If configured for > than 8 bits per transfer then the data must be uint16_t aligned
Parameters
baudRateInBpsMaximum baud rate requested
transferSizeInBitsNumber of bits per transfer: 8-bit up to 16-bit transfer sizes are valid
peripheralChipSelectsSPI chip selects to use for transfer. Only one chip select is available to the QuadSPI peripheral on pin P2[48].
chipSelectPolarityParameter not supported on the MODM7AE70. Chip select asserts with logic level low. spiChipSelectPolarity
clockPolarity0 = inactive logic level low, 1 = high
clockPhase0 = data captured leading edge clock, changed following edge. 1 = data changed leading edge clock, captured following edge.
doutHizData output high impedance between transfers
csToClockDelayDelay from chip select to valid clock (default is 0). When 0, the delay is half the clock period.
delayAfterTransferWhen 0, no delay between consecutive transfers is inserted and the clock keeps its duty cycle over the character transfers.
Returns
The current state of the SPI bus dspiState

Reimplemented from SPIModule.

◆ Rx()

uint8_t SPI_QSPI::Rx ( uint8_t * receiveBufferPtr,
uint32_t byteCount,
int csReturnToInactive = DEASSERT_AFTER_LAST )
inlinevirtual

Convenience function for unidirectional receive.

Parameters
receiveBufferPtrPointer to the buffer to write the received data
byteCountNumber of bytes to transmit
csReturnToInactiveChip select state
Returns
The current state of the SPI bus dspiState

Reimplemented from SPIModule.

◆ SetBusSpeed()

virtual uint32_t SPI_QSPI::SetBusSpeed ( uint32_t maxSpeed)
overridevirtual

Set the SPI bus speed Will attempt to set the desired bus speed. It may be different based on the available system characteristics.

Parameters
maxSpeedThe maximum desired bus speed
Returns
The actual bus speed

Reimplemented from SPIModule.

◆ SetCS()

virtual bool SPI_QSPI::SetCS ( uint8_t CS)
inlineoverridevirtual

Set the chip select configuration for the SPI object's bus transactions.

Single-bit SPI mode for the QuadSPI peripheral only supports one chip select. This function is defined for compatibility between SPI drivers.

Parameters
CSThe QuadSPI module has only one chip select.
Returns
true if successful, false if SPI is currently active

Reimplemented from SPIModule.

◆ Start()

virtual uint8_t SPI_QSPI::Start ( uint8_t * transmitBufferPtr,
volatile uint8_t * receiveBufferPtr,
uint32_t byteCount,
int csReturnToInactive = DEASSERT_AFTER_LAST )
overridevirtual

Start a SPI transfer.

  • If configured for 8 bits per transfer then the data must be uint8_t aligned
  • If configured for > than 8 bits per transfer then the data must be uint16_t aligned
  • If either RX or TX pointer is assigned 'null' then that communication direction will not occur.
Parameters
transmitBufferPtrPointer to the buffer containing the data to transmit
receiveBufferPtrPointer to the buffer to store the received data
byteCountNumber of bytes to transmit
csReturnToInactiveChip select state dspiChipSelectMode
Returns
The current state of the SPI bus dspiState

Reimplemented from SPIModule.

◆ Tx()

virtual uint8_t SPI_QSPI::Tx ( uint8_t * transmitBufferPtr,
uint32_t byteCount,
int csReturnToInactive = DEASSERT_AFTER_LAST )
inlineoverridevirtual

Convenience function for unidirectional transmit.

Parameters
transmitBufferPtrPointer to the buffer containing the data to transmit
byteCountNumber of bytes to transmit
csReturnToInactiveChip select state
Returns
The current state of the SPI bus dspiState

Reimplemented from SPIModule.


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