Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for AFEC driver.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include <board.h>
#include <sysclk.h>
#include <delay.h>
#include "afec.h"
#include "tc.h"
#include "ioport.h"
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>
#include <conf_board.h>

Functions

static void afec_set_comp_flag (void)
 Callback function for AFEC enter compasion window interrupt. More...
 
static void afec_set_data_ready_flag (void)
 Callback function for AFEC conversion data is ready interrupt. More...
 
static void configure_tc_trigger (void)
 Configure to trigger AFEC by TIOA output of timer. More...
 
int main (void)
 Run AFEC driver unit tests. More...
 
static void run_afec_comp_test (const struct test_case *test)
 Test AFEC in comparsion window mode. More...
 
static void run_afec_tc_trig_test (const struct test_case *test)
 Test AFEC in TC trigger mode, which also tests interrupt driven conversions. More...
 

Variables

volatile bool is_comp_event_flag = false
 Enter comparison window flag. More...
 
volatile bool is_data_ready = false
 Conversion data is ready flag. More...
 

static void afec_set_comp_flag ( void  )
static

Callback function for AFEC enter compasion window interrupt.

References afec_disable_interrupt(), and is_comp_event_flag.

Referenced by run_afec_comp_test().

static void afec_set_data_ready_flag ( void  )
static

Callback function for AFEC conversion data is ready interrupt.

References afec_disable_interrupt(), is_data_ready, and tc_stop().

Referenced by run_afec_tc_trig_test().

static void configure_tc_trigger ( void  )
static
static void run_afec_comp_test ( const struct test_case test)
static
static void run_afec_tc_trig_test ( const struct test_case test)
static

Test AFEC in TC trigger mode, which also tests interrupt driven conversions.

Parameters
testCurrent test case.

References afec_set_callback(), afec_set_data_ready_flag(), configure_tc_trigger(), delay_ms, is_data_ready, and test_assert_true.

Referenced by main().

volatile bool is_comp_event_flag = false

Enter comparison window flag.

Referenced by afec_set_comp_flag(), and run_afec_comp_test().

volatile bool is_data_ready = false

Conversion data is ready flag.

Referenced by afec_set_data_ready_flag(), and run_afec_tc_trig_test().