Unit tests for MegaRF Sleep Manager driver.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <conf_test.h>
Functions | |
static void | adc_initialisation (void) |
ISR (ADC_vect) | |
ISR (TIMER2_OVF_vect) | |
int | main (void) |
Run Sleep Manager unit tests. More... | |
static void | run_set_functions_test (const struct test_case *test) |
Test different parameters of the Sleep Manager module. More... | |
static void | run_sleep_trigger_test (const struct test_case *test) |
Test interrupt is getting triggered in various Sleep mode. More... | |
static void | timer2_initialisation (void) |
Variables | |
static volatile uint8_t | trigger_count = 0 |
|
static |
References ADC_ADJUSTMENT_RIGHT, adc_enable_interrupt(), adc_init(), ADC_MUX_ADC0, ADC_PRESCALER_DIV128, adc_set_admux(), ADC_VREF_AVCC, and sysclk_enable_peripheral_clock().
Referenced by run_sleep_trigger_test().
ISR | ( | ADC_vect | ) |
References trigger_count.
ISR | ( | TIMER2_OVF_vect | ) |
References trigger_count.
int main | ( | void | ) |
Run Sleep Manager unit tests.
Main function.
Initializes the clock system, board and serial output, then sets up the Sleep Manager unit test suite and runs it.
The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.
References usart_rs232_options::baudrate, board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, run_set_functions_test(), run_sleep_trigger_test(), stdio_serial_init(), sysclk_init(), test_suite_run(), and usart_serial_options.
|
static |
Test different parameters of the Sleep Manager module.
This function locks & unlocks the different sleep modes, and verifies that the correct values are being set.
test | Current test case. |
References sleepmgr_get_sleep_mode(), SLEEPMGR_IDLE, sleepmgr_init(), sleepmgr_lock_mode(), SLEEPMGR_NR_OF_MODES, SLEEPMGR_PDOWN, SLEEPMGR_PSAVE, sleepmgr_unlock_mode(), and test_assert_true.
Referenced by main().
|
static |
Test interrupt is getting triggered in various Sleep mode.
This function put the device in Idle and Power Save sleep mode and check whether the ADC conversion complete interrupt is executed only in Idle sleep mode. The device will wakeup from power save mode when Timer/Counter2 overflow occur.
test | Current test case. |
References adc_disable(), adc_initialisation(), adc_start_conversion(), cpu_irq_disable, cpu_irq_enable, sleepmgr_enter_sleep(), SLEEPMGR_IDLE, sleepmgr_init(), sleepmgr_lock_mode(), SLEEPMGR_PSAVE, sleepmgr_unlock_mode(), test_assert_true, timer2_initialisation(), and trigger_count.
Referenced by main().
|
static |
References sysclk_enable_peripheral_clock().
Referenced by run_sleep_trigger_test().
|
static |
Referenced by ISR(), and run_sleep_trigger_test().