keil_examples/I2C/i2c.c
/*****************************************************************************
** Function name:		I2CEngine
**
** Descriptions:		The routine to complete a I2C transaction
**						from start to stop. All the intermitten
**						steps are handled in the interrupt handler.
**						Before this routine is called, the read
**						length, write length, I2C master buffer,
**						and I2C command fields need to be filled.
**						see i2cmst.c for more details. 
**
** parameters:			I2C port number
** Returned value:		master state of current I2C port.
** 
*****************************************************************************/
Function name:         I2CEngine
Descriptions:          The routine to complete a I2C transaction
from start to stop. All the intermitten
steps are handled in the interrupt handler.
Before this routine is called, the read
length, write length, I2C master buffer,
and I2C command fields need to be filled.
see i2cmst.c for more details.

I2C port number
Returned value:                master state of current I2C port.
Function name : I2CEngine Descriptions : The routine to complete a I2C transaction from start to stop . All the intermitten steps are handled in the interrupt handler . Before this routine is called the read length write length I2C master buffer and I2C command fields need to be filled . see i2cmst . c for more details . I2C port number Returned value : master state of current I2C port .
uint32_t I2CEngine( uint32_t portNum ) 
{
  LPC_I2C[portNum]->CONSET = I2CONSET_STA;	
  I2CMasterState[portNum] = I2C_BUSY;	
  while ( I2CMasterState[portNum] == I2C_BUSY )
  {
	if ( timeout[portNum] >= MAX_TIMEOUT )
	{
	  I2CMasterState[portNum] = I2C_TIME_OUT;
	  break;
	}
	timeout[portNum]++;
  }
  LPC_I2C[portNum]->CONCLR = I2CONCLR_STAC;
  return ( I2CMasterState[portNum] );
}
uint32_t I2CEngine ( uint32_t portNum ) { LPC_I2C [ portNum ] -> CONSET = I2CONSET_STA ; I2CMasterState [ portNum ] = I2C_BUSY ; while ( I2CMasterState [ portNum ] == I2C_BUSY ) { if ( timeout [ portNum ] >= MAX_TIMEOUT ) { I2CMasterState [ portNum ] = I2C_TIME_OUT ; break ; } timeout [ portNum ] ++ ; } LPC_I2C [ portNum ] -> CONCLR = I2CONCLR_STAC ; return ( I2CMasterState [ portNum ] ) ; }
Function name:         I2CEngine
Descriptions:          The routine to complete a I2C transaction
from start to stop.
Function name : I2CEngine Descriptions : The routine to complete a I2C transaction from start to stop .
/*--- Issue a start condition ---*/ /* Set Start flag */