Part Number: CC2640
Tool/software: TI-RTOS
Hello Guys,
I am having problems configuring the pin interrupt for my custom designed board,
This is the hardware design showing the button and the led, i want the LED to switch on when the button is pressed and go off once its released.
int main()
{
const PIN_Config BoardGpioLedTable[] = {
// DIO 3: LED A (initially off)
LED_PIN| PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL| PIN_DRVSTR_MAX,
PIN_TERMINATE
};
const PIN_Config BoardGpioButtonTable[] = {
// DIO 2: BUTTON A (ensure pull-up as button A is also used by other ICs)
BUTTON_PIN | PIN_INPUT_EN| PIN_NOPULL | PIN_IRQ_NEGEDGE| PIN_HYSTERESIS,
PIN_TERMINATE
};
Board_init(); // initializing both the tables above
ledPinHandle = PIN_open( &ledPinState,BoardGpioLedTable );
buttonPinHandle = PIN_open( &buttonPinState,BoardGpioButtonTable );
PIN_registerIntCb(buttonPinHandle,&buttonIntCb);
PIN_setInterrupt(buttonPinHandle, BUTTON_PIN | PIN_IRQ_NEGEDGE);
BIOS_start();
}
void buttonIntCb( PIN_Handle handle, PIN_Id button_pin){
if(PIN_getInputValue(button_pin)==0)
PIN_setOutputValue(ledPinHandle, PIN_ID(3), 1);
else
PIN_setOutputValue(ledPinHandle, PIN_ID(3), 0);
}
Am i missing something here? With the interrupt handling?
Any help on this is welcome.
Thanks.
