~ruther/map-led-strip

ref: 4fd54179cb610352ddd5b07ea9742994cc65aee8 map-led-strip/src/commands/hello_world_command.rs -rw-r--r-- 730 bytes
4fd54179 — František Boháček feat: add hello world command 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use embedded_hal::serial::{Read, Write};
use esp_println::{print, println};
use crate::command_handler::{CommandData, CommandHandleError, SpecificCommandHandler};
use crate::map::Map;

pub struct HelloWorldCommand {

}

impl HelloWorldCommand {
    pub fn new() -> Self {
        Self {}
    }
}

impl SpecificCommandHandler for HelloWorldCommand
{
    fn handle(&self, command: &mut CommandData) -> Result<(), CommandHandleError>
    {
        print!("Hello world!");
        for c in &command.command.full[command.command.parsed_arguments[0].data.len()..] {
            print!("{}", c);
        }
        println!("\r");

        Ok(())
    }

    fn help(&self) -> &'static str {
        "<x> - prints Hello world! <x>"
    }
}
Do not follow this link