SAM RTC Count Unit test.
Copyright (c) 2015-2020 Microchip Technology Inc. and its subsidiaries.
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
int | main (void) |
Run RTC unit tests. More... | |
static void | rtc_count_match_callback (void) |
static void | run_rtc_count_interrupt_test (const struct test_case *test) |
Test for RTC call_back mode test. More... | |
static void | run_rtc_count_test (const struct test_case *test) |
Test for RTC count polled mode test. More... | |
Variables | |
struct usart_module | cdc_uart_module |
volatile bool | interrupt_flag = false |
struct rtc_module | rtc_inst |
|
static |
Initialize the USART for unit test.
Initializes the SERCOM USART (SERCOM4) 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().
int main | ( | void | ) |
Run RTC unit tests.
Initializes the system and serial output, then sets up the RTC unit test suite and runs it.
References cdc_uart_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, delay_init(), run_rtc_count_interrupt_test(), run_rtc_count_test(), system_init(), and test_suite_run().
|
static |
References interrupt_flag.
Referenced by run_rtc_count_interrupt_test().
|
static |
Test for RTC call_back mode test.
test make compare1 compare match call_back test.
References delay_ms, interrupt_flag, RTC_COUNT_CALLBACK_COMPARE_1, rtc_count_clear_compare_match(), rtc_count_disable(), rtc_count_disable_callback(), rtc_count_enable(), rtc_count_enable_callback(), rtc_count_match_callback(), rtc_count_register_callback(), rtc_count_set_compare(), rtc_count_set_count(), rtc_count_unregister_callback(), rtc_inst, STATUS_OK, and test_assert_true.
Referenced by main().
|
static |
Test for RTC count polled mode test.
This test initializes the RTC module and checks whether the initialization is successful or not.
Then this test executes compare_match test and overflow test.
test | Current test case. |
References rtc_count_config::compare_values, delay_ms, rtc_count_config::mode, rtc_count_config::prescaler, rtc_count_clear_compare_match(), rtc_count_clear_overflow(), rtc_count_disable(), rtc_count_enable(), rtc_count_get_compare(), rtc_count_get_config_defaults(), rtc_count_get_period(), rtc_count_init(), rtc_count_is_compare_match(), rtc_count_is_overflow(), RTC_COUNT_MODE_16BIT, RTC_COUNT_PRESCALER_DIV_1, rtc_count_set_compare(), rtc_count_set_count(), rtc_count_set_period(), rtc_inst, STATUS_OK, and test_assert_true.
Referenced by main().
struct usart_module cdc_uart_module |
Referenced by cdc_uart_init().
Referenced by rtc_count_match_callback(), and run_rtc_count_interrupt_test().
struct rtc_module rtc_inst |
Referenced by run_rtc_count_interrupt_test(), and run_rtc_count_test().