From 24daab9c1705055eb10964840395c5411ce083c3 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Sat, 10 Dec 2022 23:48:27 -0600 Subject: [PATCH] add comments --- src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.rs b/src/main.rs index d58ee28..e0f0c18 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,16 +5,30 @@ use core::arch::asm; use core::ptr::{read_volatile, write_volatile}; +/* +PORTC{0..5} Analog +PORTC6 Reset + +PORTB{0..5} Digital {8..13} +PORTD{0..7} Digital {0..7} + +PORTB5 LED_BUILTIN + */ + const DDRB: *mut u8 = 0x24 as *mut u8; const PORTB: *mut u8 = 0x25 as *mut u8; +// ATmega328p cycle speed const CPU_SPEED: u32 = 16_000_000; #[no_mangle] pub extern "C" fn main() -> ! { + // Set all the B pins on OUTPUT mode unsafe { write_volatile(DDRB, 0b11111111) }; loop { + // if pin[5] == 1: 1^1 = 0 + // if pin[5] == 0: 0^1 = 1 let mut portb_value = unsafe { read_volatile(PORTB) }; portb_value = portb_value ^ (1 << 5); unsafe { write_volatile(PORTB, portb_value) };