stm32_rust_template/apps/
empty.rs1use crate::apps::App;
2
3pub struct EmptyApp {
4 initialized: bool,
5}
6
7impl EmptyApp {
8 pub fn new() -> Self {
9 Self { initialized: false }
10 }
11
12 pub fn init(&mut self) -> Result<(), i32> {
15 if self.initialized {
16 return Ok(());
17 }
18
19 self.initialized = true;
21 Ok(())
22 }
23
24 pub fn tick(&mut self) {
26 if !self.initialized {
28 let _ = self.init();
29 }
30
31 }
33}
34
35impl App for EmptyApp {
36 fn init(&mut self) -> Result<(), i32> {
37 self.init()
38 }
39 fn loop_step(&mut self) {
40 self.tick()
41 }
42}
43
44pub fn create_empty_app() -> EmptyApp {
45 EmptyApp::new()
46}