Merge pull request #38 from jacobschloss/xmega_twi_caps

Fix mismatched capitalization of "TWI" for the XMEGA architecture TWI driver.
pull/1469/head
Dean Camera 10 years ago
commit 3692325f58

@ -53,7 +53,7 @@ uint8_t TWI_StartTransmission(TWI_t* const TWI,
} }
else if ((status & (TWI_MASTER_WIF_bm | TWI_MASTER_RXACK_bm)) == (TWI_MASTER_WIF_bm | TWI_MASTER_RXACK_bm)) else if ((status & (TWI_MASTER_WIF_bm | TWI_MASTER_RXACK_bm)) == (TWI_MASTER_WIF_bm | TWI_MASTER_RXACK_bm))
{ {
TWI_StopTransmission(twi); TWI_StopTransmission(TWI);
return TWI_ERROR_SlaveResponseTimeout; return TWI_ERROR_SlaveResponseTimeout;
} }
else if (status & (TWI_MASTER_WIF_bm | TWI_MASTER_RIF_bm)) else if (status & (TWI_MASTER_WIF_bm | TWI_MASTER_RIF_bm))
@ -67,7 +67,7 @@ uint8_t TWI_StartTransmission(TWI_t* const TWI,
if (!(TimeoutRemaining)) { if (!(TimeoutRemaining)) {
if (TWI->MASTER.STATUS & TWI_MASTER_CLKHOLD_bm) { if (TWI->MASTER.STATUS & TWI_MASTER_CLKHOLD_bm) {
TWI_StopTransmission(twi); TWI_StopTransmission(TWI);
} }
} }
@ -114,24 +114,24 @@ uint8_t TWI_ReadPacket(TWI_t* const TWI,
{ {
uint8_t ErrorCode; uint8_t ErrorCode;
if ((ErrorCode = TWI_StartTransmission(twi, (SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE, if ((ErrorCode = TWI_StartTransmission(TWI, (SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE,
TimeoutMS)) == TWI_ERROR_NoError) TimeoutMS)) == TWI_ERROR_NoError)
{ {
while (InternalAddressLen--) while (InternalAddressLen--)
{ {
if (!(TWI_SendByte(twi, *(InternalAddress++)))) if (!(TWI_SendByte(TWI, *(InternalAddress++))))
{ {
ErrorCode = TWI_ERROR_SlaveNAK; ErrorCode = TWI_ERROR_SlaveNAK;
break; break;
} }
} }
if ((ErrorCode = TWI_StartTransmission(twi, (SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_READ, if ((ErrorCode = TWI_StartTransmission(TWI, (SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_READ,
TimeoutMS)) == TWI_ERROR_NoError) TimeoutMS)) == TWI_ERROR_NoError)
{ {
while (Length--) while (Length--)
{ {
if (!(TWI_ReceiveByte(twi, Buffer++, (Length == 0)))) if (!(TWI_ReceiveByte(TWI, Buffer++, (Length == 0))))
{ {
ErrorCode = TWI_ERROR_SlaveNAK; ErrorCode = TWI_ERROR_SlaveNAK;
break; break;
@ -139,13 +139,13 @@ uint8_t TWI_ReadPacket(TWI_t* const TWI,
} }
} }
TWI_StopTransmission(twi); TWI_StopTransmission(TWI);
} }
return ErrorCode; return ErrorCode;
} }
uint8_t TWI_WritePacket(TWI_t* const twi, uint8_t TWI_WritePacket(TWI_t* const TWI,
const uint8_t SlaveAddress, const uint8_t SlaveAddress,
const uint8_t TimeoutMS, const uint8_t TimeoutMS,
const uint8_t* InternalAddress, const uint8_t* InternalAddress,
@ -155,12 +155,12 @@ uint8_t TWI_WritePacket(TWI_t* const twi,
{ {
uint8_t ErrorCode; uint8_t ErrorCode;
if ((ErrorCode = TWI_StartTransmission(twi, (SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE, if ((ErrorCode = TWI_StartTransmission(TWI, (SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE,
TimeoutMS)) == TWI_ERROR_NoError) TimeoutMS)) == TWI_ERROR_NoError)
{ {
while (InternalAddressLen--) while (InternalAddressLen--)
{ {
if (!(TWI_SendByte(twi, *(InternalAddress++)))) if (!(TWI_SendByte(TWI, *(InternalAddress++))))
{ {
ErrorCode = TWI_ERROR_SlaveNAK; ErrorCode = TWI_ERROR_SlaveNAK;
break; break;
@ -169,14 +169,14 @@ uint8_t TWI_WritePacket(TWI_t* const twi,
while (Length--) while (Length--)
{ {
if (!(TWI_SendByte(twi, *(Buffer++)))) if (!(TWI_SendByte(TWI, *(Buffer++))))
{ {
ErrorCode = TWI_ERROR_SlaveNAK; ErrorCode = TWI_ERROR_SlaveNAK;
break; break;
} }
} }
TWI_StopTransmission(twi); TWI_StopTransmission(TWI);
} }
return ErrorCode; return ErrorCode;

Loading…
Cancel
Save