回复于:外部中断开启LED灯的例程

Home 论坛 开发和更新问题 外部中断开启LED灯的例程 回复于:外部中断开启LED灯的例程

#1948
1234qwer1234qwer
参与者

@Howard

BOARD_InitPins();
BOARD_BootClockRUN(); //时钟
BOARD_InitDebugConsole(); //串口
INTMUX_Init(INTMUX0);
INTMUX_EnableInterrupt(INTMUX0, 0, PORTB_IRQn);

a= GPIO_ReadPinInput(GPIOB,17u);
/* Print a note to terminal. */
PRINTF(“\r\n GPIO Driver example\r\n”);
PRINTF(“\r\n Press %s to turn on/off a LED \r\n”, BOARD_SW_NAME);
PRINTF(“\r\n %d”,a);
/* Init input switch GPIO. */

PORT_SetPinInterruptConfig(BOARD_SW3_PORT, BOARD_SW3_GPIO_PIN, kPORT_InterruptFallingEdge);
EnableIRQ(BOARD_SW3_IRQ);
GPIO_PinInit(BOARD_SW3_GPIO, BOARD_SW3_GPIO_PIN, &sw3_config);

我修改成这样过后还是不行

中断我是这样写的

void BOARD_SW3_IRQ_HANDLER(void){
GPIO_ClearPinsInterruptFlags(BOARD_SW3_GPIO, 1U << BOARD_SW3_GPIO_PIN);
PRINTF(“\r\n gdd\r\n”);
/* Change state of button. */
g_ButtonPress = true;
}

led灯 不亮,没有进到中断