change ruduino to arduino-hal #2

Merged
kirbylife merged 1 commits from using_hal into main 2022-12-11 06:23:37 +00:00
2 changed files with 12 additions and 10 deletions

View File

@ -4,7 +4,8 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
ruduino = { git = "https://github.com/avr-rust/ruduino", branch = "master" } arduino-hal = { git = "https://github.com/rahix/avr-hal", features = ["arduino-uno"] }
panic-halt = "0.2.0"
[profile.release] [profile.release]
lto = true lto = true

View File

@ -1,18 +1,19 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use ruduino::cores::current::port::B5 as led; use arduino_hal::delay_ms;
use ruduino::delay::delay_ms; use panic_halt as _;
use ruduino::Pin;
#[no_mangle] #[arduino_hal::entry]
pub extern "C" fn main() -> ! { fn main() -> ! {
led::set_output(); let peripherals = arduino_hal::Peripherals::take().unwrap();
let pins = arduino_hal::pins!(peripherals);
let mut led = pins.d13.into_output();
led.set_high();
loop { loop {
led::set_high(); led.toggle();
delay_ms(1000);
led::set_low();
delay_ms(1000); delay_ms(1000);
} }
} }