+
+ if (now - last_rx >= REQ_TIMEOUT) { // new packet; start over
+ buf_len = 0;
+ }
+
+ // TODO: we can probably calculate the CRC here as well
+ buffer[buf_len++] = rx_byte;
+out:
+ last_rx = now;
+}
+
+ISR(USART_TX_vect)
+{
+ UCSR0B &= ~_BV(TXCIE0); // disable further IRQs
+ ctl_pin_off();
+ buf_len = 0;
+ transmitting = 0; // enable receiving