common: Implement Storage::size() in Mx25l.
[gps-watch.git] / src / common / mx25l.rs
index 388d31172497b858c86c2ac36731156d1d16e2ed..ecc42bacfe84b9228db2aea4c4eba02a894176b4 100644 (file)
@@ -157,6 +157,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 +195,8 @@ impl Storage for Mx25l {
 
         Ok(())
     }
+
+    fn clear(&mut self) {
+        self.erase_all();
+    }
 }