File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
examples/embassy-stm32g4/src/bin Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ no_main]
2+ #![ no_std]
3+
4+ use core:: marker:: PhantomData ;
5+ use { defmt_rtt as _, panic_probe as _} ;
6+ pub mod pac {
7+ pub use embassy_stm32:: pac:: Interrupt as interrupt;
8+ pub use embassy_stm32:: pac:: * ;
9+ }
10+
11+ #[ rtic:: app( device = pac, dispatchers = [ SPI1 ] ) ]
12+ mod app {
13+ use crate :: NotSendNotSync ;
14+
15+ #[ shared]
16+ struct Shared { }
17+
18+ // Local resources go here
19+ #[ local]
20+ struct Local { }
21+
22+ #[ init]
23+ fn init ( _cx : init:: Context ) -> ( Shared , Local ) {
24+ task1:: spawn ( ) . ok ( ) ;
25+ //task2::spawn(Default::default()).ok(); <--- This is rejected
26+ ( Shared { } , Local { } )
27+ }
28+
29+ // Optional idle, can be removed if not needed.
30+ #[ idle]
31+ fn idle ( _: idle:: Context ) -> ! {
32+ defmt:: info!( "idle" ) ;
33+
34+ loop {
35+ continue ;
36+ }
37+ }
38+
39+ // TODO: Add tasks
40+ #[ task( priority = 1 ) ]
41+ async fn task1 ( cx : task1:: Context ) {
42+ defmt:: info!( "Hello from task1!" ) ;
43+ cx. local_spawner . task2 ( Default :: default ( ) ) ;
44+ }
45+
46+ #[ task( priority = 1 , is_local_task = true ) ]
47+ async fn task2 ( _cx : task2:: Context , _nsns : super :: NotSendNotSync ) {
48+ defmt:: info!( "Hello from task1!" ) ;
49+ }
50+ }
51+
52+ #[ derive( Default ) ]
53+ struct NotSendNotSync ( PhantomData < * mut u8 > ) ;
You can’t perform that action at this time.
0 commit comments