Skip to content

Commit

Permalink
Workaround for SimAvr Issue buserror#453 - update status immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrwaugh committed Apr 23, 2024
1 parent d51f593 commit 5631239
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions simavr/sim/avr_twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ avr_twi_write(
avr_twi_irq_msg(msgv, p->peer_addr, avr->data[p->r_twdr]));

if (do_read) { // read ?
_avr_twi_delay_state(p, 9,
_avr_twi_delay_state(p, 0,
msgv & TWI_COND_ACK ?
TWI_MRX_DATA_ACK : TWI_MRX_DATA_NACK);
} else {
_avr_twi_delay_state(p, 9,
_avr_twi_delay_state(p, 0,
p->state & TWI_COND_ACK ?
TWI_MTX_DATA_ACK : TWI_MTX_DATA_NACK);
}
Expand All @@ -319,7 +319,7 @@ avr_twi_write(

if (p->peer_addr & 1) { // read ?
p->state |= TWI_COND_READ; // always allow read to start with
_avr_twi_delay_state(p, 9,
_avr_twi_delay_state(p, 0,
p->state & TWI_COND_ACK ?
TWI_MRX_ADR_ACK : TWI_MRX_ADR_NACK);
} else {
Expand All @@ -328,7 +328,7 @@ avr_twi_write(
p->state & TWI_COND_ACK ?
TWI_MTX_ADR_ACK : TWI_MTX_ADR_NACK);
}else{
_avr_twi_delay_state(p, 9,
_avr_twi_delay_state(p, 0,
p->state & TWI_COND_ACK ?
TWI_MTX_DATA_ACK : TWI_MTX_DATA_NACK);
}
Expand Down

0 comments on commit 5631239

Please sign in to comment.