Microchip® Advanced Software Framework

mega/drivers/ext_int/unit_tests/unit_tests.c File Reference

Unit tests for MegaRF Ext Interrupt driver.

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

#include <asf.h>
#include <conf_test.h>

Macros

#define CONF_OUT_PIN   IOPORT_CREATE_PIN(PORTE,1)
 
#define HIGH   0x01
 
#define LOW   0x00
 
#define PC_INT8_PIN_PORT_POS   0x00
 

Functions

static void ext_pc_int_callback (void)
 Interrupt callback for External PC interrupt Increments the trigger counter when the interrupt is triggered. More...
 
int main (void)
 Run Ext Interrupt unit tests. More...
 
static void run_interrupt_trigger_test (const struct test_case *test)
 Test External interrupt is getting triggered. More...
 
static void run_set_functions_test (const struct test_case *test)
 Test setting different parameters of the Ext_Int module. More...
 

Variables

static volatile uint8_t trigger_count =0
 

#define CONF_OUT_PIN   IOPORT_CREATE_PIN(PORTE,1)
#define HIGH   0x01
#define LOW   0x00
#define PC_INT8_PIN_PORT_POS   0x00

Referenced by run_set_functions_test().

static void ext_pc_int_callback ( void  )
static

Interrupt callback for External PC interrupt Increments the trigger counter when the interrupt is triggered.

Parameters
none

References trigger_count.

Referenced by run_interrupt_trigger_test().

static void run_interrupt_trigger_test ( const struct test_case test)
static

Test External interrupt is getting triggered.

This function enables the pin change interrupt(PE0) and changes the status of the pin by outputting high/low on GPIO pin (PE1) which in turn connected to PC interrupt pin

Parameters
testCurrent test case.

References CONF_OUT_PIN, cpu_irq_disable, cpu_irq_enable, ext_int_pcint_init(), ext_int_set_interrupt_callback(), ext_pc_int_callback(), HIGH, ioport_configure_pin(), IOPORT_DIR_OUTPUT, ioport_set_pin_level(), LOW, test_assert_true, and trigger_count.

Referenced by main().

static void run_set_functions_test ( const struct test_case test)
static

Test setting different parameters of the Ext_Int module.

This function calls the different set functions, and verifies that the correct values are being set.

Parameters
testCurrent test case.

References ext_int_clear_flag(), ext_int_disable(), ext_int_enable(), ext_int_pcint_clear_flag(), ext_int_pcint_disable(), ext_int_pcint_enable(), EXT_INT_PORT_MASK, INT_PIN_MASK, PC_INT8_PIN_PORT_POS, success, and test_assert_true.

Referenced by main().

volatile uint8_t trigger_count =0
static