//interrupt initialization
void IOIntInit(){
LPC_GPIOINT -> IO0IntEnF = (1 << UPbutton_PIN) | (1 << MENUTIPKA_PIN) | (1 << HOLDTIPKA_PIN) | (1 << EXITTIPKA_PIN) | (1 << LEFTTIPKA_PIN);
NVIC_EnableIRQ(EINT3_IRQn);
} |
void EINT3_IRQHandler(void){
counter1++;
if((LPC_GPIOINT -> IO0IntStatF) & (1 << UPTbutton_PIN)){
if(counter1 == 1){
__disable_irq();
_delay_ms(150);
LPC_GPIOINT -> IO0IntClr |= (1 << UPbutton_PIN);
flagIO1 = 1;
......
.....
....
|
void IOIntInit(){
//interrupt initialization
LPC_GPIO0 -> IE = (1 << UPbutton_PIN);
NVIC_EnableIRQ(EINT0_IRQn);
} |
#include "LPC11xx.h"
void PIOINT0_IRQHandler(void)
{
if (LPC_GPIO0->MIS & (1<<UPbutton_PIN) )
{
LPC_GPIO0->IC |= (1<<UPbutton_PIN); // clear interrupt for pin
}
}
int main(void) {
volatile static int i = 0 ;
/* INIT INT GPIO */
LPC_GPIO0->IS = (1<<UPbutton_PIN); // interrupt edge
LPC_GPIO0->IEV &= ~(1<<UPbutton_PIN); // falling edge generate interrupt
LPC_GPIO0->IE = (1<<UPbutton_PIN); // permission to interrupt
NVIC_EnableIRQ(EINT0_IRQn);
while(1) {
i++ ;
}
return 0 ;
}
|