Skip to content

Commit 383d05e

Browse files
author
Jonas Schievink
committed
Update embedded-{dma,storage}
1 parent 3d7a303 commit 383d05e

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

examples/nvmc-demo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ publish = false
1010
[dependencies]
1111
cortex-m = "0.7.3"
1212
cortex-m-rt = "0.7.0"
13-
embedded-storage = "0.2.0"
13+
embedded-storage = "0.3.0"
1414
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
1515
panic-probe = { version = "0.3.0", features = ["print-rtt"] }
1616

nrf-hal-common/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ nb = "1.0.0"
2525
fixed = "1.0.0"
2626
rand_core = "0.6.3"
2727
cfg-if = "1.0.0"
28-
embedded-dma = "0.1.1"
29-
embedded-storage = "0.2.0"
28+
embedded-dma = "0.2.0"
29+
embedded-storage = "0.3.0"
3030

3131
[dependencies.void]
3232
default-features = false

nrf-hal-common/src/nvmc.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use crate::pac::NVMC;
1212
use crate::pac::NVMC_NS as NVMC;
1313

1414
use core::convert::TryInto;
15-
use embedded_storage::nor_flash::{NorFlash, ReadNorFlash};
15+
use embedded_storage::nor_flash::{
16+
ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash,
17+
};
1618

1719
type WORD = u32;
1820
const WORD_SIZE: usize = core::mem::size_of::<WORD>();
@@ -108,12 +110,14 @@ where
108110
}
109111
}
110112

113+
impl<T: Instance> ErrorType for Nvmc<T> {
114+
type Error = NvmcError;
115+
}
116+
111117
impl<T> ReadNorFlash for Nvmc<T>
112118
where
113119
T: Instance,
114120
{
115-
type Error = NvmcError;
116-
117121
const READ_SIZE: usize = 1;
118122

119123
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
@@ -208,3 +212,12 @@ pub enum NvmcError {
208212
/// An operation was attempted outside the boundaries
209213
OutOfBounds,
210214
}
215+
216+
impl NorFlashError for NvmcError {
217+
fn kind(&self) -> NorFlashErrorKind {
218+
match self {
219+
NvmcError::Unaligned => NorFlashErrorKind::NotAligned,
220+
NvmcError::OutOfBounds => NorFlashErrorKind::OutOfBounds,
221+
}
222+
}
223+
}

nrf52840-hal-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ cortex-m-rt = { version = "0.7.1", features = ["device"] }
3434
defmt = "0.3.0"
3535
defmt-rtt = "0.3.0"
3636
defmt-test = "0.3.0"
37-
embedded-storage = "0.2.0"
37+
embedded-storage = "0.3.0"
3838
nrf52840-hal = { path = "../nrf52840-hal" }
3939
panic-probe = { version = "0.3.0", features = ["print-defmt"] }

0 commit comments

Comments
 (0)