Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart command #25

Merged
merged 2 commits into from
Oct 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion projects/cm_mcu/CommandLineTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/systick.h"
#include "driverlib/sysctl.h"

// local includes
#include "common/i2c_reg.h"
Expand Down Expand Up @@ -773,6 +774,16 @@ static BaseType_t sensor_summary(char *m, size_t s, const char *mm)
return pdFALSE;
}

// This command takes no arguments
static BaseType_t restart_ctl(char *m, size_t s, const char *mm)
{
int copied = 0;
copied += snprintf(m+copied, s-copied, "Restarting MCU\r\n");
SysCtlReset(); // This function does not return
return pdFALSE;
}


static
void TaskGetRunTimeStats( char *pcWriteBuffer, size_t bufferLength )
{
Expand Down Expand Up @@ -1047,7 +1058,13 @@ CLI_Command_Definition_t bootloader_command = {
0
};


static
CLI_Command_Definition_t restart_command = {
.pcCommand="restart_mcu",
.pcHelpString="restart_mcu\r\n Restart mcu\r\n",
.pxCommandInterpreter = restart_ctl,
0
};

void vCommandLineTask( void *pvParameters )
{
Expand Down Expand Up @@ -1081,6 +1098,7 @@ void vCommandLineTask( void *pvParameters )
FreeRTOS_CLIRegisterCommand(&task_stats_command );
FreeRTOS_CLIRegisterCommand(&task_command );
FreeRTOS_CLIRegisterCommand(&version_command );
FreeRTOS_CLIRegisterCommand(&restart_command );


/* Send a welcome message to the user knows they are connected. */
Expand Down