Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for QTouch component driver with I2C interface.

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

#include "asf.h"
#include "conf_test.h"
#include "string.h"

Functions

static void init_interface (void)
 Initialize TWI communication interface. More...
 
int main (void)
 Run QTouch component driver with I2C interface unit tests. More...
 
static void run_qt_test_comm_ready (const struct test_case *test)
 Test if communication is ready with QT device. More...
 
static void run_qt_test_get_status (const struct test_case *test)
 Test if key status correctly. More...
 
static void run_qt_test_setup_block (const struct test_case *test)
 Test if set QT device setup block correctly. More...
 

Variables

struct qt_setup_block setup_block_0
 Storage for QT setup block 0. More...
 
struct qt_setup_block setup_block_1
 Storage for QT setup block 1. More...
 
struct qt_status status
 Storage for QT status. More...
 

static void init_interface ( void  )
static

Initialize TWI communication interface.

References BOARD_QT_TWI_INSTANCE, twi_options::speed, and twi_master_setup().

Referenced by run_qt_test_comm_ready().

static void run_qt_test_comm_ready ( const struct test_case test)
static

Test if communication is ready with QT device.

Parameters
testCurrent test case.

References ERR_IO_ERROR, ERR_UNSUPPORTED_DEV, init_interface(), qt_get_comm_ready(), qt_hardware_reset(), and test_assert_true.

Referenced by main().

static void run_qt_test_get_status ( const struct test_case test)
static

Test if key status correctly.

For unit test board, it assume there is no key been pressed in the test.

Parameters
testCurrent test case.

References delay_ms, qt_get_status(), qt_is_change_line_low(), status, STATUS_OK, test_assert_false, test_assert_true, and ut_is_any_key_pressed().

Referenced by main().

static void run_qt_test_setup_block ( const struct test_case test)
static

Test if set QT device setup block correctly.

Parameters
testCurrent test case.

References qt_read_setup_block(), qt_write_setup_block(), setup_block_0, setup_block_1, STATUS_OK, test_assert_true, and ut_set_qt_param().

Referenced by main().

struct qt_setup_block setup_block_0

Storage for QT setup block 0.

Referenced by run_qt_test_setup_block().

struct qt_setup_block setup_block_1

Storage for QT setup block 1.

Referenced by run_qt_test_setup_block().