Skip to content

Commit

Permalink
Use attribute fallthrough instead of comment
Browse files Browse the repository at this point in the history
 avr-gcc picks it up anyways
  • Loading branch information
MCUdude committed Jan 15, 2020
1 parent 3be80b6 commit 80f771f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions avr/libraries/Wire/src/utility/twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ ISR(TWI_vect)
// Master Receiver
case TW_MR_DATA_ACK: // data received, ack sent
// put byte into buffer
twi_masterBuffer[twi_masterBufferIndex++] = TWDR; // Fall through
twi_masterBuffer[twi_masterBufferIndex++] = TWDR;
__attribute__ ((fallthrough));
case TW_MR_SLA_ACK: // address sent, ack received
// ack if more bytes are expected, otherwise nack
if(twi_masterBufferIndex < twi_masterBufferLength){
Expand Down Expand Up @@ -531,7 +532,7 @@ ISR(TWI_vect)
twi_txBuffer[0] = 0x00;
}
// transmit first byte from buffer, fall
// Fall through
__attribute__ ((fallthrough));
case TW_ST_DATA_ACK: // byte sent, ack returned
// copy data to output register
TWDR = twi_txBuffer[twi_txBufferIndex++];
Expand Down
5 changes: 3 additions & 2 deletions avr/libraries/Wire1/src/utility/twi1.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ ISR(TWI1_vect)
// Master Receiver
case TW_MR_DATA_ACK: // data received, ack sent
// put byte into buffer
twi_masterBuffer[twi_masterBufferIndex++] = TWDR1; // Fall through
twi_masterBuffer[twi_masterBufferIndex++] = TWDR1;
__attribute__ ((fallthrough));
case TW_MR_SLA_ACK: // address sent, ack received
// ack if more bytes are expected, otherwise nack
if(twi_masterBufferIndex < twi_masterBufferLength){
Expand Down Expand Up @@ -532,7 +533,7 @@ ISR(TWI1_vect)
twi_txBuffer[0] = 0x00;
}
// transmit first byte from buffer, fall
// Fall through
__attribute__ ((fallthrough));
case TW_ST_DATA_ACK: // byte sent, ack returned
// copy data to output register
TWDR1 = twi_txBuffer[twi_txBufferIndex++];
Expand Down

0 comments on commit 80f771f

Please sign in to comment.