Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve STOP/START handling #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions firmware/twi-slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ ISR(TWI_vect) {
break;

case TW_SR_STOP: // A STOP condition or repeated START condition has been received while still addressed as Slave
// Clear the condition immediately, so we're less likely to miss
// a START that immediately follows a STOP, and can still match
// our address
TWI_Start_Transceiver(1);
// Either way, treat it as end of transmission
if (TWI_Rx_Data_Callback) {
TWI_Rx_Data_Callback(TWI_buf, TWI_bufPtr);
}
// Release the bus and re-enable reception in un-addressed mode
TWI_Start_Transceiver(1);
break;

case TW_SR_DATA_NACK: // Previously addressed with own SLA+W; data has been received; NOT ACK has been returned
Expand Down