25static char GraphicRTOS[] =
" ___ ___ ___ ___\n\r /\\ \\ /\\ \\ /\\ \\ /\\ \\\n\r /::\\ \\ \\:\\ \\ /::\\ \\ /::\\ \\\n\r /:/\\:\\ \\ \\:\\ \\ /:/\\:\\ \\ /:/\\ \\ \\\n\r /::\\~\\:\\ \\ /::\\ \\ /:/ \\:\\ \\ _\\:\\~\\ \\ \\\n\r /:/\\:\\ \\:\\__\\ /:/\\:\\__\\/:/__/ \\:\\__\\/\\ \\:\\ \\ \\__\\\n\r \\/_|::\\/:/ //:/ \\/__/\\:\\ \\ /:/ /\\:\\ \\:\\ \\/__/\n\r |:|::/ //:/ / \\:\\ /:/ / \\:\\ \\:\\__\\\n\r |:|\\/__/ \\/__/ \\:\\/:/ / \\:\\/:/ /\n\r |:| | \\::/ / \\::/ /\n\r \\|__| \\/__/ \\/__/\n\r";
59 while((inString =
readline(
">>")) != NULL){
74 static char inString[80];
79 while(letter !=
'\n' && letter !=
'\r'){
88 if(letter !=
'\n' && letter !=
'\r' && letter != 0x7F && letter != 0x1B){
89 inString[idx++] = letter;
108 char *savePtr, *quotePtr;
110 char *token, *quoteToken;
115 quoteToken = strtok_r(str,
"\"", "ePtr);
117 token = strtok_r(quoteToken,
" ", &savePtr);
123 strncpy(cmd[idx], token, strlen(token));
124 cmd[idx++][strlen(token)] =
'\0';
126 token = strtok_r(NULL,
" ", &savePtr);
130 quoteToken = strtok_r(NULL,
"\"", "ePtr);
132 if(quoteToken != NULL){
133 strncpy(cmd[idx], quoteToken, strlen(quoteToken));
134 cmd[idx++][strlen(quoteToken)] =
'\0';
149 if(strcmp(cmd[0],
"menu") == 0 || strcmp(cmd[0],
"m") == 0){
153 }
else if(strcmp(cmd[0],
"help") == 0 || strcmp(cmd[0],
"h") == 0){
157 }
else if(strcmp(cmd[0],
"echo") == 0){
161 }
else if(strcmp(cmd[0],
"measure") == 0){
165 }
else if(strcmp(cmd[0],
"display") == 0){
169 }
else if(strcmp(cmd[0],
"led") == 0){
173 }
else if(strcmp(cmd[0],
"os") == 0){
198 printf(
"%s\n\r", cmd[1]);
223 printf(
"Undefined command.\n\r");
233 for(int32_t i = 0; i < 55; i++){
236 printf(
"\n\r\n\r%s\n\r", GraphicRTOS);
237 printf(
"\n\rWelcome to the Sikender Ashraf's and Sijin Woo's OS.\n\r");
238 for(int32_t i = 0; i < 55; i++){
242 printf(
"Type \"menu\" or \"m\" to see menu...\n\r");
249 printf(
"Type \"help\" or \"h\" to see more details...\n\r");
250 printf(
"echo \"<string>\"\n\r");
251 printf(
"measure -module -channel -samples\n\r");
252 printf(
"display -device -line \"<string>\"\n\r");
253 printf(
"led -color -status\n\r");
254 printf(
"os -set\n\r");
264 for(int32_t i = 0; i < 80; i++){
267 printf(
"\n\rWelcome to the manual.\n\r");
268 for(int32_t i = 0; i < 80; i++){
275 printf(
"\techo \"<string>\"\n\r");
276 printf(
"Description:\n\r");
277 printf(
"This is the same as the echo command in linux. This is mainly to test if the \n\r");
278 printf(
"microcontroller is receiving and sending correctly.\n\r\n\r");
279 printf(
" \"<string>\"\tString to be echoed. Make sure the string is in quotations\n\r");
280 printf(
"\t\tor the whole message might not be reciprocated.\n\n\r\r");
312 printf(
"\tdisplay -device -line \"<string>\"\n\r");
313 printf(
"Description:\n\r");
314 printf(
"Displays message onto the ST7735 depending on the device and row.\n\r\n\r");
315 printf(
" device\tSpecifies which half of the screen to display the message.\n\r");
316 printf(
"\t\t\"0\" or \"top\" for top half, \"1\" or \"bottom\" for bottom half\n\r\n\r");
317 printf(
" line\t\tSpecifies which row of device section to display the message\n\r");
318 printf(
"\t\tline must be <=7 or else nothing will be displayed\n\r\n\r");
319 printf(
" \"<string\"\tString to be displayed. Make sure the string is in quotations.\n\r");
320 printf(
"\t\tor the whole message might not be reciprocated.\n\n\r\r");
324 printf(
"\tled -color\n\r");
325 printf(
"Description:\n\r");
326 printf(
"The chosen colored LED will be toggled.\n\r\n\r");
327 printf(
" color\t\tSpecifies which colored LED will be changed. The LED colors can\n\r");
328 printf(
"\t\the combined if two or more LEDs are on. If red and blue LEDs\n\r");
329 printf(
"\t\tare both on then a magenta color will appear.\n\r");
330 printf(
"\t\t -red\n\r");
331 printf(
"\t\t -green\n\r");
332 printf(
"\t\t -blue\n\r\n\r");
337 printf(
"\tos -set\n\r");
338 printf(
"Description:\n\r");
339 printf(
"This interfaces with the OS. Currently not much support is available.\n\r");
340 printf(
"Read and clear are only available\n\r\n\r");
341 printf(
" set\t\tReads/clears the periodic time counter of the OS.\n\r\n\r");
357 if(strcmp(cmd[1],
"ADC") == 0 || strcmp(cmd[1],
"-ADC") == 0 || strcmp(cmd[1],
"adc") == 0 || strcmp(cmd[1],
"-adc") == 0){
362 sscanf(cmd[2],
"%d", &channel);
370 sscanf(cmd[3],
"%d", &samples);
379 sscanf(cmd[4],
"%d", &rate);
388 printf(
"ADC data:\n\r");
414 if(strcmp(cmd[1],
"read") == 0 || strcmp(cmd[1],
"-read") == 0){
416 }
else if(strcmp(cmd[1],
"clear") == 0 || strcmp(cmd[1],
"-clear") == 0){
418 printf(
"Periodic Cleared.\n\r");
428 if(strcmp(cmd[1],
"red") == 0 || strcmp(cmd[1],
"-red") == 0){
429 printf(
"Togglin RED LED");
431 }
else if(strcmp(cmd[1],
"blue") == 0 || strcmp(cmd[1],
"-blue") == 0){
432 printf(
"Togglin BLUE LED");
434 }
else if(strcmp(cmd[1],
"clear") == 0 || strcmp(cmd[1],
"-clear") == 0){
435 printf(
"Togglin GREEN LED");
void commandOS(char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
void printGenericMenu(void)
void commandDisplay(char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
int32_t findCommandType(char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
void commandMeasure(char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
void printWelcomeMenu(void)
char * readline(char *str)
void executeCommand(int32_t cmdType, char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
void commandLED(char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
void parseString(char *str, char cmd[MAX_WORDS][MAX_CHARS_PER_WORD])
Runs on TM4C123 Command line interface.
#define MAX_CHARS_PER_WORD
INT32U OS_ReadMsTime(void)
void OS_ClearMsTime(void)
void UART_OutChar(char data)