[−][src]Trait spi_memory::Read
A trait for reading operations from a memory chip.
Required methods
fn read(&mut self, addr: Addr, buf: &mut [u8]) -> Result<(), Error<SPI, CS>>
Reads bytes from a memory chip.
Parameters
addr
: The address to start reading at.buf
: The buffer to readbuf.len()
bytes into.
Implementors
impl<SPI: Transfer<u8>, CS: OutputPin> Read<u32, SPI, CS> for Flash<SPI, CS>
[src]
fn read(&mut self, addr: u32, buf: &mut [u8]) -> Result<(), Error<SPI, CS>>
[src]
Reads flash contents into buf
, starting at addr
.
Note that addr
is not fully decoded: Flash chips will typically only
look at the lowest N
bits needed to encode their size, which means
that the contents are "mirrored" to addresses that are a multiple of the
flash size. Only 24 bits of addr
are transferred to the device in any
case, limiting the maximum size of 25-series SPI flash chips to 16 MiB.
Parameters
addr
: 24-bit address to start reading at.buf
: Destination buffer to fill.