return exists;
}
-// Prepares and executes a watchdog reset
-void system_reset( void ){
- LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
- uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4
- LPC_WDT->WDTC = 1 * (float)clk; // Reset in 1 second
- LPC_WDT->WDMOD = 0x3; // Enabled and Reset
- LPC_WDT->WDFEED = 0xAA; // Kick the dog!
- LPC_WDT->WDFEED = 0x55;
+// Prepares and executes a watchdog reset for dfu or reboot
+void system_reset( bool dfu ){
+ if(dfu) {
+ LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK
+ uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4
+ LPC_WDT->WDTC = 1 * (float)clk; // Reset in 1 second
+ LPC_WDT->WDMOD = 0x3; // Enabled and Reset
+ LPC_WDT->WDFEED = 0xAA; // Kick the dog!
+ LPC_WDT->WDFEED = 0x55;
+ }else{
+ NVIC_SystemReset();
+ }
}
else if (check_sum == reset_command_checksum)
this->reset_command(get_arguments(possible_command),new_message.stream );
else if (check_sum == dfu_command_checksum)
- this->reset_command(get_arguments(possible_command),new_message.stream );
+ this->dfu_command(get_arguments(possible_command),new_message.stream );
else if (check_sum == help_command_checksum)
this->help_command(get_arguments(possible_command),new_message.stream );
}
// Reset the system
void SimpleShell::reset_command( string parameters, StreamOutput* stream){
stream->printf("Smoothie out. Peace.\r\n");
- system_reset();
+ system_reset(false);
+}
+
+// go into dfu boot mode
+void SimpleShell::dfu_command( string parameters, StreamOutput* stream){
+ stream->printf("Entering boot mode...\r\n");
+ system_reset(true);
}
// Break out into the MRI debugging system
stream->printf("pwd\r\n");
stream->printf("cat file [limit]\r\n");
stream->printf("play file [-q]\r\n");
- stream->printf("progress\r\n");
- stream->printf("abort\r\n");
- stream->printf("reset\r\n");
+ stream->printf("progress - shows progress of current play\r\n");
+ stream->printf("abort - abort currently playing file\r\n");
+ stream->printf("reset - reset smoothie\r\n");
+ stream->printf("dfu - enter dfu boot loader\r\n");
+ stream->printf("break- break into debugger\r\n");
stream->printf("config-get [<configuration_source>] <configuration_setting>\r\n");
stream->printf("config-set [<configuration_source>] <configuration_setting> <value>\r\n");
stream->printf("config-load [<file_name>]\r\n");
void cat_command( string parameters, StreamOutput* stream );
void break_command(string parameters, StreamOutput* stream );
void reset_command(string parameters, StreamOutput* stream );
+ void dfu_command(string parameters, StreamOutput* stream );
void help_command(string parameters, StreamOutput* stream );
private: