Fixed bug in the TWI peripheral driver for the AVR8 devices causing incorrect failure codes to be returned in some cases (thanks to Peter K).

pull/1469/head
Dean Camera 12 years ago
parent f51c87b916
commit 730db924c9

@ -40,6 +40,7 @@
* - Fixed hardware race condition that could cause failed device enumerations for AVR8 and UC3 architectures (thanks to Mike Beyhs) * - Fixed hardware race condition that could cause failed device enumerations for AVR8 and UC3 architectures (thanks to Mike Beyhs)
* - Fixed incorrect Minimus board LED definitions (thanks to Joonas Lahtinen) * - Fixed incorrect Minimus board LED definitions (thanks to Joonas Lahtinen)
* - Fixed incorrect ordering of the linker options in the build system causing link failures in some cases * - Fixed incorrect ordering of the linker options in the build system causing link failures in some cases
* - Fixed bug in the TWI peripheral driver for the AVR8 devices causing incorrect failure codes to be returned in some cases (thanks to )
* - Library Applications: * - Library Applications:
* - Fixed broken RESET_TOGGLES_LIBUSB_COMPAT compile time option in the AVRISP-MKII project * - Fixed broken RESET_TOGGLES_LIBUSB_COMPAT compile time option in the AVRISP-MKII project
* - Fixed incompatibility in the CDC class bootloader on some systems (thanks to Sylvain Munaut) * - Fixed incompatibility in the CDC class bootloader on some systems (thanks to Sylvain Munaut)

@ -45,7 +45,7 @@ uint8_t TWI_StartTransmission(const uint8_t SlaveAddress,
TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN)); TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN));
TimeoutRemaining = (TimeoutMS * 100); TimeoutRemaining = (TimeoutMS * 100);
while (TimeoutRemaining-- && !(BusCaptured)) while (TimeoutRemaining && !(BusCaptured))
{ {
if (TWCR & (1 << TWINT)) if (TWCR & (1 << TWINT))
{ {
@ -65,6 +65,7 @@ uint8_t TWI_StartTransmission(const uint8_t SlaveAddress,
} }
_delay_us(10); _delay_us(10);
TimeoutRemaining--;
} }
if (!(TimeoutRemaining)) if (!(TimeoutRemaining))
@ -77,12 +78,13 @@ uint8_t TWI_StartTransmission(const uint8_t SlaveAddress,
TWCR = ((1 << TWINT) | (1 << TWEN)); TWCR = ((1 << TWINT) | (1 << TWEN));
TimeoutRemaining = (TimeoutMS * 100); TimeoutRemaining = (TimeoutMS * 100);
while (TimeoutRemaining--) while (TimeoutRemaining)
{ {
if (TWCR & (1 << TWINT)) if (TWCR & (1 << TWINT))
break; break;
_delay_us(10); _delay_us(10);
TimeoutRemaining--;
} }
if (!(TimeoutRemaining)) if (!(TimeoutRemaining))

Loading…
Cancel
Save