Skip to content

Commit

Permalink
Update SoftI2CMaster.h
Browse files Browse the repository at this point in the history
  • Loading branch information
SpenceKonde committed Aug 20, 2023
1 parent 8a5472b commit d2b355b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion avr/libraries/Wire/src/SoftI2CMaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,15 @@ 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"
"_Lidelay: \n\t"
" 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
}
Expand Down

0 comments on commit d2b355b

Please sign in to comment.