pub struct SpiFlash<'a> { /* private fields */ }Expand description
Accessor for the W25Q80BV SPI Flash in the HackRF.
Implementations§
Source§impl SpiFlash<'_>
impl SpiFlash<'_>
Sourcepub async fn erase(&self) -> Result<(), Error>
pub async fn erase(&self) -> Result<(), Error>
Erase the entire flash memory.
Should be immediately followed by writing a new image, or the HackRF will be soft-bricked (but recoverable by DFU).
Sourcepub async fn write(&self, addr: u32, data: &[u8]) -> Result<(), Error>
pub async fn write(&self, addr: u32, data: &[u8]) -> Result<(), Error>
Write firmware to the flash memory.
Should only be used for firmware image writing, and likely needs to be preceeded by an erase command before doing a write sequence.
Writes can be up to the max size of the memory; this command will split them into sub-commands if needed.
Sourcepub async fn read(&self, addr: u32, len: usize) -> Result<Vec<u8>, Error>
pub async fn read(&self, addr: u32, len: usize) -> Result<Vec<u8>, Error>
Read from the flash memory.
This should only be used for firmware verification.
Reads can be up to the max size of the memory; this command will split them into sub-commands if needed.
Sourcepub async fn status(&self) -> Result<[u8; 2], Error>
pub async fn status(&self) -> Result<[u8; 2], Error>
Get the status registers of the W25Q80BV flash memory.
Requires API version 0x0103 or higher.
Sourcepub async fn clear_status(&self) -> Result<(), Error>
pub async fn clear_status(&self) -> Result<(), Error>
Clear the status registers of the W25Q80BV flash memory.