]> git.sur5r.net Git - freertos/commitdiff
Change the main_blinky for the FM3 demo to use falling edge interrupts on the button...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 4 May 2011 20:12:40 +0000 (20:12 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 4 May 2011 20:12:40 +0000 (20:12 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1408 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c

index 448ca61cf940bb0fe9fbcc73aeb812337341ee09..a0d50a7fad47d7180f555ed2337006dee446586f 100644 (file)
@@ -308,12 +308,11 @@ unsigned long ulReceivedValue;
 \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
@@ -330,30 +329,21 @@ static void prvSetupHardware( void )
        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