Skip to content

Commit 0b4b24f

Browse files
goodchipfacchinm
authored andcommitted
Corrected TwoWire::onRequestService(void) to correctly reset the write buffer before send frame. (arduino#22)
* Update Wire.cpp Corrected TwoWire::onRequestService(void) to correctly reset the write buffer before send frame. txBufferIndex and txBufferLength no longer control the buffer since TwoWire::write(uint8_t data) is modified for run with megaavr architecture.
1 parent dacdfc9 commit 0b4b24f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

libraries/Wire/src/Wire.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,8 @@ void TwoWire::onRequestService(void)
341341
return;
342342
}
343343

344-
// reset tx buffer iterator vars
345-
// !!! this will kill any pending pre-master sendTo() activity
346-
txBufferIndex = 0;
347-
txBufferLength = 0;
344+
// reset slave write buffer iterator var
345+
slave_bytesToWrite = 0;
348346

349347
// alert user program
350348
user_onRequest();

0 commit comments

Comments
 (0)