chore: ⚰️ del unused code
This commit is contained in:
parent
9146f44c24
commit
b98a71e939
1 changed files with 0 additions and 66 deletions
66
src/a.rs
66
src/a.rs
|
@ -1,66 +0,0 @@
|
||||||
#![no_std]
|
|
||||||
#![no_main]
|
|
||||||
|
|
||||||
use panic_halt as _;
|
|
||||||
|
|
||||||
use avr_device::interrupt;
|
|
||||||
use core::cell::RefCell;
|
|
||||||
|
|
||||||
type Console = arduino_hal::hal::usart::Usart0<arduino_hal::DefaultClock>;
|
|
||||||
static CONSOLE: interrupt::Mutex<RefCell<Option<Console>>> =
|
|
||||||
interrupt::Mutex::new(RefCell::new(None));
|
|
||||||
|
|
||||||
macro_rules! print {
|
|
||||||
($($t:tt)*) => {
|
|
||||||
interrupt::free(
|
|
||||||
|cs| {
|
|
||||||
if let Some(console) = CONSOLE.borrow(cs).borrow_mut().as_mut() {
|
|
||||||
let _ = ufmt::uwrite!(console, $($t)*);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! println {
|
|
||||||
($($t:tt)*) => {
|
|
||||||
interrupt::free(
|
|
||||||
|cs| {
|
|
||||||
if let Some(console) = CONSOLE.borrow(cs).borrow_mut().as_mut() {
|
|
||||||
let _ = ufmt::uwriteln!(console, $($t)*);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn put_console(console: Console) {
|
|
||||||
interrupt::free(|cs| {
|
|
||||||
*CONSOLE.borrow(cs).borrow_mut() = Some(console);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subfunction() {
|
|
||||||
println!("We can also call println!() in a subfunction!");
|
|
||||||
}
|
|
||||||
|
|
||||||
fn demo_print_without_ln() {
|
|
||||||
for i in 0..10 {
|
|
||||||
print!("{} ", i);
|
|
||||||
}
|
|
||||||
println!("numbers!");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[arduino_hal::entry]
|
|
||||||
fn main() -> ! {
|
|
||||||
let dp = arduino_hal::Peripherals::take().unwrap();
|
|
||||||
let pins = arduino_hal::pins!(dp);
|
|
||||||
let serial = arduino_hal::default_serial!(dp, pins, 57600);
|
|
||||||
put_console(serial);
|
|
||||||
|
|
||||||
println!("Hello from main!");
|
|
||||||
subfunction();
|
|
||||||
demo_print_without_ln();
|
|
||||||
|
|
||||||
loop {}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue