30 lines
471 B
Rust
30 lines
471 B
Rust
#![no_main]
|
|
#![no_std]
|
|
|
|
use template_microbit as _; // global logger + panicking-behavior + memory layout
|
|
use defmt::Format; // <- derive attribute
|
|
|
|
#[derive(Format)]
|
|
struct S1<T> {
|
|
x: u8,
|
|
y: T,
|
|
}
|
|
|
|
#[derive(Format)]
|
|
struct S2 {
|
|
z: u8,
|
|
}
|
|
|
|
#[cortex_m_rt::entry]
|
|
fn main() -> ! {
|
|
let s = S1 {
|
|
x: 42,
|
|
y: S2 { z: 43 },
|
|
};
|
|
defmt::println!("s={:?}", s);
|
|
let x = 42;
|
|
defmt::println!("x={=u8}", x);
|
|
|
|
template_microbit::exit()
|
|
}
|