AnsweredAssumed Answered

adding a switch button to freedom_gpio.h :)

Question asked by kazola on May 30, 2014
Latest reply on Dec 12, 2017 by saravanan selvam

Hi, this is my code. I have removed #includes and so on. I want the PORTB_IRQHandler() to get called when I press a switch button attached to pin B7. My platform is KL05z_FRDM and I have started by modifying the LED_BLINK example

 

void PORTB_IRQHandler() { 

    LED1_TOGGLE;

}

 

void Delay( uint32_t uiCount ) {...}

 

int main (void)

{

#if(defined(CW))

    sysinit();

#endif

    gpio_init();      

    printf("\nRunning the INT project.\n");

    while(1)

    {

    }

}

 

I modified freedom_gpio.h to contemplate this:

 

#define  SW1_PORT   B

#define  SW1_BIT    7

 

However, I'm not getting any success. So my questions are few and simple:

  1. What am I doing wrong? I'm assuming all the needed initialization is done in gpio_init()'s routines, since they are already written, once I uncomment the SW* directives.
  2. Is there any starting example list? I find the learning curve of Freescale so high. Atmel and TI provide literally thousands of examples for their platforms!

 

Ok, let me know and have a nice weekend!

Outcomes