Ejemplo n.º 1
0
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();
      }      
    }  
  }
}
Ejemplo n.º 2
0
char mgetch(void) {
  while (!mchready()) { }
  return UDR0;
}