You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "libs/Kernel.h"
#include "libs/utils.h"
+#include "system_LPC17xx.h"
using namespace std;
#include <string>
using std::string;
return possible_command.substr( beginning+1, possible_command.size() - beginning);
}
-
+// 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;
+}
string get_arguments( string possible_command );
-
+void system_reset( void );
#include "libs/SerialMessage.h"
#include "libs/StreamOutput.h"
#include "modules/robot/Player.h"
-#include "system_LPC17xx.h"
void SimpleShell::on_module_loaded(){
// Reset the system
void SimpleShell::reset_command( string parameters, StreamOutput* stream){
stream->printf("Smoothie out. Peace.\r\n");
-
- 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;
+ system_reset();
}
void SimpleShell::on_main_loop(void* argument){