- uint8_t data = 0;
- bool parity = true; // odd parity
- ibm4704_error = IBM4704_ERR_NONE;
-
- idle();
- _delay_us(5); // wait for line settles
-
- /* start bit */
- WAIT(clock_lo, 100, 0x11); // wait for keyboard to send
- WAIT(data_hi, 100, 0x12); // can be delayed that long
+ static enum {
+ BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, PARITY, STOP
+ } state = BIT0;
+ // LSB first
+ static uint8_t data = 0;
+ // Odd parity
+ static uint8_t parity = false;