FLASHCALW example3 for SAM.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | FIBONACCI_NUM 32 |
Fibonacci number. More... | |
#define | LOWER_SYS_CLK 12000000 |
Functions | |
static void | configure_console (void) |
Configure serial console. More... | |
static void | flash_picocache_example (const char *caption, bool pico_enable) |
This is an example demonstrating Fibonacci calculation with and without PicoCache. More... | |
int | main (void) |
main function. More... | |
static uint32_t | recfibo (uint32_t n) |
Recursively calculate the nth Fibonacci number. More... | |
static void | reconfigure_com_port (void) |
Reconfigure serial console. More... | |
static void | wait_for_pushbutton (void) |
#define FIBONACCI_NUM 32 |
Fibonacci number.
Referenced by flash_picocache_example().
#define LOWER_SYS_CLK 12000000 |
Referenced by reconfigure_com_port().
|
static |
Configure serial console.
References uart_rs232_options::baudrate, and stdio_serial_init().
Referenced by main().
|
static |
This is an example demonstrating Fibonacci calculation with and without PicoCache.
caption | Caption to print before running the example. |
pico_enable | Enable PicoCache or not. |
References FIBONACCI_NUM, flashcalw_picocache_disable(), flashcalw_picocache_disable_monitor(), flashcalw_picocache_enable(), flashcalw_picocache_enable_monitor(), flashcalw_picocache_get_monitor_cnt(), flashcalw_picocache_reset_monitor(), flashcalw_picocache_set_monitor_mode(), recfibo(), time_tick_calc_delay(), and time_tick_get().
Referenced by main().
int main | ( | void | ) |
main function.
Do the Fibonacci calculation with and without PicoCache and print the calculation time to the UART console.
References board_init(), BOARD_NAME, configure_console(), flash_picocache_example(), flashcalw_set_wait_state(), reconfigure_com_port(), sysclk_get_cpu_hz(), sysclk_init(), sysclk_set_prescalers(), time_tick_init(), and wait_for_pushbutton().
|
static |
Recursively calculate the nth Fibonacci number.
n | Indicates which (positive) Fibonacci number to compute. |
Referenced by flash_picocache_example().
|
static |
Reconfigure serial console.
References sam_usart_opt_t::baudrate, LOWER_SYS_CLK, usart_enable_tx(), and usart_init_rs232().
Referenced by main().
|
static |
References delay_ms, and ioport_get_pin_level().
Referenced by main().