#define TEST_BUTTON_PORT 0 #define TEST_BUTTON_BIT 7 #define TEST_BUTTON_PIN_PORT 2 #define TEST_BUTTON_PIN_BIT 7 #define TEST_BUTTON_MODE_FUNC SCU_MODE_FUNC0 #define TEST_BUTTON2_PORT 5 #define TEST_BUTTON2_BIT 2 #define TEST_BUTTON2_PIN_PORT 2 #define TEST_BUTTON2_PIN_BIT 2 #define TEST_BUTTON2_MODE_FUNC SCU_MODE_FUNC4 void GINT1_IRQHandler(void) { Chip_GPIOGP_ClearIntStatus(LPC_GPIOGROUP, 1); Board_LED_Toggle(0); } int main() { Chip_SCU_PinMuxSet(TEST_BUTTON_PIN_PORT, TEST_BUTTON_PIN_BIT, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | TEST_BUTTON_MODE_FUNC) ); Chip_SCU_PinMuxSet(TEST_BUTTON2_PIN_PORT, TEST_BUTTON2_PIN_BIT, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | TEST_BUTTON2_MODE_FUNC) ); Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, TEST_BUTTON_PORT, TEST_BUTTON_BIT); Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUP, 1, TEST_BUTTON_PORT, 1 << TEST_BUTTON_BIT); Chip_GPIOGP_EnableGroupPins(LPC_GPIOGROUP, 1, TEST_BUTTON_PORT, 1 << TEST_BUTTON_BIT); Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, TEST_BUTTON2_PORT, TEST_BUTTON2_BIT); Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUP, 1, TEST_BUTTON2_PORT, 1 << TEST_BUTTON2_BIT); Chip_GPIOGP_EnableGroupPins(LPC_GPIOGROUP, 1, TEST_BUTTON2_PORT, 1 << TEST_BUTTON2_BIT); Chip_GPIOGP_SelectOrMode(LPC_GPIOGROUP, 1); Chip_GPIOGP_SelectEdgeMode(LPC_GPIOGROUP, 1); /* Enable Group GPIO interrupt 0 */ NVIC_EnableIRQ(GINT1_IRQn); while(1) { __no_operation(); } } |