Move data initialization into write, as it is only needed there

This commit is contained in:
Sebastian H. Gabrielli 2024-04-28 20:46:50 +02:00
parent 4666f79dd3
commit 91cffd78f4

View File

@ -90,11 +90,10 @@ ISR(TWI0_TWIS_vect) {
// Check for the data interrupt flag // Check for the data interrupt flag
if (TWI0.SSTATUS & TWI_DIF_bm) { if (TWI0.SSTATUS & TWI_DIF_bm) {
uint8_t data = 0;
if (((TWI0.SSTATUS & TWI_DIR_bm) >> TWI_DIR_bp) == 0) { if (((TWI0.SSTATUS & TWI_DIR_bm) >> TWI_DIR_bp) == 0) {
// Data write Controller -> Target // Data write Controller -> Target
data = TWI0.SDATA; uint8_t data = TWI0.SDATA;
// Send the data to the write handler // Send the data to the write handler
i2c_write_handler(data); i2c_write_handler(data);