void LibrariesINFC ( void ){ // Setting alarm and monitor Tasks into Pause status if (!idleMode_Alarm) { iddleMode_AlarmCTRL_Task (true); } if (!seqMode_Monitor) { sequentialMode_MonitorCTRL_Task(true);} ERASE_CONSOLE iprintf("-------------------------------------------------------------------------------\r\n" ); iprintf("------------------------------- LIBRARIES MENU --------------------------------\r\n" ); iprintf("-------------------------------------------------------------------------------\r\n" ); iprintf(" (1) I2C&SPILibrary - Communications\n"); iprintf(" (2) RDACLibrary - Digital Rheostats\n"); iprintf(" (3) AGCLibrary - Automatic Gain Control\n"); iprintf(" (4) RelayLibrary - Relays\n"); iprintf(" (5) MUXLibrary - Voltage and Current measuring\n"); iprintf("\n (e) EXIT TO GENERAL MENU \r\n" ); iprintf("-------------------------------------------------------------------------------\r\n" ); iprintf("\r\nEnter command: " ); categorySelectionINFC = sgetchar( 0 ); iprintf("%c\n", categorySelectionINFC); iprintf("\n-------------------------------------------------------------------------------\r\n" ); processCommandLibraryINFC(); }
/* * @brief Pull characters out of the low-level serial buffer. * Process CRLF silliness, then put the processed messages onto a queue * needs to be called periodically. Called from heartbeat thread at 50hz * with 256 byte buffer @ 115200bps, the buffer will fill in 0.022 sec * should be OK... * * TODO: Is it still at 115200bps??? */ static boolean serialStringUpdate(void) { int val; char c; boolean returnVal = FALSE; do { val = sgetchar(); if (val != -1) { c = (char)val; // process cr/lf silliness if ((c == '\r') || (c == '\n')) { if ((prevCRLF == 0) || (prevCRLF == c)){ // We have a new string: either with a new crlf char, or a repeated cr or lf serialCommandString[serialCommandStringIdx] = 0; serialCommandStringIdx = 0; prevCRLF = c; returnVal = TRUE; break; } else { // your prev char was a cr or lf, but not the same as c. ignore this one // this deals with crlf or lfcr prevCRLF = 0; } } else { if(serialCommandStringIdx < (SERIAL_INPUT_STRING_SIZE - 1)) { serialCommandString[serialCommandStringIdx++] = c; } else { serialCommandString[serialCommandStringIdx] = 0; } prevCRLF = 0; } } //} while (c != -1); } while (val != -1); //TODO: how could this have previously worked? return returnVal; }