Skip to content

Class FlashClass

ClassList > FlashClass

Public Functions

Type Name
bool eraseSector (uint32_t offset)
Erase a single block of flash (usually 4 KiB).
FlashId getChipId ()
Flash chip ID structure.
uint32_t getSize ()
Get flash chip total size.
bool readBlock (uint32_t offset, uint8_t * data, size_t length)
Read data from the flash.
bool writeBlock (uint32_t offset, const uint8_t * data, size_t length)
Write data to the flash.

Public Functions Documentation

function eraseSector

Erase a single block of flash (usually 4 KiB).

inline bool FlashClass::eraseSector (
    uint32_t offset
) 

Parameters:

  • offset offset of the block (in bytes); must be multiple of the flash chip's block size

Returns:

whether erasing was successful

function getChipId

inline FlashId FlashClass::getChipId () 

function getSize

Get flash chip total size.

inline uint32_t FlashClass::getSize () 

The default implementation uses the least significant byte of the chip ID to determine the size.

function readBlock

Read data from the flash.

inline bool FlashClass::readBlock (
    uint32_t offset,
    uint8_t * data,
    size_t length
) 

Parameters:

  • offset starting offset (in bytes)
  • data pointer to where to store the data
  • length length of data to read

Returns:

length of data successfully read (should equal 'length')

function writeBlock

Write data to the flash.

inline bool FlashClass::writeBlock (
    uint32_t offset,
    const uint8_t * data,
    size_t length
) 

Parameters:

  • offset starting offset (in bytes)
  • data pointer to data to write
  • length length of data to write

Returns:

length of data successfully written (should equal 'length')


The documentation for this class was generated from the following file cores/common/arduino/libraries/inline/Flash/Flash.h