From 91cffd78f4d47ddef676eba19c5a81b4a72f73ae Mon Sep 17 00:00:00 2001 From: "Sebastian H. Gabrielli" Date: Sun, 28 Apr 2024 20:46:50 +0200 Subject: [PATCH] Move data initialization into write, as it is only needed there --- prosjekt.X/i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prosjekt.X/i2c.c b/prosjekt.X/i2c.c index c0d6f45..ded4482 100644 --- a/prosjekt.X/i2c.c +++ b/prosjekt.X/i2c.c @@ -90,11 +90,10 @@ ISR(TWI0_TWIS_vect) { // Check for the data interrupt flag if (TWI0.SSTATUS & TWI_DIF_bm) { - uint8_t data = 0; if (((TWI0.SSTATUS & TWI_DIR_bm) >> TWI_DIR_bp) == 0) { // Data write Controller -> Target - data = TWI0.SDATA; + uint8_t data = TWI0.SDATA; // Send the data to the write handler i2c_write_handler(data);