modm API documentation
|
SpiStack homogenoues memory. More...
#include <modm/driver/storage/block_device_spistack_flash.hpp>
Public Typedefs | |
using | bd_address_t = uint32_t |
using | bd_size_t = uint32_t |
Public Member Functions | |
bool | initialize () |
Initializes the storage hardware. | |
bool | deinitialize () |
Deinitializes the storage hardware. | |
bool | read (uint8_t *buffer, bd_address_t address, bd_size_t size) |
bool | program (const uint8_t *buffer, bd_address_t address, bd_size_t size) |
bool | erase (bd_address_t address, bd_size_t size) |
bool | write (const uint8_t *buffer, bd_address_t address, bd_size_t size) |
bool | isBusy () |
void | waitWhileBusy () |
SpiStack homogenoues memory.
The read()
, erase()
,program()
and write()
methodes wait for the chip to finish writing to the flash.
SpiBlockDevice | Base SPI block device of the homogenous stack |
bool modm::BdSpiStackFlash< SpiBlockDevice, DieCount >::erase | ( | bd_address_t | address, |
bd_size_t | size | ||
) |
Erase blocks
The state of an erased block is undefined until it has been programmed
address | Address of block to begin erasing |
size | Size to erase in bytes (multiple of read block size) |
bool modm::BdSpiStackFlash< SpiBlockDevice, DieCount >::isBusy | ( | ) |
Check if device is busy
bool modm::BdSpiStackFlash< SpiBlockDevice, DieCount >::program | ( | const uint8_t * | buffer, |
bd_address_t | address, | ||
bd_size_t | size | ||
) |
Program blocks with data
Any block has to be erased prior to being programmed
buffer | Buffer of data to write to blocks |
address | Address of first block to begin writing to |
size | Size to write in bytes (multiple of read block size) |
bool modm::BdSpiStackFlash< SpiBlockDevice, DieCount >::read | ( | uint8_t * | buffer, |
bd_address_t | address, | ||
bd_size_t | size | ||
) |
Read data from one or more blocks
buffer | Buffer to read data into |
address | Address to begin reading from |
size | Size to read in bytes (multiple of read block size) |
void modm::BdSpiStackFlash< SpiBlockDevice, DieCount >::waitWhileBusy | ( | ) |
This function can be used in another resumable function to wait until the flash operation is finished.
bool modm::BdSpiStackFlash< SpiBlockDevice, DieCount >::write | ( | const uint8_t * | buffer, |
bd_address_t | address, | ||
bd_size_t | size | ||
) |
Writes data to one or more blocks after erasing them
The blocks are erased prior to being programmed
buffer | Buffer of data to write to blocks |
address | Address of first block to begin writing to |
size | Size to write in bytes (multiple of read block size) |