PaulStoffregen / AltSoftSerial

Software emulated serial using hardware timers for improved compatibility
http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
328 stars 131 forks source link

peek seems not working #11

Closed pinebud77 closed 8 years ago

pinebud77 commented 9 years ago

It looks like the following code is working for me.

int AltSoftSerial::peek(void) { uint8_t head, tail;

head = rx_buffer_head;
tail = rx_buffer_tail;
if (head == tail) return -1;
if (tail + 1 < RX_BUFFER_SIZE)
    return rx_buffer[tail+1];
else
    return rx_buffer[0];

}

PaulStoffregen commented 8 years ago

fixed by https://github.com/PaulStoffregen/AltSoftSerial/commit/23c636bc562312fb213a832a732880e6d7f5bb1f