X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fcommon%2Fmx25l.rs;h=6c28c5ae904b96dc37791d3dd25f1c1ffe06c3c2;hb=0d8584ea930c590c6034d465844e74dc94b25309;hp=388d31172497b858c86c2ac36731156d1d16e2ed;hpb=810fc22cf43b5cd504279f89e509a2a08d07481b;p=gps-watch.git diff --git a/src/common/mx25l.rs b/src/common/mx25l.rs index 388d311..6c28c5a 100644 --- a/src/common/mx25l.rs +++ b/src/common/mx25l.rs @@ -115,6 +115,8 @@ impl Mx25l { return Ok(()); } + self.write_enable(); + self.with_selected(|| { spi::tx8(spi::SPI0, Command::PP as u8); @@ -157,6 +159,10 @@ impl Mx25l { } impl Storage for Mx25l { + fn size(&self) -> usize { + 2 << 20 + } + fn read(&self, address: usize, buffer: &mut [u8]) { self.with_selected(|| { spi::tx8(spi::SPI0, Command::READ as u8); @@ -191,4 +197,12 @@ impl Storage for Mx25l { Ok(()) } + + fn erase(&mut self, address: usize) -> Result<(), Error> { + self.erase_sector(address) + } + + fn clear(&mut self) { + self.erase_all(); + } }