Skip to content

Commit

Permalink
rearrange order of ACK in I2Cread
Browse files Browse the repository at this point in the history
For I2C reads, rearrange the printing of messages to *after* the ACK is generated. This adds about 0.4 ms of space between the ACK of one byte and the first bit of the next. Many devices need to clock stretch between here, but can't with v3 hardware. This fixes issues with bulk reads on many I2C devices, provided they don't need to stretch the clock longer than 0.4 ms.
  • Loading branch information
robertlong13 authored and kallisti5 committed Apr 22, 2016
1 parent 88cb150 commit 3c82068
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Firmware/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ extern int cmderror;
unsigned int I2Cread(void) {
unsigned char c = 0;
if (ackPending) {
bpSP;
//bpWmessage(MSG_ACK);
BPMSG1060;
bpSP;
if (i2cmode == SOFT) {
bbI2Cack();
}
Expand All @@ -96,6 +92,10 @@ unsigned int I2Cread(void) {
hwi2csendack(0); //all other reads get an ACK
}
#endif
bpSP;
//bpWmessage(MSG_ACK);
BPMSG1060;
bpSP;
ackPending = 0;
}

Expand Down

0 comments on commit 3c82068

Please sign in to comment.