static portTASK_FUNCTION(ShellTask, pvParameters) { static unsigned char cmd_buf[48]; (void)pvParameters; (void)FSSH1_ParseCommand((unsigned char*)FSSH1_CMD_HELP, FSSH1_GetStdio(), ParseCommand); /* print help and prints as well the prompt */ cmd_buf[0] = '\0'; for(;;) { #if PL_USE_USB_SCI static char_t usb_tx_buf[USB1_DATA_BUFF_SIZE]; (void)CDC1_App_Task(usb_tx_buf, sizeof(usb_tx_buf)); /* Call the USB application task */ #endif (void)FSSH1_ReadAndParseLine(cmd_buf, sizeof(cmd_buf), FSSH1_GetStdio(), ParseCommand); #if PL_HAS_QUEUE #if QUEUE_SINGLE_CHAR { unsigned char ch; FSSH1_StdIO_OutErr_FctType io = FSSH1_GetStdio()->stdOut; while((ch=QUEUE_ReceiveChar()) && ch!='\0') { io(ch); } } #else { const unsigned char *msg; msg = QUEUE_ReceiveMessage(); if (msg!=NULL) { FSSH1_SendStr(msg, FSSH1_GetStdio()->stdOut); FRTOS1_vPortFree((void*)msg); } } #endif #endif #if PL_HAS_I2C if (SHELL_i2Commands && I2C_ReceiveCommand(cmd_buf, sizeof(cmd_buf))==ERR_OK) { bool handled = FALSE; (void)ParseCommand(cmd_buf, &handled, FSSH1_GetStdio()); } #endif FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } }
static portTASK_FUNCTION(ShellTask, pvParameters) { #if PL_HAS_BLUETOOTH static unsigned char bTbuf[48]; #endif CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); static unsigned char cmd_buf[48]; #if PL_HAS_RADIO static unsigned char radio_cmd_buf[48]; #endif (void)pvParameters; /* not used */ #if PL_HAS_MAGNETOMETER LSM_Init(); /* need to do this while FreeRTOS tick is active, because of Timeout handling */ #endif #if PL_HAS_BLUETOOTH bTbuf[0]='\0'; #endif cmd_buf[0] = '\0'; #if PL_HAS_RADIO radio_cmd_buf[0] = '\0'; #endif (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { (void)CLS1_ReadAndParseWithCommandTable(cmd_buf, sizeof(cmd_buf), io, CmdParserTable); #if PL_HAS_SHELL_CMD_I2C if (I2C_ReceiveCommand(cmd_buf, sizeof(cmd_buf))==ERR_OK) { (void)CLS1_ParseWithCommandTable(cmd_buf, io, CmdParserTable); } #endif #if PL_HAS_RADIO (void)CLS1_ReadAndParseWithCommandTable(radio_cmd_buf, sizeof(radio_cmd_buf), &Radio_stdio, CmdParserTable); #endif #if PL_HAS_BLUETOOTH (void)CLS1_ReadAndParseWithCommandTable(bTbuf, sizeof(bTbuf), &BT_stdio, CmdParserTable); #endif HandleQueues(io); #if PL_HAS_WATCHDOG WDT_IncTaskCntr(WDT_TASK_ID_SHELL, 50); #endif FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } /* for */ }