SAM DAC Unit Test.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
void | configure_event_resource (void) |
event source for DAC conversion More... | |
void | configure_rtc_count (void) |
rtc for event generator More... | |
int | main (void) |
Run DAC unit tests. More... | |
static void | run_dac_event_control_test (const struct test_case *test) |
Test for DAC conversion driven by events in polled mode. More... | |
static void | run_dac_init_test (const struct test_case *test) |
Initialize the DAC for unit test. More... | |
Variables | |
struct usart_module | cdc_uart_module |
struct dac_module | dac_instance |
struct events_resource | event_dac |
struct rtc_module | rtc_instance |
[rtc_module_instance] More... | |
|
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, 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().
void configure_event_resource | ( | void | ) |
event source for DAC conversion
set rtc overflow as the event generator for DAC conversion
void configure_rtc_count | ( | void | ) |
rtc for event generator
set rtc clock prescaler and mode to generate overflow events
int main | ( | void | ) |
Run DAC unit tests.
Initializes the system and serial output, then sets up the DAC unit test suite and runs it.
References cdc_uart_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, delay_init(), NULL, run_dac_event_control_test(), run_dac_init_test(), system_init(), and test_suite_run().
|
static |
Test for DAC conversion driven by events in polled mode.
after the first event, dac should enter channel buffer empty status. after the second event, dac should enter channel buffer underrun status.
References configure_event_resource(), configure_rtc_count(), dac_chan_write(), DAC_CHANNEL_0, dac_get_status(), dac_instance, DAC_STATUS_CHANNEL_0_EMPTY, DAC_STATUS_CHANNEL_0_UNDERRUN, delay_ms, rtc_count_set_period(), rtc_instance, STATUS_OK, and test_assert_true.
Referenced by main().
|
static |
Initialize the DAC for unit test.
Initializes the DAC module to accept events to start conversion
References dac_chan_enable(), dac_chan_get_config_defaults(), dac_chan_set_config(), DAC_CHANNEL_0, dac_enable(), dac_enable_events(), dac_get_config_defaults(), dac_init(), dac_instance, dac_events::on_event_start_conversion, STATUS_ERR_IO, STATUS_OK, and test_assert_true.
Referenced by main().
struct usart_module cdc_uart_module |
struct dac_module dac_instance |
struct events_resource event_dac |
struct rtc_module rtc_instance |
[rtc_module_instance]
[rtc_module_instance]
[rtc_module_inst]