Skip to content

Class daisy::QSPIHandle

ClassList > daisy > QSPIHandle

More...

  • #include <qspi.h>

Classes

Type Name
struct Config

Public Types

Type Name
enum Result
enum Status

Public Functions

Type Name
Result DeInit ()
Result Erase (uint32_t start_addr, uint32_t end_addr)
Result EraseSector (uint32_t address)
const Config & GetConfig () const
void * GetData (uint32_t offset=0)
Status GetStatus ()
Result Init (const Config & config)
QSPIHandle ()
QSPIHandle (const QSPIHandle & other) = default
Result Write (uint32_t address, uint32_t size, uint8_t * buffer)
Result WritePage (uint32_t address, uint32_t size, uint8_t * buffer)
QSPIHandle & operator= (const QSPIHandle & other) = default

Detailed Description

Driver for QSPI peripheral to interface with external flash memory. Currently supported QSPI Devices: IS25LP080D

Public Types Documentation

enum Result

enum daisy::QSPIHandle::Result {
    OK = 0,
    ERR
};

enum Status

enum daisy::QSPIHandle::Status {
    GOOD = 0,
    E_HAL_ERROR,
    E_SWITCHING_MODES,
    E_INVALID_MODE
};

Indicates the current status of the module. Warnings are indicated by a leading W. Errors are indicated by a leading E and cause an immediate exit.

Parameters:

  • GOOD - No errors have been reported.
  • E_HAL_ERROR - HAL code did not return HAL_OK.
  • E_SWITCHING_MODES - An error was encountered while switching QSPI peripheral mode.
  • E_INVALID_MODE - QSPI should not be written to while the program is executing from it.

Public Functions Documentation

function DeInit

Result daisy::QSPIHandle::DeInit () 

Deinitializes the peripheral This should be called before reinitializing QSPI in a different mode.

Returns:

Result::OK or Result::ERR


function Erase

Result daisy::QSPIHandle::Erase (
    uint32_t start_addr,
    uint32_t end_addr
) 

Erases the area specified on the chip. Erasures will happen by 4K, 32K or 64K increments. Smallest erase possible is 4kB at a time. (on IS25LP*)

Parameters:

  • start_addr Address to begin erasing from
  • end_addr Address to stop erasing at

Returns:

Result::OK or Result::ERR


function EraseSector

Result daisy::QSPIHandle::EraseSector (
    uint32_t address
) 

Erases a single sector of the chip. TODO: Document the size of this function.

Parameters:

  • address Address of sector to erase

Returns:

Result::OK or Result::ERR


function GetConfig

const  Config & daisy::QSPIHandle::GetConfig () const

Returns the current config.


function GetData

void * daisy::QSPIHandle::GetData (
    uint32_t offset=0
) 

Returns a pointer to the actual memory used The memory at this address is read-only to write to it use the Write function.

Parameters:

  • offset returns the pointer starting this many bytes into the memory

function GetStatus

Status daisy::QSPIHandle::GetStatus () 

Returns the current class status. Useful for debugging.

Returns:

Status


function Init

Result daisy::QSPIHandle::Init (
    const  Config & config
) 

Initializes QSPI peripheral, and Resets, and prepares memory for access.

Parameters:

  • config should be populated with the mode, device and pin_config before calling this function.

Returns:

Result::OK or Result::ERR


function QSPIHandle [½]

inline daisy::QSPIHandle::QSPIHandle () 

function QSPIHandle [2/2]

daisy::QSPIHandle::QSPIHandle (
    const  QSPIHandle & other
) = default

function Write

Result daisy::QSPIHandle::Write (
    uint32_t address,
    uint32_t size,
    uint8_t * buffer
) 

Writes data in buffer to to the QSPI. Starting at address to address+size

Parameters:

  • address Address to write to
  • size Buffer size
  • buffer Buffer to write

Returns:

Result::OK or Result::ERR


function WritePage

Result daisy::QSPIHandle::WritePage (
    uint32_t address,
    uint32_t size,
    uint8_t * buffer
) 

Writes a single page to to the specified address on the QSPI chip. For IS25LP*, page size is 256 bytes.

Parameters:

  • address Address to write to
  • size Buffer size
  • buffer Buffer to write

Returns:

Result::OK or Result::ERR


function operator=

QSPIHandle & daisy::QSPIHandle::operator= (
    const  QSPIHandle & other
) = default


The documentation for this class was generated from the following file external-docs/libDaisy/src/per/qspi.h