void APP_OnKeyPressed(uint8_t keys) { if (keys&1) { CLS1_SendStr((uint8_t*)"SW3 pressed!\r\n", CLS1_GetStdio()->stdOut); } else if (keys&2) { CLS1_SendStr((uint8_t*)"SW2 pressed!\r\n", CLS1_GetStdio()->stdOut); } }
/** * \brief Method to test the flash chip. * @return void */ static void TestFlash(void) { uint8_t errCode; uint8_t test=55; uint8_t result=27; uint32_t testAddr=0x0000F300; uint8_t status=1; FLASH_Init(); WAIT1_Waitms(1000); errCode = FLASH_ReadStatusReg(&status); if(errCode!=ERR_OK) { for(;;) {} } CLS1_SendStr((const unsigned char*)"\r\nStatus: ",CLS1_GetStdio()->stdOut); CLS1_SendNum16u(status,CLS1_GetStdio()->stdOut); for(;;) {} errCode = FLASH_WriteByte(testAddr,&test); if(errCode!=ERR_OK) { for(;;) {} } errCode = FLASH_ReadByte(testAddr,&result); if(errCode!=ERR_OK) { for(;;) {} } CLS1_SendStr((const unsigned char*)"\r\nOutput: ",CLS1_GetStdio()->stdOut); CLS1_SendNum16u(result,CLS1_GetStdio()->stdOut); }
void APP_OnKeyReleasedLong(uint8_t keys) { if (keys&1) { CLS1_SendStr((uint8_t*)"SW3 long released!\r\n", CLS1_GetStdio()->stdOut); } else if (keys&2) { CLS1_SendStr((uint8_t*)"SW2 long released!\r\n", CLS1_GetStdio()->stdOut); } }
static portTASK_FUNCTION(ShellTask, pvParameters) { #if PL_HAS_SD_CARD bool cardMounted = FALSE; static FAT1_FATFS fileSystemObject; #endif unsigned char buf[48]; (void)pvParameters; /* not used */ buf[0] = '\0'; (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { #if PL_HAS_SD_CARD (void)FAT1_CheckCardPresence(&cardMounted, 0 /* volume */, &fileSystemObject, CLS1_GetStdio()); if (cardMounted) { //SD_GreenLed_On(); //SD_RedLed_Off(); } else { //SD_GreenLed_Off(); //SD_RedLed_On(); } #endif (void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable); FRTOS1_vTaskDelay(50/portTICK_RATE_MS); LEDG_Neg(); } }
static void Radio_StdIOSendChar(byte ch) { #define TX_BUF_SIZE (RADIO_MAX_TX_DATA_SIZE-sizeof("stdout ")) /* data size we can transmit in one message */ unsigned char buf[TX_BUF_SIZE+sizeof("stdout ")]; uint8_t i; CLS1_GetStdio()->stdOut(ch); /* copy on local shell */ if (RadioTx_Put(ch)!=ERR_OK) { /* lost character */ } if (ch=='\n' || RadioTx_NofElements()>TX_BUF_SIZE) { /* send string over radio */ UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"stdout "); i = sizeof("stdout ")-1; while (i<sizeof(buf) && RadioTx_Get(&buf[i])==ERR_OK) { i++; } if (RADIO_SendData(buf, i)!=ERR_OK) { CLS1_GetStdio()->stdOut('\n'); CLS1_GetStdio()->stdOut('*'); CLS1_GetStdio()->stdOut('F'); CLS1_GetStdio()->stdOut('A'); CLS1_GetStdio()->stdOut('I'); CLS1_GetStdio()->stdOut('L'); CLS1_GetStdio()->stdOut('*'); CLS1_GetStdio()->stdOut('\n'); } } }
static portTASK_FUNCTION(ShellTask, pvParameters) { unsigned char buf[48]; (void)pvParameters; /* not used */ buf[0] = '\0'; (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { (void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable); FRTOS1_vTaskDelay(pdMS_TO_TICKS(10)); } }
static portTASK_FUNCTION(ShellTask, pvParameters) { unsigned char buf[32]; (void)pvParameters; /* not used */ buf[0] = '\0'; (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { (void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable); FRTOS1_vTaskDelay(50/portTICK_RATE_MS); LEDG_Neg(); } }
void SHELL_Run(void) { unsigned char buf[32]; unsigned char bTbuf[32]; buf[0]='\0'; bTbuf[0]='\0'; CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { (void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable); (void)CLS1_ReadAndParseWithCommandTable(bTbuf, sizeof(bTbuf), &BT_stdio, CmdParserTable); } }
void REF_Calibrate(bool start) { if (start) { isCalibrated = FALSE; REF_InitSensorValues(); doMinMaxCalibration = TRUE; CLS1_SendStr((unsigned char*)"start calibration...\r\n", CLS1_GetStdio()->stdOut); } else { doMinMaxCalibration = FALSE; isCalibrated = TRUE; CLS1_SendStr((unsigned char*)"calibration stopped.\r\n", CLS1_GetStdio()->stdOut); } }
void REF_DumpHistory(void) { int i; unsigned char buf[16]; CLS1_SendStr((unsigned char*)"history: #", CLS1_GetStdio()->stdOut); CLS1_SendNum16u(REF_nofHistory, CLS1_GetStdio()->stdOut); for (i=0;i<REF_NOF_SENSORS;i++) { CLS1_SendStr((unsigned char*)" 0x", CLS1_GetStdio()->stdOut); buf[0] = '\0'; UTIL1_strcatNum16Hex(buf, sizeof(buf), SensorHistory[i]); CLS1_SendStr(buf, CLS1_GetStdio()->stdOut); } CLS1_SendStr((unsigned char*)"\r\n", CLS1_GetStdio()->stdOut); }
static void WiznetSetup(void) { CLS1_SendStr((unsigned char*)"Reset W5100.\r\n", CLS1_GetStdio()->stdOut); /* reset device */ if (W5100_MemWriteByte(W5100_MR, W5100_MR_BIT_RST)!=ERR_OK) { CLS1_SendStr((unsigned char*)"Failed to reset device!\r\n", CLS1_GetStdio()->stdErr); } CLS1_SendStr((unsigned char*)"Configure network.\r\n", CLS1_GetStdio()->stdOut); /* configure network: IP address, gateway, netmask, MAC */ if (W5100_WriteConfig((w5100_config_t*)&W5100_config)!=ERR_OK) { CLS1_SendStr((unsigned char*)"Failed to set Net Configuration!\r\n", CLS1_GetStdio()->stdErr); } CLS1_SendStr((unsigned char*)"Configure RX/TX memory.\r\n", CLS1_GetStdio()->stdOut); /* we have 8 KByte we can use for the RX and TX sockets: */ if (W5100_MemWriteByte(W5100_RMSR, W5100_xMSR_SOCKET_1_MEM_SIZE_2KB |W5100_xMSR_SOCKET_2_MEM_SIZE_2KB |W5100_xMSR_SOCKET_3_MEM_SIZE_2KB |W5100_xMSR_SOCKET_4_MEM_SIZE_2KB )!=ERR_OK) { CLS1_SendStr((unsigned char*)"Failed to set RX socket memory size!\r\n", CLS1_GetStdio()->stdErr); } if (W5100_MemWriteByte(W5100_TMSR, W5100_xMSR_SOCKET_1_MEM_SIZE_2KB |W5100_xMSR_SOCKET_2_MEM_SIZE_2KB |W5100_xMSR_SOCKET_3_MEM_SIZE_2KB |W5100_xMSR_SOCKET_4_MEM_SIZE_2KB )!=ERR_OK) { CLS1_SendStr((unsigned char*)"Failed to set TX socket memory size!\r\n", CLS1_GetStdio()->stdErr); } CLS1_SendStr((unsigned char*)"done!\r\n", CLS1_GetStdio()->stdOut); }
static void WriteUltraLight(Uid *uid) { MFRC522_StatusCode status; uint8_t data[4] = {0x1, 0x2, 0x3, 0x4}; PICC_Type piccType = MFRC522_PICC_GetType(uid->sak); if (piccType != PICC_TYPE_MIFARE_UL) { CLS1_SendStr("Only works with MIFARE Ultralight cards!\r\n", CLS1_GetStdio()->stdErr); return; } status = MFRC522_MIFARE_Ultralight_Write(2, data, sizeof(data)); if (status!=STATUS_OK) { CLS1_SendStr("Failed writing!\r\n", CLS1_GetStdio()->stdErr); } }
void SHELL_SendString(unsigned char *msg) { #if PL_CONFIG_HAS_SHELL_QUEUE SQUEUE_SendString(msg); #else CLS1_SendStr(msg, CLS1_GetStdio()->stdOut); #endif }
void APP_Run(void) { DHTxx_ErrorCode res; uint16_t temperature, humidity; CLS1_ConstStdIOType *io = CLS1_GetStdio(); uint8_t buf[48]; #if DHTxx_SENSOR_TYPE_IS_DHT11 CLS1_SendStr("DHT11 Sensor Demo:\r\n", io->stdErr); #else CLS1_SendStr("DHT22 Sensor Demo:\r\n", io->stdErr); #endif WAIT1_Waitms(1000); /* wait one second after power-up to get the sensor stable */ for(;;) { res = DHTxx_Read(&temperature, &humidity); if (res!=DHTxx_OK) { /* error */ LEDR_Neg(); /* indicate error with red LED */ /* write error message */ CLS1_SendStr("ERROR: ", io->stdErr); CLS1_SendStr(DHTxx_GetReturnCodeString(res), io->stdErr); CLS1_SendStr("\r\n", io->stdErr); } else { /* ok! */ LEDG_Neg(); /* write data values */ UTIL1_strcpy(buf, sizeof(buf), "Temperature "); UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), (int32_t)temperature); UTIL1_strcat(buf, sizeof(buf), "°C, Humidity "); UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), (int32_t)humidity); UTIL1_strcat(buf, sizeof(buf), "%\r\n"); CLS1_SendStr(buf, io->stdOut); } WAIT1_Waitms(DHTxx_SENSOR_PERIOD_MS); /* can only read sensor values with a certain frequency! */ } }
static portTASK_FUNCTION(TraceTask, pvParameters) { static unsigned char buf[128]; /* global buffer, to reduce stack size. We want to send things in one piece */ (void)pvParameters; for(;;) { if (traceChannel==TRACE_TO_NONE) { FRTOS1_vTaskDelay(1000/portTICK_RATE_MS); } else if (traceChannel==TRACE_TO_SHELL) { buf[0] = '\0'; UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" => "); if (traceAccel) { int16_t x, y, z; ACCEL_GetValues(&x, &y, &z); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" X:"); UTIL1_strcatNum16sFormatted(buf, sizeof(buf), x, ' ', 6); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"; Y:"); UTIL1_strcatNum16sFormatted(buf, sizeof(buf), y, ' ', 6); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"; Z:"); UTIL1_strcatNum16sFormatted(buf, sizeof(buf), z, ' ', 6); UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStr(&buf[0], CLS1_GetStdio()->stdOut); FRTOS1_vTaskDelay(100/portTICK_RATE_MS); } FRTOS1_vTaskDelay(25/portTICK_RATE_MS); } } }
static portTASK_FUNCTION(Button, pvParameters) { CLS1_ConstStdIOType *io = CLS1_GetStdio(); (void)pvParameters; /* parameter not used */ for(;;) { /* check push button switch: turns on/off cooling immediately */ if (SW2_GetVal()==0) { /* button pressed */ FRTOS1_vTaskDelay(10/portTICK_RATE_MS); /* debounce */ if (SW2_GetVal()==0) { /* still pressed */ while(SW2_GetVal()==0) { /* wait until released */ FRTOS1_vTaskDelay(10/portTICK_RATE_MS); /* debounce */ } DisableScheduler(io); if (isPumpOn) { /* pump is on, toggle it */ SetCooling(FALSE, io); /* turn cooling off */ mySchedule.isSchedulerOn = TRUE; /* turn scheduler on again */ } else { SetCooling(TRUE, io); /* turn cooling on */ } } } FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } /* for */ }
static uint8_t HandleDataRxMessage(RAPP_MSG_Type type, uint8_t size, uint8_t *data, RNWK_ShortAddrType srcAddr, bool *handled, RPHY_PacketDesc *packet) { #if PL_HAS_SHELL uint8_t buf[32]; CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); #endif uint8_t val; (void)size; (void)packet; switch(type) { case RAPP_MSG_TYPE_DATA: /* generic data message */ *handled = TRUE; val = *data; /* get data value */ #if PL_HAS_DRIVE DRV_EnableDisable(TRUE); #endif #if PL_HAS_SHELL SHELL_SendString((unsigned char*)"Data: "); SHELL_SendString(data); SHELL_SendString((unsigned char*)" from addr 0x"); buf[0] = '\0'; #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), srcAddr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), srcAddr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); SHELL_SendString(buf); #endif /* PL_HAS_SHELL */ return ERR_OK; break; default: break; } /* switch */ return ERR_OK; }
/*! * \brief Flushes the given buffer/queue. The buffer will be sent over the radio. * \return Error code, ERR_OK for no error. */ static uint8_t FlushAndTxQueue(RSTDIO_QueueType queueType, RAPP_MSG_Type msgType) { unsigned char buf[RAPP_BUFFER_SIZE]; uint8_t i; uint8_t res = ERR_OK; uint8_t *p, ch; p = RAPP_BUF_PAYLOAD_START(buf); i = 0; while (i<RAPP_PAYLOAD_SIZE) { ch = RSTDIO_ReceiveQueueChar(queueType); if (ch=='\0') { /* queue empty */ break; } *p++ = ch; i++; } res = RAPP_PutPayload(buf, sizeof(buf), i, msgType, RSTDIO_dstAddr); if (res!=ERR_OK) { CLS1_ConstStdIOType *io = CLS1_GetStdio(); io->stdErr('*'); io->stdErr('F'); io->stdErr('A'); io->stdErr('I'); io->stdErr('L'); io->stdErr('*'); io->stdErr('\n'); return res; } return res; }
static uint8_t HandleDataRxMessage(RAPP_MSG_Type type, uint8_t size, uint8_t *data, RNWK_ShortAddrType srcAddr, bool *handled, RPHY_PacketDesc *packet) { #if PL_HAS_SHELL uint8_t buf[16]; CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); #endif uint8_t val; (void)size; (void)packet; switch(type) { case RAPP_MSG_TYPE_DATA: /* <type><size><data */ *handled = TRUE; val = *data; /* get data value */ #if PL_HAS_SHELL CLS1_SendStr((unsigned char*)"Data: ", io->stdOut); CLS1_SendNum8u(val, io->stdOut); CLS1_SendStr((unsigned char*)" from addr 0x", io->stdOut); buf[0] = '\0'; #if RNWK_SHORT_ADDR_SIZE==1 UTIL1_strcatNum8Hex(buf, sizeof(buf), srcAddr); #else UTIL1_strcatNum16Hex(buf, sizeof(buf), srcAddr); #endif UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n"); CLS1_SendStr(buf, io->stdOut); #endif return ERR_OK; default: break; } /* switch */ return ERR_OK; }
void APP_Start(void) { uint8_t val=0; uint8_t range, res; uint16_t ambient; CLS1_ConstStdIOType *io = CLS1_GetStdio(); VL_Init(); /* initialize sensor driver */ for(;;) { res = VL_ReadRangeSingle(&range); if (res!=ERR_OK) { CLS1_SendStr("ERROR Range: ", io->stdErr); CLS1_SendNum8u(res, io->stdErr); } else { CLS1_SendStr("Range: ", io->stdOut); CLS1_SendNum8u(range, io->stdOut); } res = VL_ReadAmbientSingle(&ambient); if (res!=ERR_OK) { CLS1_SendStr(" ERROR Ambient: ", io->stdErr); CLS1_SendNum8u(res, io->stdErr); } else { CLS1_SendStr(" Ambient: ", io->stdOut); CLS1_SendNum16u(ambient, io->stdOut); } CLS1_SendStr("\r\n", io->stdOut); LED1_Neg(); WAIT1_Waitms(500); } }
static portTASK_FUNCTION(ShellTask, pvParameters) { bool cardMounted = FALSE; static FAT1_FATFS fileSystemObject; unsigned char buf[48]; (void)pvParameters; /* not used */ buf[0] = '\0'; (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { (void)FAT1_CheckCardPresence(&cardMounted, 0 /* volume */, &fileSystemObject, CLS1_GetStdio()); (void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable); FRTOS1_vTaskDelay(10/portTICK_RATE_MS); LEDG_Neg(); } }
void SHELL_SendString(unsigned char *msg) { #if PL_HAS_QUEUE QUEUE_SendString(QUEUE_StdOut, msg); #else CLS1_SendStr(msg, CLS1_GetStdio()->stdOut); #endif }
void SHELL_SendString(unsigned char *msg) { #if PL_HAS_SHELL_QUEUE /*! \todo Implement function using queues */ SQUEUE_SendString(msg); #else CLS1_SendStr(msg, CLS1_GetStdio()->stdOut); #endif }
static portTASK_FUNCTION(ShellTask, pvParameters) { static unsigned char localConsole_buf[48]; #if PL_CONFIG_HAS_USB_CDC static unsigned char cdc_buf[48]; #endif #if PL_CONFIG_HAS_BLUETOOTH static unsigned char bluetooth_buf[48]; #endif #if CLS1_DEFAULT_SERIAL CLS1_ConstStdIOTypePtr ioLocal = CLS1_GetStdio(); #endif (void)pvParameters; /* not used */ #if PL_CONFIG_HAS_USB_CDC cdc_buf[0] = '\0'; #endif #if PL_CONFIG_HAS_BLUETOOTH bluetooth_buf[0] = '\0'; #endif localConsole_buf[0] = '\0'; #if CLS1_DEFAULT_SERIAL (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, ioLocal, CmdParserTable); #endif for(;;) { #if CLS1_DEFAULT_SERIAL (void)CLS1_ReadAndParseWithCommandTable(localConsole_buf, sizeof(localConsole_buf), ioLocal, CmdParserTable); #endif #if PL_CONFIG_HAS_USB_CDC (void)CLS1_ReadAndParseWithCommandTable(cdc_buf, sizeof(cdc_buf), &CDC_stdio, CmdParserTable); #endif #if PL_CONFIG_HAS_BLUETOOTH (void)CLS1_ReadAndParseWithCommandTable(bluetooth_buf, sizeof(bluetooth_buf), &BT_stdio, CmdParserTable); #endif const unsigned char *msg; msg = SQUEUE_ReceiveMessage(); if (msg!=NULL) { CLS1_SendStr(msg, CLS1_GetStdio()->stdOut); FRTOS1_vPortFree((void*)msg); } FRTOS1_vTaskDelay(40/portTICK_RATE_MS);// Muss so kurz sein, da die USB-Geschichte damit getriggert wird } /* for */ }
static portTASK_FUNCTION(Task1, pvParameters) { (void)pvParameters; /* parameter not used */ WiznetSetup(); CLS1_SendStr((unsigned char*)"Running web server...\r\n", CLS1_GetStdio()->stdOut); for(;;) { SERVER_Process(0); FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } }
void SHELL_SendString(unsigned char *msg) { /*! \todo Replace this with message queues */ #if PL_HAS_SHELL_QUEUE SQUEUE_SendString(msg); #else CLS1_SendStr(msg, CLS1_GetStdio()->stdOut); #endif }
static void Err(unsigned char *msg) { #if PL_HAS_SHELL CLS1_ConstStdIOTypePtr io = CLS1_GetStdio(); CLS1_SendStr(msg, io->stdErr); /* print error message */ #else (void)msg; /* not used */ #endif }
static portTASK_FUNCTION(ShellTask, pvParameters) { #if PL_HAS_USB_CDC static unsigned char cdc_buf[48]; #endif #if PL_HAS_BLUETOOTH static unsigned char bluetooth_buf[48]; #endif static unsigned char localConsole_buf[48]; #if CLS1_DEFAULT_SERIAL CLS1_ConstStdIOTypePtr ioLocal = CLS1_GetStdio(); #endif (void)pvParameters; /* not used */ #if PL_HAS_USB_CDC cdc_buf[0] = '\0'; #endif #if PL_HAS_BLUETOOTH bluetooth_buf[0] = '\0'; #endif localConsole_buf[0] = '\0'; #if CLS1_DEFAULT_SERIAL (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, ioLocal, CmdParserTable); #endif for(;;) { #if CLS1_DEFAULT_SERIAL (void)CLS1_ReadAndParseWithCommandTable(localConsole_buf, sizeof(localConsole_buf), ioLocal, CmdParserTable); #endif #if PL_HAS_USB_CDC (void)CLS1_ReadAndParseWithCommandTable(cdc_buf, sizeof(cdc_buf), &CDC_stdio, CmdParserTable); #endif #if PL_HAS_BLUETOOTH (void)CLS1_ReadAndParseWithCommandTable(bluetooth_buf, sizeof(bluetooth_buf), &BT_stdio, CmdParserTable); #endif #if PL_HAS_SHELL_QUEUE /*! \todo Handle shell queue */ unsigned char ch; while((ch=SQUEUE_ReceiveChar()) && ch!='\0') { #if CLS1_DEFAULT_SERIAL ioLocal->stdOut(ch); #endif #if PL_HAS_USB_CDC CDC_stdio.stdOut(ch); #endif #if PL_HAS_BLUETOOTH BT_stdio.stdOut(ch); /* copy on Bluetooth */ #endif } #endif FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } /* for */ }
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 */ }
static void ShellTask(void *pvParameters) { #if PL_CONFIG_HAS_SEGGER_RTT static unsigned char rtt_buf[48]; #endif unsigned char buf[48]; (void)pvParameters; /* not used */ buf[0] = '\0'; #if PL_CONFIG_HAS_SEGGER_RTT rtt_buf[0] = '\0'; #endif (void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable); for(;;) { (void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable); #if PL_CONFIG_HAS_SEGGER_RTT (void)CLS1_ReadAndParseWithCommandTable(rtt_buf, sizeof(rtt_buf), &RTT_Stdio, CmdParserTable); #endif FRTOS1_vTaskDelay(pdMS_TO_TICKS(10)); } }