Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arduino-hal] remove embedded-hal-v0 dependency #621

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions arduino-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ cfg-if = "1"
embedded-hal = "1.0"
ufmt = "0.2.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.avr-hal-generic]
path = "../avr-hal-generic/"

Expand Down
12 changes: 10 additions & 2 deletions arduino-hal/src/delay.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use embedded_hal_v0::blocking::delay::{DelayMs, DelayUs};
use embedded_hal::delay::DelayNs;

/// Delay type for `embedded-hal` compatibility.
///
Expand All @@ -10,7 +10,7 @@ pub type Delay = avr_hal_generic::delay::Delay<crate::DefaultClock>;
///
/// Busy-loop for the given time. This function assumes the default clock speed defined by
/// [`arduino_hal::DefaultClock`][crate::DefaultClock].
pub fn delay_ms(ms: u16) {
pub fn delay_ms(ms: u32) {
Delay::new().delay_ms(ms)
}

Expand All @@ -21,3 +21,11 @@ pub fn delay_ms(ms: u16) {
pub fn delay_us(us: u32) {
Delay::new().delay_us(us)
}

/// Delay execution for a number of nanoseconds.
///
/// Busy-loop for the given time. This function assumes the default clock speed defined by
/// [`arduino_hal::DefaultClock`][crate::DefaultClock].
pub fn delay_ns(ns: u32) {
Delay::new().delay_ns(ns)
}
2 changes: 1 addition & 1 deletion arduino-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub use clock::default::DefaultClock;
#[cfg(feature = "board-selected")]
mod delay;
#[cfg(feature = "board-selected")]
pub use delay::{delay_ms, delay_us, Delay};
pub use delay::{delay_ms, delay_ns, delay_us, Delay};

#[cfg(feature = "board-selected")]
pub mod port;
Expand Down
4 changes: 0 additions & 4 deletions examples/arduino-diecimila/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ ufmt = "0.2.0"
nb = "1.1.0"
embedded-hal = "1.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["arduino-diecimila"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use arduino_hal::prelude::*;
use arduino_hal::spi;
use embedded_hal_v0::spi::FullDuplex;
use panic_halt as _;

#[arduino_hal::entry]
Expand Down
2 changes: 0 additions & 2 deletions examples/arduino-diecimila/src/bin/diecimila-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
4 changes: 0 additions & 4 deletions examples/arduino-leonardo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ ufmt = "0.2.0"
nb = "1.1.0"
embedded-hal = "1.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["arduino-leonardo"]
Expand Down
1 change: 0 additions & 1 deletion examples/arduino-leonardo/src/bin/leonardo-spi-feedback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use arduino_hal::prelude::*;
use arduino_hal::spi;
use embedded_hal_v0::spi::FullDuplex;
use panic_halt as _;

#[arduino_hal::entry]
Expand Down
2 changes: 0 additions & 2 deletions examples/arduino-leonardo/src/bin/leonardo-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
4 changes: 0 additions & 4 deletions examples/arduino-mega1280/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ ufmt = "0.2.0"
nb = "1.1.0"
embedded-hal = "1.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["arduino-mega1280"]
Expand Down
2 changes: 0 additions & 2 deletions examples/arduino-mega1280/src/bin/mega1280-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
1 change: 0 additions & 1 deletion examples/arduino-mega1280/src/bin/mega1280spi-feedback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use arduino_hal::prelude::*;
use arduino_hal::spi;
use embedded_hal_v0::spi::FullDuplex;
use panic_halt as _;

#[arduino_hal::entry]
Expand Down
4 changes: 0 additions & 4 deletions examples/arduino-mega2560/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ ufmt = "0.2.0"
nb = "1.1.0"
embedded-hal = "1.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["arduino-mega2560"]
Expand Down
1 change: 0 additions & 1 deletion examples/arduino-mega2560/src/bin/mega2560-spi-feedback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use arduino_hal::prelude::*;
use arduino_hal::spi;
use embedded_hal_v0::spi::FullDuplex;
use panic_halt as _;

#[arduino_hal::entry]
Expand Down
2 changes: 0 additions & 2 deletions examples/arduino-mega2560/src/bin/mega2560-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
4 changes: 0 additions & 4 deletions examples/arduino-uno/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ pwm-pca9685 = "1.0.0"
infrared = "0.14.1"
embedded-storage = "0.2"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["arduino-uno"]
Expand Down
4 changes: 2 additions & 2 deletions examples/arduino-uno/src/bin/uno-ext-interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn INT0() {
REVERSED.store(!current, Ordering::SeqCst);
}

fn blink_for_range(range: impl Iterator<Item = u16>, leds: &mut [Pin<mode::Output>]) {
fn blink_for_range(range: impl Iterator<Item = u32>, leds: &mut [Pin<mode::Output>]) {
range.map(|i| i * 100).for_each(|ms| {
let iter = if is_reversed() {
Left(leds.iter_mut().rev())
Expand All @@ -35,7 +35,7 @@ fn blink_for_range(range: impl Iterator<Item = u16>, leds: &mut [Pin<mode::Outpu
};
iter.for_each(|led| {
led.toggle();
arduino_hal::delay_ms(ms as u16);
arduino_hal::delay_ms(ms);
})
});
}
Expand Down
2 changes: 0 additions & 2 deletions examples/arduino-uno/src/bin/uno-millis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use arduino_hal::prelude::*;
use core::cell;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

// Possible Values:
//
// ╔═══════════╦══════════════╦═══════════════════╗
Expand Down
1 change: 0 additions & 1 deletion examples/arduino-uno/src/bin/uno-spi-feedback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use arduino_hal::prelude::*;
use arduino_hal::spi;
use embedded_hal_v0::spi::FullDuplex;
use panic_halt as _;

#[arduino_hal::entry]
Expand Down
2 changes: 0 additions & 2 deletions examples/arduino-uno/src/bin/uno-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
4 changes: 0 additions & 4 deletions examples/nano168/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ ufmt = "0.2.0"
nb = "1.1.0"
embedded-hal = "1.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["nano168"]
Expand Down
2 changes: 0 additions & 2 deletions examples/nano168/src/bin/nano168-millis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use arduino_hal::prelude::*;
use core::cell;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

// Possible Values:
//
// ╔═══════════╦══════════════╦═══════════════════╗
Expand Down
2 changes: 0 additions & 2 deletions examples/nano168/src/bin/nano168-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
4 changes: 0 additions & 4 deletions examples/sparkfun-promicro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ ufmt = "0.2.0"
nb = "1.1.0"
embedded-hal = "1.0"

[dependencies.embedded-hal-v0]
version = "0.2.3"
package = "embedded-hal"

[dependencies.arduino-hal]
path = "../../arduino-hal/"
features = ["sparkfun-promicro"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use arduino_hal::prelude::*;
use arduino_hal::spi;
use embedded_hal_v0::spi::FullDuplex;
use panic_halt as _;

#[arduino_hal::entry]
Expand Down
2 changes: 0 additions & 2 deletions examples/sparkfun-promicro/src/bin/promicro-usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
use arduino_hal::prelude::*;
use panic_halt as _;

use embedded_hal_v0::serial::Read;

#[arduino_hal::entry]
fn main() -> ! {
let dp = arduino_hal::Peripherals::take().unwrap();
Expand Down
Loading