File tree 1 file changed +11
-2
lines changed
libraries/Wire/src/utility
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ static void (*twi_onSlaveReceive)(uint8_t*, int);
60
60
61
61
static uint8_t twi_masterBuffer [TWI_BUFFER_LENGTH ];
62
62
static volatile uint8_t twi_masterBufferIndex ;
63
- static volatile uint8_t twi_masterBufferLength ;
63
+ static volatile int8_t twi_masterBufferLength ;
64
64
65
65
static uint8_t twi_txBuffer [TWI_BUFFER_LENGTH ];
66
66
static volatile uint8_t twi_txBufferIndex ;
@@ -552,7 +552,16 @@ ISR(TWI_vect)
552
552
__attribute__ ((fallthrough ));
553
553
case TW_MR_SLA_ACK : // address sent, ack received
554
554
// ack if more bytes are expected, otherwise nack
555
- if (twi_masterBufferIndex < twi_masterBufferLength ){
555
+ if (twi_masterBufferLength == -1 ){
556
+ // required data length 0 bytes, no need to get data
557
+ if (twi_sendStop ){
558
+ twi_stop ();
559
+ } else {
560
+ twi_inRepStart = true;
561
+ TWCR = _BV (TWINT ) | _BV (TWSTA )| _BV (TWEN ) ;
562
+ twi_state = TWI_READY ;
563
+ }
564
+ }else if (twi_masterBufferIndex < twi_masterBufferLength ){
556
565
twi_reply (1 );
557
566
}else {
558
567
twi_reply (0 );
You can’t perform that action at this time.
0 commit comments