MyProject.zip
0.72MB

 

 

Input: SW0(PA9) Button input using external interrupt

Output: LED0 Toggle (Nearby SW0)

Operation: External Interrupt will be generated each edge such as rising and falling

              LED0 toggles when each external interrupt is generated

 

 

#include 

int main(void)
{
    /* Initializes MCU, drivers and middleware */
    atmel_start_init();

   /* Replace with your application code */
   EXTERNAL_IRQ_0_example();
   while (1) {
   }
}

main.c

 

 

#include "driver_examples.h"
#include "driver_init.h"
#include "utils.h"

static void button_on_PA9_pressed(void)
{
    gpio_toggle_pin_level(LED0);
}

/**
 * Example of using EXTERNAL_IRQ_0
 */
void EXTERNAL_IRQ_0_example(void)
{
    ext_irq_register(PIO_PA9_IDX, button_on_PA9_pressed);
}

driver_examples.c

Posted by KennyShin
,