diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-12-26 18:40:39 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-12-26 18:40:39 +0100 |
commit | 05b06034a8ec920e6f01632e0688d249f330aaf5 (patch) | |
tree | 3a91f4f051caa2c8f9125a850021378772e9b923 /firmware | |
parent | 6134ad40502d40b9e5db8dafa13a5fbfb5f75230 (diff) |
Firmware: Fix ACK in RX mode
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/main.c b/firmware/main.c index 85ae808..9fa542f 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -87,19 +87,21 @@ USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) DDRB &= ~bv_sda; replyBuf[0] = 0; for (i = 0; i <= 8; i++) { - if ((i == 8) && buf) { - DDRB |= bv_sda; - } + _delay_us(20); DDRB &= ~bv_scl; - _delay_us(100); + _delay_us(20); if ((i < 8) && ( PINB & bv_sda)) { replyBuf[0] |= _BV(7-i); } + _delay_us(20); + DDRB |= bv_scl; + _delay_us(20); + if ((i == 7) && buf) { + DDRB |= bv_sda; + } else if ((i == 8) && buf) { DDRB &= ~bv_sda; } - DDRB |= bv_scl; - _delay_us(100); } return 1; } |