Hi
I need a GPIO interrupt on PB2. To test my code I'd hooked up a scope on PB2 which showed the expected weak pull up - so far so good. To produce a falling edge I simply touched the pin with a flywire which was hooked to ground. Although I could observe the falling edge on the scope my code wouldn't enter the isr which would have to blink the blue LED on my Tiva Launchpad. I changed the pin port (in my boardconfig file) to port D, so and hooked the scope on PD2 - to my surprise it worked, the blue LED had blinked as expected. I know that by default PB2 is I2C however in the following code I change the pin typi to gpio input. How should I change in my code to get PB2 react to external interrupts?
boardconfig.h
// GDO0: PB2 #define CC1200_GDO0_PINPERIPHERIAL SYSCTL_PERIPH_GPIOB #define CC1200_GDO0_PORTBASE GPIO_PORTB_BASE #define CC1200_GDO0_PIN GPIO_PIN_2 #define CC1200_GDO0_PORT_INT INT_GPIOB #define CC1200_GDO0_PIN_INT GPIO_INT_PIN_2
pin init:
void board_cc1200_gdo0_handler(void) { uint32_t ui32Status; // board_blink_blue_led(); ui32Status = GPIOIntStatus(CC1200_GDO0_PORTBASE, true); GPIOIntClear(CC1200_GDO0_PORTBASE, ui32Status); if(ui32Status & CC1200_GDO0_PIN) board_blink_blue_led(); // hal_cc1200_if.board_cc1200_gdo0_isr(); // This pointer is configured in com_cc1200.c } static void board_init_cc1200_pins(void) { // GDO0 ROM_SysCtlPeripheralEnable(CC1200_GDO0_PINPERIPHERIAL); GPIOPinTypeGPIOInput(CC1200_GDO0_PORTBASE, CC1200_GDO0_PIN); GPIOPadConfigSet(CC1200_GDO0_PORTBASE, CC1200_GDO0_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); GPIOIntRegister(CC1200_GDO0_PORTBASE, board_cc1200_gdo0_handler); ROM_GPIOIntTypeSet(CC1200_GDO0_PORTBASE, CC1200_GDO0_PIN, GPIO_FALLING_EDGE); GPIOIntClear(CC1200_GDO0_PORTBASE, CC1200_GDO0_PIN); GPIOIntEnable(CC1200_GDO0_PORTBASE, CC1200_GDO0_PIN); ROM_IntEnable(CC1200_GDO0_PORT_INT);