diff --git a/README.md b/README.md index 1bc7d54..57a2892 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,4 @@ The scope of this setting is per TCP session. | `postfilter <0/1> rate ` | Set postfilter output data rate | | `load` | Restore configuration from EEPROM | | `save` | Save configuration to EEPROM | +| `reset` | Reset the device | diff --git a/src/command_parser.rs b/src/command_parser.rs index 6ed73c0..ac8473c 100644 --- a/src/command_parser.rs +++ b/src/command_parser.rs @@ -134,6 +134,7 @@ pub enum Command { Quit, Load, Save, + Reset, Show(ShowCommand), Reporting(bool), /// PWM parameter setting @@ -410,6 +411,7 @@ fn command(input: &[u8]) -> IResult<&[u8], Result> { alt((value(Ok(Command::Quit), tag("quit")), value(Ok(Command::Load), tag("load")), value(Ok(Command::Save), tag("save")), + value(Ok(Command::Reset), tag("reset")), map(report, Ok), pwm, center_point, diff --git a/src/main.rs b/src/main.rs index 946fd2f..4d92090 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ use stm32f4xx_hal::{ rcc::RccExt, watchdog::IndependentWatchdog, time::{U32Ext, MegaHertz}, - stm32::{CorePeripherals, Peripherals}, + stm32::{CorePeripherals, Peripherals, SCB}, }; use smoltcp::{ time::Instant, @@ -458,6 +458,9 @@ fn main() -> ! { } } } + Command::Reset => { + SCB::sys_reset(); + } } Ok(SessionOutput::Error(e)) => { let _ = writeln!(socket, "Command error: {:?}", e);