From dc51b0f63aed345fcd48e12eeed63fee4211ddc1 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Wed, 30 Sep 2020 18:44:24 -0700 Subject: [PATCH] GCC did not like how I coded up the fall through comments --- src/kaleidoscope/device/keyboardio/twi.c | 31 +++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/kaleidoscope/device/keyboardio/twi.c b/src/kaleidoscope/device/keyboardio/twi.c index a17d1289..bd00c078 100644 --- a/src/kaleidoscope/device/keyboardio/twi.c +++ b/src/kaleidoscope/device/keyboardio/twi.c @@ -400,7 +400,8 @@ void twi_releaseBus(void) { ISR(TWI_vect) { switch (TW_STATUS) { // All Master - case TW_START: // sent start condition - fall through + case TW_START: // sent start condition + /* Falls through. */ case TW_REP_START: // sent repeated start condition // copy device address and r/w bit to output register and ack TWDR = twi_slarw; @@ -408,7 +409,8 @@ ISR(TWI_vect) { break; // Master Transmitter - case TW_MT_SLA_ACK: // slave receiver acked address - fall through + case TW_MT_SLA_ACK: // slave receiver acked address + /* Falls through. */ case TW_MT_DATA_ACK: // slave receiver acked data // if there is data to send, send it, otherwise stop if (twi_masterBufferIndex < twi_masterBufferLength) { @@ -442,7 +444,7 @@ ISR(TWI_vect) { break; // Master Receiver - case TW_MR_DATA_ACK: // data received, ack sent fall through + case TW_MR_DATA_ACK: // data received, ack sent // put byte into buffer twi_masterBuffer[twi_masterBufferIndex++] = TWDR; /* intentionally fall through */ @@ -475,17 +477,21 @@ ISR(TWI_vect) { #if ENABLE_TWI_SLAVE_MODE // Slave Receiver - case TW_SR_SLA_ACK: // addressed, returned ack - fall through - case TW_SR_GCALL_ACK: // addressed generally, returned ack - fall through - case TW_SR_ARB_LOST_SLA_ACK: // lost arbitration, returned ack - fall through - case TW_SR_ARB_LOST_GCALL_ACK: // lost arbitration, returned ack - fall through + case TW_SR_SLA_ACK: // addressed, returned ack + /* Falls through. */ + case TW_SR_GCALL_ACK: // addressed generally, returned ack + /* Falls through. */ + case TW_SR_ARB_LOST_SLA_ACK: // lost arbitration, returned ack + /* Falls through. */ + case TW_SR_ARB_LOST_GCALL_ACK: // lost arbitration, returned ack // enter slave receiver mode twi_state = TWI_SRX; // indicate that rx buffer can be overwritten and ack twi_rxBufferIndex = 0; twi_reply(1); break; - case TW_SR_DATA_ACK: // data received, returned ack - fall through + case TW_SR_DATA_ACK: // data received, returned ack + /* Falls through. */ case TW_SR_GCALL_DATA_ACK: // data received generally, returned ack // if there is still room in the rx buffer if (twi_rxBufferIndex < TWI_BUFFER_LENGTH) { @@ -509,14 +515,16 @@ ISR(TWI_vect) { // since we submit rx buffer to "wire" library, we can reset it twi_rxBufferIndex = 0; break; - case TW_SR_DATA_NACK: // data received, returned nack - fall through + case TW_SR_DATA_NACK: // data received, returned nack + /* Falls through. */ case TW_SR_GCALL_DATA_NACK: // data received generally, returned nack // nack back at master twi_reply(0); break; // Slave Transmitter - case TW_ST_SLA_ACK: // addressed, returned ack - fall through + case TW_ST_SLA_ACK: // addressed, returned ack + /* Falls through. */ case TW_ST_ARB_LOST_SLA_ACK: // arbitration lost, returned ack // enter slave transmitter mode twi_state = TWI_STX; @@ -543,7 +551,8 @@ ISR(TWI_vect) { twi_reply(0); } break; - case TW_ST_DATA_NACK: // received nack, we are done - fall through + case TW_ST_DATA_NACK: // received nack, we are done + /* Falls through. */ case TW_ST_LAST_DATA: // received ack, but we are done already! // ack future responses twi_reply(1);