Commit 47cb0b9b645c98578eb9ec3554cf5d63bdc8b2ab
authorcrazyt <tobias15556@gmx.de>
Mon, 17 Aug 2015 16:59:01 +0000 (18:59 +0200)
committercrazyt <tobias15556@gmx.de>
Wed, 19 Aug 2015 16:33:14 +0000 (18:33 +0200)
simavr/sim/avr_twi.c

index 629f9a4f45ceb73384ed3e42276ef441dde2c3bc..8249ee72e238465a015a49b8370078da2ca551d4 100644 (file)
@@ -308,9 +308,15 @@ avr_twi_write(
                                                p->state & TWI_COND_ACK ?
                                                                TWI_MRX_ADR_ACK : TWI_MRX_ADR_NACK);
                        } else {
-                               _avr_twi_delay_state(p, 9,
-                                               p->state & TWI_COND_ACK ?
-                                                               TWI_MTX_ADR_ACK : TWI_MTX_ADR_NACK);
+                               if(p->state & TWI_COND_WRITE){
+                                       _avr_twi_delay_state(p, 0,
+                                                       p->state & TWI_COND_ACK ?
+                                                                       TWI_MTX_DATA_ACK : TWI_MTX_DATA_NACK);
+                               }else{
+                                       _avr_twi_delay_state(p, 9,
+                                                       p->state & TWI_COND_ACK ?
+                                                                       TWI_MTX_ADR_ACK : TWI_MTX_ADR_NACK);
+                               }
                        }
                }
                p->state &= ~TWI_COND_WRITE;