Getting Started Application.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | BLINK_PERIOD 1000 |
LED0 blink time, LED1 blink half this time, in ms. More... | |
#define | IRQ_PRIOR_PIO 0 |
IRQ priority for PIO (The lower the value, the greater the priority) More... | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static void | Button1_Handler (uint32_t id, uint32_t mask) |
Handler for Button 1 rising edge interrupt. More... | |
static void | configure_buttons (void) |
Configure the Pushbuttons. More... | |
static void | configure_console (void) |
Interrupt handler for TC0 interrupt. More... | |
int | main (void) |
getting-started Application entry point. More... | |
static void | mdelay (uint32_t ul_dly_ticks) |
Wait for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick). More... | |
static void | ProcessButtonEvt (uint8_t uc_button) |
Process Buttons Events. More... | |
void | SysTick_Handler (void) |
Handler for System Tick interrupt. More... | |
Variables | |
volatile bool | g_b_led0_active = true |
LED0 blinking control. More... | |
volatile uint32_t | g_ul_ms_ticks = 0 |
Global g_ul_ms_ticks in milliseconds since start of application. More... | |
#define BLINK_PERIOD 1000 |
LED0 blink time, LED1 blink half this time, in ms.
#define IRQ_PRIOR_PIO 0 |
IRQ priority for PIO (The lower the value, the greater the priority)
Referenced by configure_buttons().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Handler for Button 1 rising edge interrupt.
Handle process led1 status change.
References PIN_PUSHBUTTON_1_ID, PIN_PUSHBUTTON_1_MASK, and ProcessButtonEvt().
Referenced by configure_buttons().
|
static |
Configure the Pushbuttons.
Configure the PIO as inputs and generate corresponding interrupt when pressed or released.
References Button1_Handler(), IRQ_PRIOR_PIO, PIN_PUSHBUTTON_1_ATTR, PIN_PUSHBUTTON_1_ID, PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_PIO, pio_enable_interrupt(), pio_handler_set(), pio_handler_set_priority(), pio_set_debounce_filter(), and pmc_enable_periph_clk().
Referenced by main().
|
static |
Interrupt handler for TC0 interrupt.
Toggles the state of LED#2. Configure UART console.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
getting-started Application entry point.
[main_step_sys_init]
[main_step_sys_init]
[main_step_console_init]
[main_step_console_init]
[main_step_systick_init]
[main_step_systick_init]
[main_step_btn_init]
[main_step_btn_init]
[main_step_loop]
[main_step_loop]
References board_init(), configure_buttons(), configure_console(), g_b_led0_active, IOPORT_DIR_INPUT, ioport_set_pin_dir(), ioport_set_pin_mode(), ioport_set_pin_sense_mode(), ioport_toggle_pin_level(), LED0_GPIO, LED_0_NAME, matrix_get_system_io(), matrix_set_system_io(), mdelay(), PUSHBUTTON_1_NAME, STRING_HEADER, sysclk_get_cpu_hz(), and sysclk_init().
|
static |
Wait for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick).
ul_dly_ticks | Delay to wait for, in milliseconds. |
References g_ul_ms_ticks.
Referenced by main().
|
static |
Process Buttons Events.
Change active states of LEDs when corresponding button events happened.
References g_b_led0_active, IOPORT_PIN_LEVEL_HIGH, IOPORT_PIN_LEVEL_LOW, ioport_set_pin_level(), LED0_GPIO, tc_start(), and tc_stop().
Referenced by Button1_Handler().
void SysTick_Handler | ( | void | ) |
Handler for System Tick interrupt.
Process System Tick Event Increments the g_ul_ms_ticks counter.
References g_ul_ms_ticks.
LED0 blinking control.
Referenced by main(), and ProcessButtonEvt().
volatile uint32_t g_ul_ms_ticks = 0 |
Global g_ul_ms_ticks in milliseconds since start of application.
Referenced by mdelay(), and SysTick_Handler().