void pollInput() { if (mchready()) { char ch = mgetch(); if (ch == '\r') { mputs(NL); *inputBufferEnd = 0; handleInputLine(); resetInputBuffer(); } else { *inputBufferEnd = ch; inputBufferEnd++; mputchar(ch); if (inputBufferEnd == inputBuffer + INPUT_BUFFER_SIZE -1) { mprintf(PSTR("ERROR: linebuffer overflow\n")); resetInputBuffer(); } } } }
char mgetch(void) { while (!mchready()) { } return UDR0; }