Hello MSP430 Team,
I have a question regarding the function USCI_B_I2C_masterSendMultiByteStart in the example code for MSP430F5529.
void USCI_B_I2C_masterSendMultiByteStart (uint16_t baseAddress,
uint8_t txData
)
{
//Store current transmit interrupt enable
uint8_t txieStatus = HWREG8(baseAddress + OFS_UCBxIE) & UCTXIE;
//Disable transmit interrupt enable
HWREG8(baseAddress + OFS_UCBxIE) &= ~(UCTXIE);
//Send start condition.
HWREG8(baseAddress + OFS_UCBxCTL1) |= UCTR + UCTXSTT;
// //Poll for transmit interrupt flag.
// while (!(HWREG8(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ;
//Send single byte data.
HWREG8(baseAddress + OFS_UCBxTXBUF) = txData;
//Reinstate transmit interrupt enable
HWREG8(baseAddress + OFS_UCBxIE) |= txieStatus;
}
It seems after we send the first start condition, why do we need to poll for the transmit interrupt flag before putting something else in the UCBxTXBUF register?
What does this actually do?