From d2b355b835979206c11bb8ede814f7a1336c01b3 Mon Sep 17 00:00:00 2001 From: Spence Konde Date: Sun, 20 Aug 2023 09:25:08 -0400 Subject: [PATCH] Update SoftI2CMaster.h --- avr/libraries/Wire/src/SoftI2CMaster.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/avr/libraries/Wire/src/SoftI2CMaster.h b/avr/libraries/Wire/src/SoftI2CMaster.h index ad946484..41682cbe 100644 --- a/avr/libraries/Wire/src/SoftI2CMaster.h +++ b/avr/libraries/Wire/src/SoftI2CMaster.h @@ -199,6 +199,7 @@ void i2c_delay_half(void) __asm__ __volatile__ (" ret"); // 7 cycles for call and return #else + uint8_t temp = 0; __asm__ __volatile__ ( " ldi r25, %[DELAY] ; load delay constant ; 4C \n\t" @@ -206,7 +207,7 @@ void i2c_delay_half(void) " dec r25 ; decrement counter ; 4C + xC \n\t" " brne _Lidelay ; 5C+(x-1)2C + xC\n\t" " ret ; 9C+(x-1)2C + xC = 7C + xC" - : : [DELAY] "M" I2C_DELAY_COUNTER : "r25"); + :'+d' ((uint8_t) temp) : [DELAY] "M" I2C_DELAY_COUNTER); // 7 cycles + 3 times x cycles #endif }