File tree Expand file tree Collapse file tree 4 files changed +14
-5
lines changed
Expand file tree Collapse file tree 4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ members = ["testsuite"]
1111[dependencies ]
1212cortex-m = " 0.6.4"
1313cortex-m-rt = " 0.6.13"
14- defmt = " 0.1.0 "
14+ defmt = " 0.1.2 "
1515defmt-rtt = " 0.1.0"
1616panic-probe = { version = " 0.1.0" , features = [" print-defmt" ] }
1717# TODO(4) enter your HAL here
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
77fn main ( ) -> ! {
88 defmt:: info!( "main" ) ;
99
10- panic ! ( )
10+ defmt :: panic!( )
1111}
Original file line number Diff line number Diff line change 33use core:: sync:: atomic:: { AtomicUsize , Ordering } ;
44
55use defmt_rtt as _; // global logger
6- use panic_probe as _;
76// TODO(5) adjust HAL import
87// use some_hal as _; // memory layout
98
9+ use panic_probe as _;
10+
11+ // same panicking *behavior* as `panic-probe` but doesn't print a panic message
12+ // this prevents the panic message being printed *twice* when `defmt::panic` is invoked
13+ #[ defmt:: panic_handler]
14+ fn panic ( ) -> ! {
15+ cortex_m:: asm:: udf ( )
16+ }
17+
1018#[ defmt:: timestamp]
1119fn timestamp ( ) -> u64 {
1220 static COUNT : AtomicUsize = AtomicUsize :: new ( 0 ) ;
Original file line number Diff line number Diff line change 22#![ no_main]
33
44use { { crate_name} } as _; // memory layout + panic handler
5+ use defmt:: { assert, assert_eq} ;
56
67// See https://crates.io/crates/defmt-test/0.1.0 for more documentation (e.g. about the 'state'
78// feature)
@@ -13,7 +14,7 @@ mod tests {
1314 }
1415
1516 #[ test]
16- fn assert_false ( ) {
17- assert ! ( false , "TODO: write actual tests" )
17+ fn assert_eq ( ) {
18+ assert_eq ! ( 24 , 42 , "TODO: write actual tests" )
1819 }
1920}
You can’t perform that action at this time.
0 commit comments