NVIC Example.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | INT_PRIOR_HIGH 4 |
Define interrupt priority (0-15). More... | |
#define | INT_PRIOR_LOW 6 |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static void | configure_buttons (void) |
Configure the push buttons. More... | |
static void | configure_console (void) |
Configure the Console UART. More... | |
static __INLINE void | delay_ticks (uint32_t ul_dly_ticks) |
Delay number of tick Systicks (happens roughly every 1 ms). More... | |
static void | display_menu (void) |
Display menu. More... | |
static void | Int1Handler (uint32_t ul_id, uint32_t ul_mask) |
Handler for INT1, rising edge interrupt. More... | |
static void | Int2Handler (uint32_t ul_id, uint32_t ul_mask) |
Handler for INT2, rising edge interrupt. More... | |
static __INLINE void | led_config (void) |
Configure LED pins. More... | |
int | main (void) |
Application entry point. More... | |
static void | set_interrupt_priority (uint8_t int1Prior, uint8_t int2Prior) |
Set interrupt priority of INT1 and INT2. More... | |
Variables | |
volatile uint32_t | g_ul_ms_ticks = 0 |
#define INT_PRIOR_HIGH 4 |
Define interrupt priority (0-15).
A higher level corresponds to a lower priority, so level 0 is the highest interrupt priority.
Referenced by main().
#define INT_PRIOR_LOW 6 |
Referenced by main().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Configure the push buttons.
Configure the PIOs as inputs and generate corresponding interrupt when the push buttons are pressed or released.
References Int1Handler(), Int2Handler(), PIN_PUSHBUTTON_1_ATTR, PIN_PUSHBUTTON_1_ID, PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_2_ATTR, PIN_PUSHBUTTON_2_ID, PIN_PUSHBUTTON_2_MASK, PIN_PUSHBUTTON_2_PIO, pio_enable_interrupt(), pio_handler_set(), pio_handler_set_priority(), pio_set_debounce_filter(), and pmc_enable_periph_clk().
Referenced by main().
|
static |
Configure the Console UART.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_PARITY, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
Delay number of tick Systicks (happens roughly every 1 ms).
Note: As the systick has the lowest priority, lower than the PIO, the systick is not used here.
References BOARD_MCK.
Referenced by Int1Handler(), and Int2Handler().
|
static |
Display menu.
Referenced by main().
|
static |
Handler for INT1, rising edge interrupt.
In INT1, it will trigger INT2.
References delay_ticks(), gpio_set_pin_high, gpio_set_pin_low, LED0_GPIO, PIN_PUSHBUTTON_1_ID, PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_PIO, pio_disable_interrupt(), and pio_enable_interrupt().
Referenced by configure_buttons().
|
static |
Handler for INT2, rising edge interrupt.
References delay_ticks(), gpio_set_pin_high, gpio_set_pin_low, LED1_GPIO, PIN_PUSHBUTTON_2_ID, PIN_PUSHBUTTON_2_MASK, PIN_PUSHBUTTON_2_PIO, pio_disable_interrupt(), and pio_enable_interrupt().
Referenced by configure_buttons().
|
static |
int main | ( | void | ) |
Application entry point.
References board_init(), configure_buttons(), configure_console(), CONSOLE_UART, display_menu(), INT_PRIOR_HIGH, INT_PRIOR_LOW, led_config(), set_interrupt_priority(), STRING_HEADER, and uart_read().
|
static |
Set interrupt priority of INT1 and INT2.
int1Prior | Priority of interrupt 1. |
int2Prior | Priority of interrupt 2. |
Steps to change the IRQ priority:
References PIN_PUSHBUTTON_1_ID, and PIN_PUSHBUTTON_2_ID.
Referenced by main().
volatile uint32_t g_ul_ms_ticks = 0 |