|
|
@ -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))
|
|
|
|