X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;ds=sidebyside;f=protocol%2Fadb.c;h=155d223fe7ed1f0c438a2ef5226d7b4f88c5ea7e;hb=e93188021c0b1578ffbb6e0fadcd94e1e5132dcf;hp=2f3f667b79e78c5d536adbf0bd77f14431f9b5a1;hpb=3fa50565af7ad72e895183c5caeb51591c69a45e;p=max%2Ftmk_keyboard.git diff --git a/protocol/adb.c b/protocol/adb.c index 2f3f667b..155d223f 100644 --- a/protocol/adb.c +++ b/protocol/adb.c @@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include "adb.h" +#include "debug.h" static inline void data_lo(void); @@ -63,7 +64,6 @@ static inline uint8_t wait_data_hi(uint8_t us); void adb_host_init(void) { -DDRF |= (1<<1); data_hi(); #ifdef ADB_PSW_BIT psw_hi(); @@ -83,6 +83,12 @@ bool adb_host_psw(void) } #endif +/* + * Don't call this in a row without the delay, otherwise it makes some of poor controllers + * overloaded and misses strokes. Recommended delay is 16ms. + * + * Thanks a lot, blargg! + */ uint16_t adb_host_kbd_recv(void) { uint16_t data = 0; @@ -94,6 +100,7 @@ uint16_t adb_host_kbd_recv(void) } if (!read_bit()) { // Startbit(1) // Service Request + dprintf("Startbit ERROR\n"); return -2; } @@ -105,6 +112,7 @@ uint16_t adb_host_kbd_recv(void) sei(); if (stop) { + dprintf("Stopbit ERROR\n"); return -3; } return data;