二、初始化GINT/*****************************************************************************
*
*初始化GINT中断组
*****************************************************************************/
void Init_Gint(void)
{
/* 初始化GPIO组中断块 */
Chip_GPIOGP_Init(LPC_GINT);
/* Configure pins as GPIO */
Chip_IOCON_PinMuxSet(LPC_IOCON, BUTTON1_PORT, BUTTON1_PIN,
(IOCON_FUNC0 | IOCON_DIGITAL_EN |IOCON_MODE_PULLUP ));//IOCON_GPIO_MODE
Chip_IOCON_PinMuxSet(LPC_IOCON, BUTTON2_PORT, BUTTON2_PIN,
(IOCON_FUNC0 | IOCON_MODE_PULLUP| IOCON_DIGITAL_EN));//IOCON_MODE_INACT
Chip_IOCON_PinMuxSet(LPC_IOCON, BUTTON3_PORT, BUTTON3_PIN,
(IOCON_FUNC0 | IOCON_DIGITAL_EN | IOCON_MODE_PULLUP ));
Chip_IOCON_PinMuxSet(LPC_IOCON, BUTTON4_PORT, BUTTON4_PIN,
(IOCON_FUNC0 | IOCON_DIGITAL_EN | IOCON_MODE_PULLUP));
/* Group GPIO interrupt 0 will be invoked when both SW1-WAKE and SW2-ISP buttons are pressed. */
Chip_GPIO_SetPinDIRInput(LPC_GPIO, BUTTON1_PORT, BUTTON1_PIN);
Chip_GPIO_SetPinDIRInput(LPC_GPIO, BUTTON2_PORT, BUTTON2_PIN);
Chip_GPIO_SetPinDIRInput(LPC_GPIO, BUTTON3_PORT, BUTTON3_PIN);
Chip_GPIO_SetPinDIRInput(LPC_GPIO, BUTTON4_PORT, BUTTON4_PIN);
/* Button 1 Setup for falling edge*/
//设置选择引脚组和端口为低电平触发
Chip_GPIOGP_SelectLowLevel(LPC_GINT, 0, BUTTON1_PORT, 1UL << BUTTON1_PIN);
//启用选择引脚组中断
Chip_GPIOGP_EnableGroupPins(LPC_GINT, 0, BUTTON1_PORT, 1UL << BUTTON1_PIN);
/* Button 2 Setup for falling edge*/
//设置选择引脚组和端口为低电平触发
Chip_GPIOGP_SelectLowLevel(LPC_GINT, 0, BUTTON2_PORT, 1UL << BUTTON2_PIN);
//启用选择引脚组中断
Chip_GPIOGP_EnableGroupPins(LPC_GINT, 0, BUTTON2_PORT, 1UL << BUTTON2_PIN);
|