Skip to content

Commit

Permalink
split embedded-hal dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
almindor committed Mar 22, 2024
1 parent 057d298 commit f6be3bf
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ edition = "2018"
rust-version = "1.59"

[dependencies]
embedded-hal = { version = "0.2.6", features = ["unproven"] }
embedded-hal-0 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0" }
nb = "1.0.0"
riscv = { version = "0.10.1", features = ["critical-section-single-hart"] }
e310x = { version = "0.11.0", features = ["rt", "critical-section"] }
Expand Down
2 changes: 1 addition & 1 deletion src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::clock::Clocks;
use crate::core::clint::{MTIME, MTIMECMP};
use embedded_hal::blocking::delay::{DelayMs, DelayUs};
use embedded_hal_0::blocking::delay::{DelayMs, DelayUs};
use riscv::register::{mie, mip};

/// Machine timer (mtime) as a busyloop delay provider
Expand Down
2 changes: 1 addition & 1 deletion src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ macro_rules! gpio {
use core::marker::PhantomData;
use core::convert::Infallible;

use embedded_hal::digital::v2::{InputPin, OutputPin, StatefulOutputPin,
use embedded_hal_0::digital::v2::{InputPin, OutputPin, StatefulOutputPin,
ToggleableOutputPin};
use e310x::$GPIOX;
use super::{Unknown, IOF0, IOF1, Drive, Floating, GpioExt, Input, Invert,
Expand Down
2 changes: 1 addition & 1 deletion src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::time::Bps;
use core::mem;
use core::ops::Deref;
use e310x::{i2c0, I2C0};
use embedded_hal::blocking::i2c::{Read, Write, WriteRead};
use embedded_hal_0::blocking::i2c::{Read, Write, WriteRead};

/// SDA pin - DO NOT IMPLEMENT THIS TRAIT
pub unsafe trait SdaPin<I2C> {}
Expand Down
4 changes: 2 additions & 2 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pub use crate::rtc::RtcExt as _e310x_hal_rtc_RtcExt;
pub use crate::stdout::Write as _e310x_hal_stdout_Write;
pub use crate::time::U32Ext as _e310x_hal_time_U32Ext;
pub use crate::wdog::WdogExt as _e310x_hal_wdog_WdogExt;
pub use embedded_hal::digital::v2::{
pub use embedded_hal_0::digital::v2::{
InputPin as _embedded_hal_digital_v2_InputPin, OutputPin as _embedded_hal_digital_v2_OutputPin,
StatefulOutputPin as _embedded_hal_digital_v2_StatefulOutputPin,
ToggleableOutputPin as _embedded_hal_digital_v2_ToggleableOutputPin,
};
pub use embedded_hal::prelude::*;
pub use embedded_hal_0::prelude::*;
2 changes: 1 addition & 1 deletion src/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<PWM: PwmX> Pwm<PWM> {
}
}

impl<PWM: PwmX> embedded_hal::Pwm for Pwm<PWM> {
impl<PWM: PwmX> embedded_hal_0::Pwm for Pwm<PWM> {
type Channel = Channel<PWM>;

type Time = PWM::CmpWidth;
Expand Down
2 changes: 1 addition & 1 deletion src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use core::convert::Infallible;
use core::ops::Deref;

use embedded_hal::serial;
use embedded_hal_0::serial;
use nb;

use crate::clock::Clocks;
Expand Down
6 changes: 3 additions & 3 deletions src/spi/bus.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::convert::Infallible;
use embedded_hal::blocking::spi::Operation;
pub use embedded_hal::blocking::spi::{Transfer, Write, WriteIter};
pub use embedded_hal::spi::{FullDuplex, Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3};
use embedded_hal_0::blocking::spi::Operation;
pub use embedded_hal_0::blocking::spi::{Transfer, Write, WriteIter};
pub use embedded_hal_0::spi::{FullDuplex, Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3};

use nb;

Expand Down
2 changes: 1 addition & 1 deletion src/spi/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use e310x::qspi0::csmode::MODE_A;
use embedded_hal::spi::Mode;
use embedded_hal_0::spi::Mode;

use crate::{clock::Clocks, time::Hertz};

Expand Down
2 changes: 1 addition & 1 deletion src/spi/exclusive_device.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::convert::Infallible;

use embedded_hal::{
use embedded_hal_0::{
blocking::spi::{Operation, Transactional, Transfer, Write, WriteIter},
spi::FullDuplex,
};
Expand Down
2 changes: 1 addition & 1 deletion src/spi/shared_bus.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::cell::RefCell;
use core::ops::Deref;
pub use embedded_hal::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3};
// pub use embedded_hal_0::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3};
use riscv::interrupt;

use super::{PinCS, PinsNoCS, SpiBus, SpiConfig, SpiSharedDevice, SpiX};
Expand Down
2 changes: 1 addition & 1 deletion src/spi/shared_device.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::convert::Infallible;

use embedded_hal::{
use embedded_hal_0::{
blocking::spi::{Operation, Transactional, Transfer, Write, WriteIter},
spi::FullDuplex,
};
Expand Down
2 changes: 1 addition & 1 deletion src/stdout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ where

impl<'p, T> Write for Stdout<'p, T>
where
T: embedded_hal::serial::Write<u8>,
T: embedded_hal_0::serial::Write<u8>,
{
fn write_str(&mut self, s: &str) -> ::core::fmt::Result {
for byte in s.as_bytes() {
Expand Down

0 comments on commit f6be3bf

Please sign in to comment.