From 207417033629eecf9e3a97baf5c8787e1ddf8969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Wed, 17 Nov 2021 18:47:18 +0100 Subject: update deps to new avr-hal structure --- Cargo.toml | 13 ++++++++----- src/main.rs | 20 +++++++------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 84e5b4d..c701e20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,20 @@ [package] name = "arduino-uno-template" version = "0.0.0" -authors = ["Gustav Sörnäs "] 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 {} } -- cgit v1.2.1