/*! * Blink the builtin LED - the "Hello World" of embedded programming. */ #![no_std] #![no_main] use atmega_hal::{Usart, usart::Baudrate}; use embedded_hal::delay::DelayNs; use panic_halt as _; type CoreClock = atmega_hal::clock::MHz8; #[avr_device::entry] fn main() -> ! { let dp = atmega_hal::Peripherals::take().unwrap(); let pins = atmega_hal::pins!(dp); let a0 = pins.pc0; let a1 = pins.pc1; let a2 = pins.pc2; let a3 = pins.pc3; let mosi = pins.pb3; let miso = pins.pb4; let sck = pins.pb5; let rx = pins.pd0; let tx = pins.pd1; let d2 = pins.pd2; let d3 = pins.pd3; let d4 = pins.pd4; let d5 = pins.pd5; let d6 = pins.pd6; let d7 = pins.pd7; let d9 = pins.pb1; let d10 = pins.pb2; let mut led = pins.pb0.into_output(); led.set_high(); let mut delay = atmega_hal::delay::Delay::::new(); let mut serial = Usart::new( dp.USART0, rx, tx.into_output(), Baudrate::::new(57600), ); loop { led.toggle(); delay.delay_ms(1000); ufmt::uwriteln!(&mut serial, "Hello from ATmega!\r").unwrap(); } }