Sorry for the Interruption to the current Service.

The remote buttons are interrupt driven and its supporting code is so simple.

 

 

The interrupts are configured using;

  /* Setup interrupts */

  GPIO_IntConfig (gpioPortB, 9, false, true, true);

  GPIO_IntConfig (gpioPortB, 10, false, true, true);

  NVIC_EnableIRQ(GPIO_ODD_IRQn);

  NVIC_EnableIRQ(GPIO_EVEN_IRQn);

 

I didn't even have to specify the ISR (Interrupt Service Routine) function names.

It was already done.

 

The corresponding ISRs are;

  /* Push button 0 interrupt handler */
  void GPIO_ODD_IRQHandler(){
    GPIO->IFC = 1<<9;
    IRSend(VOLUME_DOWN);

 

  }

 

  /* Push button 1 interrupt handler */
  void GPIO_EVEN_IRQHandler(){
    GPIO->IFC = 1<<10;
    IRSend(VOLUME_UP);

  }

IRSend() is just a function that I set up to send IR commands.

 

It's a easy as that!