Skip to content

Commit 6414fa7

Browse files
Merge pull request #2 from jakezhu9/update-embedded-hal
lib: update dependency embedded-hal to 1.0.0
2 parents 5d31339 + 5fe01bf commit 6414fa7

File tree

4 files changed

+23
-38
lines changed

4 files changed

+23
-38
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ version = "0.6.0"
1313
[dependencies]
1414
byteorder = {version = "1", default-features = false}
1515
defmt = {version = "0.3", optional = true}
16-
embedded-hal = "1.0.0-rc.1"
16+
embedded-hal = "1.0.0"
1717
heapless = "0.7"
1818
log = {version = "0.4", default-features = false, optional = true}
1919

@@ -23,7 +23,7 @@ hex-literal = "0.4.1"
2323
flate2 = "1.0"
2424
sha2 = "0.10"
2525
chrono = "0.4"
26-
embedded-hal-bus = "0.1.0-rc.1"
26+
embedded-hal-bus = "0.1.0"
2727

2828
[features]
2929
default = ["log"]

examples/readme_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ impl embedded_hal::digital::OutputPin for FakeCs {
5454
#[derive(Clone, Copy)]
5555
struct FakeDelayer();
5656

57-
impl embedded_hal::delay::DelayUs for FakeDelayer {
58-
fn delay_us(&mut self, us: u32) {
59-
std::thread::sleep(std::time::Duration::from_micros(u64::from(us)));
57+
impl embedded_hal::delay::DelayNs for FakeDelayer {
58+
fn delay_ns(&mut self, ns: u32) {
59+
std::thread::sleep(std::time::Duration::from_nanos(u64::from(ns)));
6060
}
6161
}
6262

src/lib.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,17 @@
2727
//! # use core::convert::Infallible;
2828
//! # use core::fmt;
2929
//! # impl ErrorType for DummySpi {
30-
//! # type Error = Infallible;
30+
//! # type Error = Infallible;
3131
//! # }
3232
//! # impl embedded_hal::spi::SpiDevice<u8> for DummySpi {
33-
//! #
34-
//! # fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> {
35-
//! # Ok(())
36-
//! # }
37-
//! #
38-
//! # fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> {
39-
//! # Ok(())
40-
//! # }
41-
//! #
42-
//! # fn write(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
43-
//! # Ok(())
44-
//! # }
45-
//! #
46-
//! # fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
47-
//! # Ok(())
48-
//! # }
49-
//! #
50-
//! # fn transfer_in_place(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> {
51-
//! # Ok(())
52-
//! # }
33+
//! # fn transaction(&mut self, operations: &mut [Operation<'_, u8>]) -> Result<(), Self::Error> { Ok(()) }
34+
//! # fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> { Ok(()) }
35+
//! # fn write(&mut self, buf: &[u8]) -> Result<(), Self::Error> { Ok(()) }
36+
//! # fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { Ok(()) }
37+
//! # fn transfer_in_place(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> { Ok(()) }
5338
//! # }
5439
//! # impl embedded_hal::digital::ErrorType for DummyCsPin {
55-
//! # type Error = Infallible;
40+
//! # type Error = Infallible;
5641
//! # }
5742
//! # impl embedded_hal::digital::OutputPin for DummyCsPin {
5843
//! # fn set_low(&mut self) -> Result<(), Self::Error> { Ok(()) }
@@ -61,8 +46,8 @@
6146
//! # impl embedded_sdmmc::TimeSource for DummyTimeSource {
6247
//! # fn get_timestamp(&self) -> embedded_sdmmc::Timestamp { embedded_sdmmc::Timestamp::from_fat(0, 0) }
6348
//! # }
64-
//! # impl embedded_hal::delay::DelayUs for DummyDelayer {
65-
//! # fn delay_us(&mut self, us: u32) {}
49+
//! # impl embedded_hal::delay::DelayNs for DummyDelayer {
50+
//! # fn delay_ns(&mut self, ns: u32) {}
6651
//! # }
6752
//! # impl fmt::Write for DummyUart {
6853
//! # fn write_str(&mut self, s: &str) -> fmt::Result { Ok(()) }

src/sdcard/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ use crate::{debug, warn};
3232
///
3333
/// If you're not sure how to get a [`SpiDevice`], you may use one of the implementations
3434
/// in the [`embedded-hal-bus`] crate, providing a wrapped version of your platform's HAL-provided
35-
/// [`SpiBus`] and [`DelayUs`] as well as our [`DummyCsPin`] in the constructor.
35+
/// [`SpiBus`] and [`DelayNs`] as well as our [`DummyCsPin`] in the constructor.
3636
///
3737
/// [`SpiDevice`]: embedded_hal::spi::SpiDevice
3838
/// [`SpiBus`]: embedded_hal::spi::SpiBus
39-
/// [`DelayUs`]: embedded_hal::delay::DelayUs
39+
/// [`DelayNs`]: embedded_hal::delay::DelayNs
4040
/// [`embedded-hal-bus`]: https://docs.rs/embedded-hal-bus
4141
pub struct DummyCsPin;
4242

@@ -71,7 +71,7 @@ pub struct SdCard<SPI, CS, DELAYER>
7171
where
7272
SPI: embedded_hal::spi::SpiDevice<u8>,
7373
CS: embedded_hal::digital::OutputPin,
74-
DELAYER: embedded_hal::delay::DelayUs,
74+
DELAYER: embedded_hal::delay::DelayNs,
7575
{
7676
inner: RefCell<SdCardInner<SPI, CS, DELAYER>>,
7777
}
@@ -80,7 +80,7 @@ impl<SPI, CS, DELAYER> SdCard<SPI, CS, DELAYER>
8080
where
8181
SPI: embedded_hal::spi::SpiDevice<u8>,
8282
CS: embedded_hal::digital::OutputPin,
83-
DELAYER: embedded_hal::delay::DelayUs,
83+
DELAYER: embedded_hal::delay::DelayNs,
8484
{
8585
/// Create a new SD/MMC Card driver using a raw SPI interface.
8686
///
@@ -195,7 +195,7 @@ impl<SPI, CS, DELAYER> BlockDevice for SdCard<SPI, CS, DELAYER>
195195
where
196196
SPI: embedded_hal::spi::SpiDevice<u8>,
197197
CS: embedded_hal::digital::OutputPin,
198-
DELAYER: embedded_hal::delay::DelayUs,
198+
DELAYER: embedded_hal::delay::DelayNs,
199199
{
200200
type Error = Error;
201201

@@ -246,7 +246,7 @@ struct SdCardInner<SPI, CS, DELAYER>
246246
where
247247
SPI: embedded_hal::spi::SpiDevice<u8>,
248248
CS: embedded_hal::digital::OutputPin,
249-
DELAYER: embedded_hal::delay::DelayUs,
249+
DELAYER: embedded_hal::delay::DelayNs,
250250
{
251251
spi: SPI,
252252
cs: CS,
@@ -259,7 +259,7 @@ impl<SPI, CS, DELAYER> SdCardInner<SPI, CS, DELAYER>
259259
where
260260
SPI: embedded_hal::spi::SpiDevice<u8>,
261261
CS: embedded_hal::digital::OutputPin,
262-
DELAYER: embedded_hal::delay::DelayUs,
262+
DELAYER: embedded_hal::delay::DelayNs,
263263
{
264264
/// Read one or more blocks, starting at the given block index.
265265
fn read(&mut self, blocks: &mut [Block], start_block_idx: BlockIdx) -> Result<(), Error> {
@@ -620,7 +620,7 @@ where
620620
fn transfer_byte(&mut self, out: u8) -> Result<u8, Error> {
621621
let mut read_buf = [0u8; 1];
622622
self.spi
623-
.transfer(&mut read_buf,&[out])
623+
.transfer(&mut read_buf, &[out])
624624
.map_err(|_| Error::Transport)?;
625625
Ok(read_buf[0])
626626
}
@@ -791,7 +791,7 @@ impl Delay {
791791
/// `Ok(())`.
792792
fn delay<T>(&mut self, delayer: &mut T, err: Error) -> Result<(), Error>
793793
where
794-
T: embedded_hal::delay::DelayUs,
794+
T: embedded_hal::delay::DelayNs,
795795
{
796796
if self.retries_left == 0 {
797797
Err(err)

0 commit comments

Comments
 (0)