Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for ili93xx driver.

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

#include "asf.h"
#include "conf_test.h"
#include "smc.h"
#include "ili9325_regs.h"
#include "ili9341_regs.h"

Macros

#define DATA_FILTER   0x00F8FCF8
 RGB888 to RGB565 filter. More...
 
#define ILI93XX_LCD_CS   1
 Chip select number to be set. More...
 

Functions

static uint16_t ili93xx_read_register (uint8_t uc_reg)
 Read data from LCD Register. More...
 
static uint8_t ili93xx_read_register_byte (uint8_t uc_reg)
 
int main (void)
 Run ili93xx driver unit tests. More...
 
static void run_test_control_setting (const struct test_case *test)
 Test control API functions. More...
 
static void run_test_data_read_write (const struct test_case *test)
 Test data read/write API functions. More...
 
static void run_test_init (const struct test_case *test)
 Test ili9325 initialization setting. More...
 

Variables

struct ili93xx_opt_t g_ili93xx_display_opt
 

#define DATA_FILTER   0x00F8FCF8

RGB888 to RGB565 filter.

Referenced by run_test_data_read_write().

#define ILI93XX_LCD_CS   1

Chip select number to be set.

Referenced by main().

static uint16_t ili93xx_read_register ( uint8_t  uc_reg)
static

Read data from LCD Register.

Parameters
regRegister address.
Returns
Read data.

References LCD_IR(), and LCD_RD().

Referenced by run_test_control_setting(), and run_test_init().

static uint8_t ili93xx_read_register_byte ( uint8_t  uc_reg)
static

References LCD_IR(), and LCD_RD().

Referenced by run_test_init().

int main ( void  )
static void run_test_control_setting ( const struct test_case test)
static

Test control API functions.

This test call the control API functions and check the setting value.

Parameters
testCurrent test case.

Test1: Check the ili93xx_display_on() function

References DEVICE_TYPE_ILI9325, DEVICE_TYPE_ILI9341, ILI9325_DISP_CTRL1, ILI9325_DISP_CTRL1_BASEE, ILI9325_DISP_CTRL1_D, ILI9325_DISP_CTRL1_DTE, ILI9325_DISP_CTRL1_GON, ILI9341_CMD_READ_DISP_STATUS, ili93xx_device_type(), ili93xx_display_on(), ili93xx_read_register(), LCD_IR(), LCD_RD(), and test_assert_true.

Referenced by main().

static void run_test_data_read_write ( const struct test_case test)
static

Test data read/write API functions.

This test call the data read/write API functions and check the data consistence.

Parameters
testCurrent test case.

Test1: Check the one pixel read/write function

References COLOR_SKYBLUE, DATA_FILTER, ili93xx_draw_pixel(), ili93xx_get_pixel(), ili93xx_set_foreground_color(), and test_assert_true.

Referenced by main().

static void run_test_init ( const struct test_case test)
static

Test ili9325 initialization setting.

This test call the initialization function and check the setting value.

Parameters
testCurrent test case.

Test1: Check the initialize function

Switch off backlight

Initialize LCD

Set backlight level

Check the important none zero setting registers

References AAT31XX_AVG_BACKLIGHT_LEVEL, aat31xx_disable_backlight(), aat31xx_set_backlight(), ili93xx_opt_t::background_color, COLOR_BLACK, COLOR_BLUE, COLOR_WHITE, DEVICE_TYPE_ILI9325, DEVICE_TYPE_ILI9341, ili93xx_opt_t::foreground_color, g_ili93xx_display_opt, ILI9325_BASE_IMG_DISP_CTRL, ILI9325_DISP_CTRL1, ILI9325_DISP_CTRL1_D, ILI9325_DISP_CTRL1_DTE, ILI9325_DISP_CTRL1_GON, ILI9325_DISP_CTRL2, ILI9325_DRIVER_OUTPUT_CTRL1, ILI9325_DRIVER_OUTPUT_CTRL1_SS, ILI9325_DRIVER_OUTPUT_CTRL2, ILI9325_DRIVER_OUTPUT_CTRL2_GS, ILI9325_DRIVER_OUTPUT_CTRL2_NL, ILI9325_ENTRY_MODE, ILI9325_ENTRY_MODE_BGR, ILI9325_ENTRY_MODE_DFM, ILI9325_ENTRY_MODE_ID, ILI9325_ENTRY_MODE_TRI, ILI9325_FRAME_RATE_AND_COLOR_CTRL, ILI9325_LCD_DRIVING_CTRL, ILI9325_PANEL_INTERFACE_CTRL1, ILI9325_PANEL_INTERFACE_CTRL2, ILI9325_PANEL_INTERFACE_CTRL4, ILI9325_POWER_CTRL2, ILI9325_POWER_CTRL3, ILI9325_POWER_CTRL4, ILI9325_POWER_CTRL7, ILI9341_CMD_READ_DISP_IMAGE_FORMAT, ILI9341_CMD_READ_DISP_MADCTRL, ILI9341_CMD_READ_DISP_PIXEL_FORMAT, ILI9341_CMD_READ_DISP_POWER_MODE, ILI9341_CMD_READ_DISP_SIGNAL_MODE, ili93xx_device_type(), ili93xx_draw_filled_rectangle(), ili93xx_init(), ILI93XX_LCD_HEIGHT, ILI93XX_LCD_WIDTH, ili93xx_read_register(), ili93xx_read_register_byte(), ili93xx_set_foreground_color(), test_assert_true, ili93xx_opt_t::ul_height, and ili93xx_opt_t::ul_width.

Referenced by main().

struct ili93xx_opt_t g_ili93xx_display_opt

Referenced by run_test_init().