#include <string.h>
#include <asf.h>
#include "conf_app.h"
Macros | |
#define | _SYSTEM_MCU_REVISION_B 1 |
#define | BUFFER_LEN 10 |
#define | LED0_TOGGLE_TIME 200 |
Enumerations | |
enum | led_toggle_times { LED0_TOGGLE_2 = 2, LED0_TOGGLE_4 = 4, LED0_TOGGLE_6 = 6, LED0_TOGGLE_8 = 8 } |
LED0 toggles times. More... | |
Functions | |
static void | configure_adc (void) |
Configure ADC to sample the internal scaled VCC. More... | |
static void | configure_dma (void) |
Config DMA to make peripheral-to-memory transfer from the ADC to the HMCRAMLP memory. More... | |
static void | configure_event (void) |
Configure EVENT to route RTC events to the ADC. More... | |
static void | configure_extint_channel (void) |
Config external interrupt. More... | |
static void | configure_rtc (void) |
Configure RTC as ADC sample timer. More... | |
static void | configure_usart (void) |
Configure usart. More... | |
static void | display_menu (void) |
Display menu. More... | |
static void | dma_callback (void) |
DMA callback function for transfer complete. More... | |
static void | extint_callback (void) |
static void | led_toggle_indication (uint32_t count) |
Toggles LED as an indication. More... | |
int | main (void) |
static void | main_clock_select (const enum system_clock_source clock_source) |
Main clock source selection between DFLL and OSC16M. More... | |
static void | main_clock_select_dfll (void) |
Setect DFLL as main clock source. More... | |
static void | main_clock_select_osc16m (void) |
Setect OSC16M as main clock source. More... | |
static void | test_active_mode (const enum system_performance_level performance_level) |
Active mode test case. More... | |
static void | test_backup_mode (void) |
BACKUP mode test case. More... | |
static void | test_idle_mode (void) |
Idle mode test case. More... | |
static void | test_off_mode (void) |
OFF mode test case. More... | |
static void | test_standby_mode_dynamic_power_sleepwalking (void) |
STANDBY mode test case:Dynamic Power SleepWalking. More... | |
static void | test_standby_mode_static_power_sleepwalking (void) |
STANDBY mode test case: static power sleepwalking. More... | |
Variables | |
static struct adc_module | adc_instance |
Support and FAQ: visit Microchip Support More... | |
static struct events_resource | event |
struct dma_resource | example_resource |
static struct rtc_module | rtc_instance |
DmacDescriptor example_descriptor | SECTION_DMAC_DESCRIPTOR |
static struct usart_module | usart_instance |
#define _SYSTEM_MCU_REVISION_B 1 |
#define BUFFER_LEN 10 |
Referenced by configure_dma(), and test_standby_mode_dynamic_power_sleepwalking().
#define LED0_TOGGLE_TIME 200 |
Referenced by led_toggle_indication().
enum led_toggle_times |
|
static |
Configure ADC to sample the internal scaled VCC.
References ADC_CLOCK_PRESCALER_DIV4, adc_enable(), ADC_EVENT_ACTION_START_CONV, adc_get_config_defaults(), adc_init(), adc_instance, ADC_REFERENCE_INTREF, ADC_RESOLUTION_12BIT, adc_config::clock_prescaler, adc_config::clock_source, adc_config::event_action, GCLK_GENERATOR_0, adc_config::on_demand, adc_config::reference, adc_config::resolution, and adc_config::run_in_standby.
Referenced by main(), and test_standby_mode_dynamic_power_sleepwalking().
|
static |
Config DMA to make peripheral-to-memory transfer from the ADC to the HMCRAMLP memory.
References adc_instance, dma_descriptor_config::beat_size, dma_descriptor_config::block_transfer_count, BUFFER_LEN, dma_descriptor_config::destination_address, dma_add_descriptor(), dma_allocate(), DMA_BEAT_SIZE_HWORD, dma_callback(), DMA_CALLBACK_TRANSFER_DONE, dma_descriptor_create(), dma_descriptor_get_config_defaults(), dma_enable_callback(), dma_get_config_defaults(), dma_register_callback(), dma_start_transfer_job(), DMA_TRIGGER_ACTION_BEAT, example_resource, dma_descriptor_config::next_descriptor_address, dma_resource_config::peripheral_trigger, dma_resource_config::run_in_standby, dma_descriptor_config::source_address, dma_descriptor_config::src_increment_enable, and dma_resource_config::trigger_action.
Referenced by test_standby_mode_dynamic_power_sleepwalking().
|
static |
Configure EVENT to route RTC events to the ADC.
References events_config::clock_source, event, events_allocate(), events_attach_user(), events_get_config_defaults(), EVENTS_PATH_ASYNCHRONOUS, GCLK_GENERATOR_0, events_config::generator, events_config::path, system_apb_clock_set_mask(), and SYSTEM_CLOCK_APB_APBD.
Referenced by test_standby_mode_dynamic_power_sleepwalking().
|
static |
Config external interrupt.
References extint_chan_conf::detection_criteria, extint_callback(), EXTINT_CALLBACK_TYPE_DETECT, extint_chan_clear_detected(), extint_chan_enable_callback(), extint_chan_get_config_defaults(), extint_chan_is_detected(), extint_chan_set_config(), EXTINT_DETECT_BOTH, EXTINT_PULL_UP, extint_register_callback(), extint_chan_conf::gpio_pin, extint_chan_conf::gpio_pin_mux, and extint_chan_conf::gpio_pin_pull.
Referenced by main().
|
static |
Configure RTC as ADC sample timer.
References rtc_count_config::clear_on_match, rtc_count_config::compare_values, rtc_count_events::generate_event_on_compare, rtc_count_config::mode, rtc_count_config::prescaler, rtc_count_enable(), rtc_count_enable_events(), rtc_count_get_config_defaults(), rtc_count_init(), RTC_COUNT_MODE_32BIT, RTC_COUNT_PRESCALER_DIV_64, and rtc_instance.
Referenced by test_standby_mode_dynamic_power_sleepwalking().
|
static |
Configure usart.
References usart_config::baudrate, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), usart_get_config_defaults(), and usart_instance.
|
static |
Display menu.
Referenced by main().
|
static |
DMA callback function for transfer complete.
Referenced by configure_dma().
|
static |
Referenced by configure_extint_channel().
|
static |
Toggles LED as an indication.
References count, delay_ms, i, LED0_TOGGLE_TIME, and port_pin_set_output_level().
Referenced by main(), test_active_mode(), test_idle_mode(), test_standby_mode_dynamic_power_sleepwalking(), and test_standby_mode_static_power_sleepwalking().
int main | ( | void | ) |
References configure_extint_channel(), configure_usart(), delay_init(), display_menu(), LED0_TOGGLE_8, led_toggle_indication(), port_pin_set_output_level(), system_get_backup_exit_source(), system_get_reset_cause(), system_init(), SYSTEM_PERFORMANCE_LEVEL_0, SYSTEM_PERFORMANCE_LEVEL_2, SYSTEM_RESET_CAUSE_BACKUP, test_active_mode(), test_backup_mode(), test_idle_mode(), test_off_mode(), test_standby_mode_dynamic_power_sleepwalking(), test_standby_mode_static_power_sleepwalking(), usart_instance, usart_read_wait(), and usart_reset().
|
static |
Main clock source selection between DFLL and OSC16M.
References GCLK_GENERATOR_1, main_clock_select_dfll(), main_clock_select_osc16m(), SYSTEM_CLOCK_SOURCE_DFLL, system_clock_source_disable(), SYSTEM_CLOCK_SOURCE_OSC16M, system_gclk_chan_disable(), and system_gclk_gen_disable().
Referenced by test_active_mode().
|
static |
Setect DFLL as main clock source.
References GCLK_GENERATOR_0, GCLK_GENERATOR_1, system_clock_source_dfll_config::loop_mode, system_clock_source_dfll_config::multiply_factor, system_clock_source_dfll_config::on_demand, system_clock_source_dfll_config::run_in_stanby, system_gclk_gen_config::source_clock, system_gclk_chan_config::source_generator, SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED, SYSTEM_CLOCK_SOURCE_DFLL, system_clock_source_dfll_get_config_defaults(), system_clock_source_dfll_set_config(), system_clock_source_enable(), system_clock_source_is_ready(), SYSTEM_CLOCK_SOURCE_XOSC32K, system_gclk_chan_enable(), system_gclk_chan_get_config_defaults(), system_gclk_chan_set_config(), system_gclk_gen_enable(), system_gclk_gen_get_config_defaults(), and system_gclk_gen_set_config().
Referenced by main_clock_select().
|
static |
Setect OSC16M as main clock source.
References system_clock_source_osc16m_config::fsel, GCLK_GENERATOR_0, system_clock_source_osc16m_config::on_demand, system_clock_source_osc16m_config::run_in_standby, system_gclk_gen_config::source_clock, system_clock_source_enable(), system_clock_source_is_ready(), SYSTEM_CLOCK_SOURCE_OSC16M, system_clock_source_osc16m_get_config_defaults(), system_clock_source_osc16m_set_config(), system_gclk_gen_get_config_defaults(), and system_gclk_gen_set_config().
Referenced by main_clock_select().
|
static |
Active mode test case.
References LED0_TOGGLE_2, led_toggle_indication(), main_clock_select(), SYSTEM_CLOCK_SOURCE_DFLL, SYSTEM_CLOCK_SOURCE_OSC16M, system_get_performance_level(), and system_switch_performance_level().
Referenced by main(), test_idle_mode(), test_standby_mode_dynamic_power_sleepwalking(), and test_standby_mode_static_power_sleepwalking().
|
static |
BACKUP mode test case.
References port_config::direction, port_get_config_defaults(), PORT_PIN_DIR_OUTPUT, port_pin_set_config(), port_pin_set_output_level(), system_apb_clock_clear_mask(), SYSTEM_CLOCK_APB_APBC, system_gclk_chan_disable(), system_set_sleepmode(), system_sleep(), and SYSTEM_SLEEPMODE_BACKUP.
Referenced by main().
|
static |
Idle mode test case.
References LED0_TOGGLE_4, led_toggle_indication(), port_pin_set_output_level(), SYSTEM_PERFORMANCE_LEVEL_0, system_set_sleepmode(), system_sleep(), SYSTEM_SLEEPMODE_IDLE, and test_active_mode().
Referenced by main().
|
static |
OFF mode test case.
References system_set_sleepmode(), system_sleep(), and SYSTEM_SLEEPMODE_OFF.
Referenced by main().
|
static |
STANDBY mode test case:Dynamic Power SleepWalking.
References _SYSTEM_MCU_REVISION_B, BUFFER_LEN, configure_adc(), configure_dma(), configure_event(), configure_rtc(), configure_usart(), dma_start_transfer_job(), example_resource, i, LED0_TOGGLE_6, led_toggle_indication(), port_pin_set_output_level(), system_clock_source_enable(), SYSTEM_CLOCK_SOURCE_XOSC32K, system_get_device_id(), system_get_performance_level(), SYSTEM_PERFORMANCE_LEVEL_0, system_set_sleepmode(), system_sleep(), SYSTEM_SLEEPMODE_STANDBY, system_standby_get_config_defaults(), system_standby_set_config(), test_active_mode(), usart_instance, and usart_reset().
Referenced by main().
|
static |
STANDBY mode test case: static power sleepwalking.
References _SYSTEM_MCU_REVISION_B, configure_usart(), system_standby_config::hmcramchs_back_bias, system_standby_config::hmcramclp_back_bias, LED0_TOGGLE_6, led_toggle_indication(), port_pin_set_output_level(), system_clock_source_disable(), system_clock_source_enable(), SYSTEM_CLOCK_SOURCE_XOSC32K, system_get_device_id(), system_get_performance_level(), SYSTEM_PERFORMANCE_LEVEL_0, SYSTEM_RAM_BACK_BIAS_STANDBY_OFF, system_set_sleepmode(), system_sleep(), SYSTEM_SLEEPMODE_STANDBY, system_standby_get_config_defaults(), system_standby_set_config(), test_active_mode(), usart_instance, and usart_reset().
Referenced by main().
|
static |
Support and FAQ: visit Microchip Support
Referenced by adc_start_read_result(), adp_example_adc_get_value(), adp_example_adc_init(), configure_adc(), configure_adc_callbacks(), configure_dma(), main(), setup_transfer_descriptor(), and temp_sensor_init().
|
static |
Referenced by configure_event().
struct dma_resource example_resource |
Referenced by configure_dma(), main(), and test_standby_mode_dynamic_power_sleepwalking().
|
static |
uint16_t adc_rslt [BUFFER_LEN] SECTION_DMAC_DESCRIPTOR |
|
static |