Skip to content

Commit

Permalink
Use embedded-hal 1.0 in examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Mar 6, 2024
1 parent af65a78 commit 1f07a60
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 33 deletions.
5 changes: 1 addition & 4 deletions examples/blinky-button-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ edition = "2018"
[dependencies]
cortex-m = "0.7.3"
cortex-m-rt = "0.7.0"
embedded-hal = "1.0.0"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
nrf52832-hal = { features = ["rt"], path = "../../nrf52832-hal" }

[dependencies.embedded-hal]
version = "0.2.3"
features = ["unproven"]
6 changes: 3 additions & 3 deletions examples/blinky-button-demo/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![no_main]
#![no_std]

use embedded_hal::digital::v2::InputPin;
use embedded_hal::digital::v2::OutputPin;
use embedded_hal::digital::InputPin;
use embedded_hal::digital::OutputPin;
use nrf52832_hal as hal;
use nrf52832_hal::gpio::Level;
use rtt_target::{rprintln, rtt_init_print};
Expand All @@ -19,7 +19,7 @@ fn main() -> ! {
rtt_init_print!();
let p = hal::pac::Peripherals::take().unwrap();
let port0 = hal::gpio::p0::Parts::new(p.P0);
let button = port0.p0_13.into_pullup_input();
let mut button = port0.p0_13.into_pullup_input();
let mut led = port0.p0_17.into_push_pull_output(Level::Low);

rprintln!("Blinky button demo starting");
Expand Down
5 changes: 1 addition & 4 deletions examples/comp-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ publish = false
cortex-m = "0.7.3"
cortex-m-rt = { version = "0.7.0", features = ["device"] }
cortex-m-rtic = { version = "1.0.0", default-features = false }
embedded-hal = "1.0.0"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
nrf52840-hal = { features = ["rt"], path = "../../nrf52840-hal" }

[dependencies.embedded-hal]
version = "0.2.3"
features = ["unproven"]
2 changes: 1 addition & 1 deletion examples/comp-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {core::panic::PanicInfo, rtt_target::rprintln};

#[rtic::app(device = nrf52840_hal::pac, peripherals = true)]
mod app {
use embedded_hal::digital::v2::OutputPin;
use embedded_hal::digital::OutputPin;
use nrf52840_hal::clocks::Clocks;
use nrf52840_hal::comp::*;
use nrf52840_hal::gpio::{self, Level, Output, Pin, PushPull};
Expand Down
5 changes: 1 addition & 4 deletions examples/gpiote-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ edition = "2018"
cortex-m = "0.7.3"
cortex-m-rt = { version = "0.7.0", features = ["device"] }
cortex-m-rtic = { version = "1.0.0", default-features = false }
embedded-hal = "1.0.0"
systick-monotonic = "1.0.0"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
nrf52840-hal = { features = ["rt"], path = "../../nrf52840-hal" }

[dependencies.embedded-hal]
version = "0.2.3"
features = ["unproven"]
2 changes: 1 addition & 1 deletion examples/gpiote-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {core::panic::PanicInfo, nrf52840_hal as hal, rtt_target::rprintln};

#[rtic::app(device = crate::hal::pac, peripherals = true, dispatchers = [SWI0_EGU0])]
mod app {
use embedded_hal::digital::v2::InputPin;
use embedded_hal::digital::InputPin;
use systick_monotonic::*;
use {
hal::{
Expand Down
5 changes: 1 addition & 4 deletions examples/i2s-controller-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ publish = false
cortex-m = "0.7.3"
cortex-m-rt = { version = "0.7.0", features = ["device"] }
cortex-m-rtic = { version = "1.0.0", default-features = false }
embedded-hal = "1.0.0"
systick-monotonic = "1.0.0"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
nrf52840-hal = { features = ["rt"], path = "../../nrf52840-hal" }
heapless = "0.7.10"
small_morse = "0.1.0"

[dependencies.embedded-hal]
version = "0.2.3"
features = ["unproven"]
2 changes: 1 addition & 1 deletion examples/i2s-controller-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Aligned<T: ?Sized>(T);
#[rtic::app(device = crate::hal::pac, peripherals = true, dispatchers = [SWI0_EGU0, SWI1_EGU1])]
mod app {
use crate::{hal, triangle_wave, Aligned};
use embedded_hal::digital::v2::{InputPin, OutputPin};
use embedded_hal::digital::{InputPin, OutputPin};
use heapless::spsc::{Consumer, Producer, Queue};
use small_morse::{encode, State};
use systick_monotonic::*;
Expand Down
5 changes: 1 addition & 4 deletions examples/i2s-peripheral-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ publish = false
cortex-m = "0.7.3"
cortex-m-rt = { version = "0.7.0", features = ["device"] }
cortex-m-rtic = { version = "1.0.0", default-features = false }
embedded-hal = "1.0.0"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
nrf52840-hal = { features = ["rt"], path = "../../nrf52840-hal" }

[dependencies.embedded-hal]
version = "0.2.3"
features = ["unproven"]
4 changes: 2 additions & 2 deletions examples/i2s-peripheral-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod app {
spim::{self, Frequency, Mode as SPIMode, Phase, Polarity, Spim},
};
use crate::Aligned;
use embedded_hal::blocking::spi::Write;
use embedded_hal::spi::SpiBus;
use rtt_target::{rprintln, rtt_init_print};

const OFF: [u8; 9] = [0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF];
Expand Down Expand Up @@ -105,7 +105,7 @@ mod app {
10_338..=16_383 => &ORANGE,
_ => &RED,
};
<Spim<SPIM0> as Write<u8>>::write(ctx.local.rgb, color).ok();
<Spim<SPIM0> as SpiBus<u8>>::write(ctx.local.rgb, color).ok();
}
*ctx.local.transfer = i2s.rx(rx_buf).ok();
}
Expand Down
5 changes: 1 addition & 4 deletions examples/lpcomp-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ edition = "2018"
cortex-m = "0.7.3"
cortex-m-rt = { version = "0.7.0", features = ["device"] }
cortex-m-rtic = { version = "1.0.0", default-features = false }
embedded-hal = "1.0.0"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
nrf52840-hal = { features = ["rt"], path = "../../nrf52840-hal" }

[dependencies.embedded-hal]
version = "0.2.3"
features = ["unproven"]
2 changes: 1 addition & 1 deletion examples/lpcomp-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {core::panic::PanicInfo, nrf52840_hal as hal, rtt_target::rprintln};

#[rtic::app(device = crate::hal::pac, peripherals = true)]
mod app {
use embedded_hal::digital::v2::OutputPin;
use embedded_hal::digital::OutputPin;
use {
hal::{
gpio::{Level, Output, Pin, PushPull},
Expand Down

0 comments on commit 1f07a60

Please sign in to comment.