Sunday, March 1, 2015

It looks like peek() of AltSoftSerial is not working

It looks like peek() function of AltSoftSerial is not working. I think the following is the right code fragment. (Working for me anyways).

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];
        return rx_buffer[0];

No comments:

Post a Comment