From: richardbarry Date: Wed, 4 May 2011 20:12:40 +0000 (+0000) Subject: Change the main_blinky for the FM3 demo to use falling edge interrupts on the button... X-Git-Tag: V7.0.1~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c8b1d67b475d32d30466a37c9b43aecafaa65737;p=freertos Change the main_blinky for the FM3 demo to use falling edge interrupts on the button input. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1408 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c b/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c index 448ca61cf..a0d50a7fa 100644 --- a/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c +++ b/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c @@ -308,12 +308,11 @@ unsigned long ulReceivedValue; static void prvSetupHardware( void ) { +const unsigned short usButtonInputBit = 0x01U; + SystemInit(); SystemCoreClockUpdate(); - /* No analog inputs. */ - FM3_GPIO->ADE = 0x00FF; - /* LED seg1 to GPIO output (P18->P1F). */ FM3_GPIO->DDR1 = 0xFF00; FM3_GPIO->PFR1 = 0x0000; @@ -330,30 +329,21 @@ static void prvSetupHardware( void ) FM3_GPIO->DDR5 = 0x0000; FM3_GPIO->PFR5 = 0x0000; + /* Assign the button input as GPIO. */ + FM3_GPIO->PFR1 |= usButtonInputBit; - /* setting INT02_1 */ - /* MB9BF500(120pin) pin63->P11,AN01,SIN1_1,INT02_1,RX1_2 */ -// GPIO->EPFR06 = 0x00000020; /* bit5,4:EINT02S=0b10 EINT-ch2 use INT02_1 */ - -// GPIO->ADE &= 0xFFFD; /* bit2:ADE2=0b0 AN01pin use digital input/output pin */ - -// GPIO->PFR1 |= 0x0002; /* bit2:PFR1_2=0b1 P11pin use peripheral port */ - /* I/O port setting end */ - - FM3_EXTI->ENIR = 0x0000; /* INT interrupt disable */ - FM3_EXTI->ELVR = 0x0030; /* bit5,4:LB2,LA2=0b11 INT2 low level edge */ + /* Button interrupt on falling edge. */ + FM3_EXTI->ELVR = 0x0003; - FM3_EXTI->EICL = 0x0000; /* bit2:ECL=0b0 INT2 interrupt request clear */ + /* Clear all external interrupts. */ + FM3_EXTI->EICL = 0x0000; -// FM3_EXTI->ENIR = 0x0004; /* bit2:EN2=0b1 enable INT2 */ - FM3_EXTI->ENIR = 0x0001; /* Enable INT0. */ - + /* Enable the button interrupt. */ + FM3_EXTI->ENIR |= usButtonInputBit; /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); NVIC_EnableIRQ( EXINT0_7_IRQn ); -// MSS_GPIO_config( MSS_GPIO_8, MSS_GPIO_INPUT_MODE | MSS_GPIO_IRQ_EDGE_NEGATIVE ); -// MSS_GPIO_enable_irq( MSS_GPIO_8 ); } /*-----------------------------------------------------------*/