keil_examples/I2C/i2c.c
/*****************************************************************************
** Function name:		I2C2Init
**
** Descriptions:		Initialize I2C controller as a master
**
** parameters:			None
** Returned value:		None
** 
*****************************************************************************/
Function name:         I2C2Init
Descriptions:          Initialize I2C controller as a master

None
Returned value:                None
Function name : I2C2Init Descriptions : Initialize I2C controller as a master None Returned value : None
void I2C2Init( void ) 
{
  LPC_SC->PCONP |= (1 << 26);
  LPC_PINCON->PINSEL0 &= ~((0x03<<20)|(0x03<<22));
  LPC_PINCON->PINSEL0 |= ((0x02<<20)|(0x02<<22));
  LPC_PINCON->PINMODE0 &= ~((0x03<<20)|(0x03<<22));
  LPC_PINCON->PINMODE0 |= ((0x02<<20)|(0x2<<22));	
  LPC_PINCON->PINMODE_OD0 |= ((0x01<<10)|(0x1<<11));	
  LPC_I2C2->CONCLR = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;    
  LPC_I2C2->SCLL   = I2SCLL_SCLL;
  LPC_I2C2->SCLH   = I2SCLH_SCLH;
  NVIC_EnableIRQ(I2C2_IRQn);
  LPC_I2C2->CONSET = I2CONSET_I2EN;
  return;
}
void I2C2Init ( void ) { LPC_SC -> PCONP |= ( 1 << 26 ) ; LPC_PINCON -> PINSEL0 &= ~ ( ( 0x03 << 20 ) | ( 0x03 << 22 ) ) ; LPC_PINCON -> PINSEL0 |= ( ( 0x02 << 20 ) | ( 0x02 << 22 ) ) ; LPC_PINCON -> PINMODE0 &= ~ ( ( 0x03 << 20 ) | ( 0x03 << 22 ) ) ; LPC_PINCON -> PINMODE0 |= ( ( 0x02 << 20 ) | ( 0x2 << 22 ) ) ; LPC_PINCON -> PINMODE_OD0 |= ( ( 0x01 << 10 ) | ( 0x1 << 11 ) ) ; LPC_I2C2 -> CONCLR = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC ; LPC_I2C2 -> SCLL = I2SCLL_SCLL ; LPC_I2C2 -> SCLH = I2SCLH_SCLH ; NVIC_EnableIRQ ( I2C2_IRQn ) ; LPC_I2C2 -> CONSET = I2CONSET_I2EN ; return ; }
Function name:         I2C2Init
Descriptions:          Initialize I2C controller as a master
Function name : I2C2Init Descriptions : Initialize I2C controller as a master
/* set PIO0.10 and PIO0.11 to I2C2 SDA and SCL */ /* function to 10 on both SDA and SCL. */ /* No pull-up no pull-down */ /*--- Clear flags ---*/ /*--- Reset registers ---*/ /* Install interrupt handler */