/// read one character uint8_t serial_popchar() { uint8_t c = 0; // it's imperative that we check, because if the buffer is empty and we pop, we'll go through the whole buffer again if (buf_canread(rx)) buf_pop(rx, c); #ifdef XONXOFF if ((flowflags & FLOWFLAG_STATE_XON) == 0 && buf_canread(rx) <= 16) { // the buffer has (BUFSIZE - 16) free characters again, so send an XON flowflags = FLOWFLAG_SEND_XON; UCSR0B |= MASK(UDRIE0); } #endif return c; }
/*---------------------------------------------------------------------------*/ static void acked(void) { buf_pop(&buf, s.numsent); }