keil_examples/I2C/i2c.c
/*****************************************************************************
** Function name:		I2CStart
**
** Descriptions:		Create I2C start condition, a timeout
**				value is set if the I2C never gets started,
**				and timed out. It's a fatal error. 
**
** parameters:			None
** Returned value:		true or false, return false if timed out
** 
*****************************************************************************/
Function name:         I2CStart
Descriptions:          Create I2C start condition, a timeout
value is set if the I2C never gets started,
and timed out. It's a fatal error.

None
Returned value:                true or false, return false if timed out
Function name : I2CStart Descriptions : Create I2C start condition a timeout value is set if the I2C never gets started and timed out . It ' s a fatal error . None Returned value : true or false return false if timed out
uint32_t I2CStart( uint32_t portNum )
{
  uint32_t retVal = FALSE;
  timeout[portNum] = 0;
  LPC_I2C[portNum]->CONSET = I2CONSET_STA;	
  while( 1 )
  {
	if ( I2CMasterState[portNum] == I2C_STARTED )
	{
	  retVal = TRUE;
	  break;	
	}
	if ( timeout[portNum] >= MAX_TIMEOUT )
	{
	  retVal = FALSE;
	  break;
	}
	timeout[portNum]++;
  }
  return( retVal );
}
uint32_t I2CStart ( uint32_t portNum ) { uint32_t retVal = FALSE ; timeout [ portNum ] = 0 ; LPC_I2C [ portNum ] -> CONSET = I2CONSET_STA ; while ( 1 ) { if ( I2CMasterState [ portNum ] == I2C_STARTED ) { retVal = TRUE ; break ; } if ( timeout [ portNum ] >= MAX_TIMEOUT ) { retVal = FALSE ; break ; } timeout [ portNum ] ++ ; } return ( retVal ) ; }
Function name:         I2CStart
Descriptions:          Create I2C start condition, a timeout
value is set if the I2C never gets started,
and timed out.
Function name : I2CStart Descriptions : Create I2C start condition a timeout value is set if the I2C never gets started and timed out .
/*--- Issue a start condition ---*/ /* Set Start flag */ /*--- Wait until START transmitted ---*/