SAM Frequency Meter (FREQM) Unit test.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | FREQM_CLK_FREQ_VAL 4000000 |
#define | FREQM_OFFSET 200000 |
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
static void | freqm_complete_callback (void) |
FREQM callback function. More... | |
int | main (void) |
Run FREQM unit tests. More... | |
static void | run_freqm_callback_read_test (const struct test_case *test) |
FREQM callback mode test function. More... | |
static void | run_freqm_polling_read_test (const struct test_case *test) |
Test for FREQM polling mode read. More... | |
Variables | |
struct usart_module | cdc_uart_module |
struct freqm_module | freqm_instance |
volatile bool | interrupt_flag = false |
#define FREQM_CLK_FREQ_VAL 4000000 |
Referenced by run_freqm_callback_read_test(), and run_freqm_polling_read_test().
#define FREQM_OFFSET 200000 |
Referenced by run_freqm_callback_read_test(), and run_freqm_polling_read_test().
|
static |
Initialize the USART for unit test.
Initializes the SERCOM USART used for sending the unit test status to the computer via the EDBG CDC gateway.
References usart_config::baudrate, cdc_uart_module, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, CONF_STDIO_USART, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
Referenced by main().
|
static |
FREQM callback function.
Called by FREQM driver on interrupt detection.
module | Pointer to the FREQM module (not used) |
References interrupt_flag.
Referenced by run_freqm_callback_read_test().
int main | ( | void | ) |
Run FREQM unit tests.
Initializes the system and serial output, then sets up the FREQM unit test suite and runs it.
References cdc_uart_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_freqm_callback_read_test(), run_freqm_polling_read_test(), system_init(), and test_suite_run().
|
static |
FREQM callback mode test function.
This test reads three measure data in callback mode and check the result.
test | Current test case. |
References FREQM_CALLBACK_MEASURE_DONE, FREQM_CLK_FREQ_VAL, freqm_complete_callback(), freqm_disable(), freqm_disable_callback(), freqm_enable_callback(), freqm_get_result_value(), freqm_instance, FREQM_OFFSET, freqm_register_callback(), freqm_start_measure(), FREQM_STATUS_CNT_OVERFLOW, interrupt_flag, and test_assert_true.
Referenced by main().
|
static |
Test for FREQM polling mode read.
This test reads three measure data in polling mode and check the result.
test | Current test case |
References FREQM_CLK_FREQ_VAL, freqm_enable(), freqm_get_config_defaults(), freqm_get_result_value(), freqm_init(), freqm_instance, FREQM_OFFSET, freqm_start_measure(), FREQM_STATUS_CNT_OVERFLOW, FREQM_STATUS_MEASURE_BUSY, and test_assert_true.
Referenced by main().
struct usart_module cdc_uart_module |
Referenced by cdc_uart_init().
struct freqm_module freqm_instance |
Referenced by run_freqm_callback_read_test(), and run_freqm_polling_read_test().
Referenced by freqm_complete_callback(), and run_freqm_callback_read_test().