projects
/
gps-watch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6747c4
)
common: Implement Mx25l::erase_all().
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Wed, 8 Jan 2020 09:40:49 +0000
(10:40 +0100)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Thu, 9 Jan 2020 14:19:36 +0000
(15:19 +0100)
src/common/mx25l.rs
patch
|
blob
|
history
diff --git
a/src/common/mx25l.rs
b/src/common/mx25l.rs
index a6ad39550e9cbb9d9df7b1c0236e2e7228fabb51..388d31172497b858c86c2ac36731156d1d16e2ed 100644
(file)
--- a/
src/common/mx25l.rs
+++ b/
src/common/mx25l.rs
@@
-39,6
+39,7
@@
enum Command {
RDSR = 0x05,
WREN = 0x06,
SE = 0x20,
+ CE = 0x60,
RDID = 0x9f,
}
@@
-72,6
+73,17
@@
impl Mx25l {
})
}
+ pub fn erase_all(&self) {
+ self.write_enable();
+
+ self.with_selected(|| {
+ spi::tx8(spi::SPI0, Command::CE as u8);
+ });
+
+ while self.write_in_progress() {
+ }
+ }
+
pub fn erase_sector(&self, address: usize) -> Result<(), Error> {
if (address & (SECTOR_SIZE - 1)) != 0 {
return Err(Error::UnalignedAddress);