[an error occurred while processing this directive]
|
/****************************************************************************
Function :unsigned char Send_start(void)
Send a START condition to the bus and wait for the TWINT get set set to
see the result. If it failed return the TWSR value, if succes return
SUCCESS.
****************************************************************************/
unsigned char Send_start(void)
{
TWCR = ((1<<_TWINT)+(1<<_TWSTA)+(1<<_TWEN));//Send START
Wait_TWI_int(); //Wait for TWI interrupt flag set
if((TWSR != START)&&(TWSR != REP_START))//If status other than START
return TWSR; //transmitted(0x08) or Repeated
return SUCCESS; //START transmitted(0x10)
//-> error and return TWSR.
//If success return SUCCESS
}