\r
static void prvSetupHardware( void )\r
{\r
+const unsigned short usButtonInputBit = 0x01U;\r
+\r
SystemInit();\r
SystemCoreClockUpdate();\r
\r
- /* No analog inputs. */\r
- FM3_GPIO->ADE = 0x00FF;\r
- \r
/* LED seg1 to GPIO output (P18->P1F). */\r
FM3_GPIO->DDR1 = 0xFF00;\r
FM3_GPIO->PFR1 = 0x0000;\r
FM3_GPIO->DDR5 = 0x0000;\r
FM3_GPIO->PFR5 = 0x0000;\r
\r
+ /* Assign the button input as GPIO. */\r
+ FM3_GPIO->PFR1 |= usButtonInputBit;\r
\r
- /* setting INT02_1 */\r
- /* MB9BF500(120pin) pin63->P11,AN01,SIN1_1,INT02_1,RX1_2 */\r
-// GPIO->EPFR06 = 0x00000020; /* bit5,4:EINT02S=0b10 EINT-ch2 use INT02_1 */\r
- \r
-// GPIO->ADE &= 0xFFFD; /* bit2:ADE2=0b0 AN01pin use digital input/output pin */\r
- \r
-// GPIO->PFR1 |= 0x0002; /* bit2:PFR1_2=0b1 P11pin use peripheral port */\r
- /* I/O port setting end */\r
- \r
- FM3_EXTI->ENIR = 0x0000; /* INT interrupt disable */\r
- FM3_EXTI->ELVR = 0x0030; /* bit5,4:LB2,LA2=0b11 INT2 low level edge */\r
+ /* Button interrupt on falling edge. */\r
+ FM3_EXTI->ELVR = 0x0003;\r
\r
- FM3_EXTI->EICL = 0x0000; /* bit2:ECL=0b0 INT2 interrupt request clear */\r
+ /* Clear all external interrupts. */\r
+ FM3_EXTI->EICL = 0x0000;\r
\r
-// FM3_EXTI->ENIR = 0x0004; /* bit2:EN2=0b1 enable INT2 */\r
- FM3_EXTI->ENIR = 0x0001; /* Enable INT0. */\r
- \r
+ /* Enable the button interrupt. */\r
+ FM3_EXTI->ENIR |= usButtonInputBit;\r
\r
/* Setup the GPIO and the NVIC for the switch used in this simple demo. */\r
NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );\r
NVIC_EnableIRQ( EXINT0_7_IRQn );\r
-// MSS_GPIO_config( MSS_GPIO_8, MSS_GPIO_INPUT_MODE | MSS_GPIO_IRQ_EDGE_NEGATIVE );\r
-// MSS_GPIO_enable_irq( MSS_GPIO_8 );\r
}\r
/*-----------------------------------------------------------*/\r
\r