diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-11-17 18:47:18 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-11-17 18:47:18 +0100 |
| commit | 207417033629eecf9e3a97baf5c8787e1ddf8969 (patch) | |
| tree | 8a39e466eb85e88634639a0df9b7e7f65425b6ed | |
| parent | 84f4059828890e2c4d866b1a9580c2ef031f9323 (diff) | |
| download | template-207417033629eecf9e3a97baf5c8787e1ddf8969.tar.gz | |
update deps to new avr-hal structuremain
| -rw-r--r-- | Cargo.toml | 13 | ||||
| -rw-r--r-- | src/main.rs | 20 |
2 files changed, 15 insertions, 18 deletions
@@ -1,17 +1,20 @@ [package] name = "arduino-uno-template" version = "0.0.0" -authors = ["Gustav Sörnäs <gustav@sornas.net>"] edition = "2018" [dependencies] panic-halt = "0.2.0" +embedded-hal = "0.2.3" -[dependencies.arduino-uno] -git = "https://github.com/rahix/avr-hal" -rev = "a202778" +[dependencies.arduino-hal] +git = "https://github.com/Rahix/avr-hal" +rev = "c9b92686c019351f48ad41f093fa15a9d2f25542" +features = ["arduino-uno"] + +[dependencies.avr-device] +version = "0.3" -# Configure the build for minimal size [profile.dev] panic = "abort" lto = true diff --git a/src/main.rs b/src/main.rs index 0059fde..21f894b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,16 @@ #![no_std] #![no_main] -use arduino_uno::prelude::*; use panic_halt as _; -#[arduino_uno::entry] +#[arduino_hal::entry] fn main() -> ! { - let dp = arduino_uno::Peripherals::take().unwrap(); + let dp = arduino_hal::Peripherals::take().unwrap(); + let pins = arduino_hal::pins!(dp); - let mut pins = arduino_uno::Pins::new(dp.PORTB, dp.PORTC, dp.PORTD); + // Digital pin 13 is also connected to an onboard LED marked "L" + let mut led = pins.d13.into_output(); + led.set_high(); - let mut led = pins.d13.into_output(&mut pins.ddr); - led.set_low().void_unwrap(); - - loop { - led.set_high().void_unwrap(); - arduino_uno::delay_ms(50); - led.set_low().void_unwrap(); - arduino_uno::delay_ms(950); - } + loop {} } |
