Microchip® Advanced Software Framework

ili93xx.c File Reference

API driver for ILI93XX TFT display component.

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

#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "ili93xx.h"
#include "ili9341_regs.h"
#include "ili9325_regs.h"

Macros

#define LCD_DATA_CACHE_SIZE   ILI93XX_LCD_WIDTH
 Pixel cache used to speed up communication. More...
 

Functions

static void ili93xx_check_box_coordinates (uint32_t *p_ul_x1, uint32_t *p_ul_y1, uint32_t *p_ul_x2, uint32_t *p_ul_y2)
 Check box coordinates. More...
 
void ili93xx_copy_pixels_from_screen (ili93xx_color_t *pixels, uint32_t count)
 Copy pixels from the screen to a pixel buffer. More...
 
void ili93xx_copy_pixels_to_screen (const ili93xx_color_t *pixels, uint32_t count)
 Copy pixels from SRAM to the screen. More...
 
void ili93xx_copy_raw_pixel_24bits_to_screen (const uint8_t *raw_pixels, uint32_t count)
 Copy pixels from SRAM to the screen. More...
 
static void ili93xx_delay (uint32_t ul_ms)
 Delay function. More...
 
uint8_t ili93xx_device_type (void)
 get the device type. More...
 
uint8_t ili93xx_device_type_identify (void)
 Read device ID to idenfity the device ILI9325 device ID locates in Device Code Read (R00h) register. More...
 
void ili93xx_disable_scroll (void)
 Disable the scrolling feature. More...
 
void ili93xx_display_off (void)
 Turn off the LCD. More...
 
void ili93xx_display_on (void)
 Turn on the LCD. More...
 
static void ili93xx_draw_char (uint32_t ul_x, uint32_t ul_y, uint8_t uc_c)
 Draw an ASCII character on LCD. More...
 
uint32_t ili93xx_draw_circle (uint32_t ul_x, uint32_t ul_y, uint32_t ul_r)
 Draw a circle on LCD. More...
 
uint32_t ili93xx_draw_filled_circle (uint32_t ul_x, uint32_t ul_y, uint32_t ul_r)
 Draw a filled circle on LCD. More...
 
void ili93xx_draw_filled_rectangle (uint32_t ul_x1, uint32_t ul_y1, uint32_t ul_x2, uint32_t ul_y2)
 Draw a filled rectangle on LCD. More...
 
void ili93xx_draw_line (uint32_t ul_x1, uint32_t ul_y1, uint32_t ul_x2, uint32_t ul_y2)
 Draw a line on LCD. More...
 
static void ili93xx_draw_line_bresenham (uint32_t ul_x1, uint32_t ul_y1, uint32_t ul_x2, uint32_t ul_y2)
 Draw a line on LCD, which is not horizontal or vertical. More...
 
uint32_t ili93xx_draw_pixel (uint32_t ul_x, uint32_t ul_y)
 Draw a pixel on LCD. More...
 
void ili93xx_draw_pixmap (uint32_t ul_x, uint32_t ul_y, uint32_t ul_width, uint32_t ul_height, const ili93xx_color_t *p_ul_pixmap)
 Draw a pixmap on LCD. More...
 
void ili93xx_draw_rectangle (uint32_t ul_x1, uint32_t ul_y1, uint32_t ul_x2, uint32_t ul_y2)
 Draw a rectangle on LCD. More...
 
void ili93xx_draw_string (uint32_t ul_x, uint32_t ul_y, const uint8_t *p_str)
 Draw a string on LCD. More...
 
void ili93xx_duplicate_pixel (const ili93xx_color_t color, uint32_t count)
 Set a given number of pixels to the same color. More...
 
void ili93xx_enable_scroll (void)
 Enable the scrolling feature. More...
 
void ili93xx_fill (ili93xx_color_t ul_color)
 Fill the LCD buffer with the specified color. More...
 
uint32_t ili93xx_get_lcd_type (void)
 
ili93xx_color_t ili93xx_get_pixel (uint32_t ul_x, uint32_t ul_y)
 Get a pixel from LCD. More...
 
uint32_t ili93xx_init (struct ili93xx_opt_t *p_opt)
 Initialize the ILI93XX lcd driver. More...
 
ili93xx_color_t ili93xx_read_gram (void)
 Read a single color from the graphical memory. More...
 
static uint32_t ili93xx_read_ram (void)
 Read data to LCD GRAM for ili93xx. More...
 
static void ili93xx_read_ram_prepare (void)
 Prepare to read GRAM data for ili93xx. More...
 
static void ili93xx_read_register (uint8_t uc_reg, uint8_t *p_data, uint8_t uc_datacnt)
 Read data from LCD Register. More...
 
void ili93xx_scroll (int32_t ul_lines)
 Scroll up/down for the number of specified lines. More...
 
static void ili93xx_send_draw_limits (const bool send_end_limits)
 Helper function to send the drawing limits (boundaries) to the display. More...
 
void ili93xx_set_bottom_right_limit (ili93xx_coord_t x, ili93xx_coord_t y)
 Set the display bottom right drawing limit. More...
 
void ili93xx_set_cursor_position (uint16_t us_x, uint16_t us_y)
 Set cursor of LCD screen. More...
 
void ili93xx_set_display_direction (enum ili93xx_display_direction e_dd, enum ili93xx_shift_direction e_shd, enum ili93xx_scan_direction e_scd)
 Set display direction. More...
 
void ili93xx_set_foreground_color (ili93xx_color_t ul_color)
 Set foreground color. More...
 
void ili93xx_set_limits (ili93xx_coord_t start_x, ili93xx_coord_t start_y, ili93xx_coord_t end_x, ili93xx_coord_t end_y)
 Set the full display drawing limits. More...
 
void ili93xx_set_orientation (uint8_t flags)
 Sets the orientation of the display data. More...
 
void ili93xx_set_top_left_limit (ili93xx_coord_t x, ili93xx_coord_t y)
 Set the display top left drawing limit. More...
 
void ili93xx_set_window (uint32_t ul_x, uint32_t ul_y, uint32_t ul_width, uint32_t ul_height)
 Set display window. More...
 
void ili93xx_vscroll_area_define (uint16_t us_tfa, uint16_t us_vsa, uint16_t us_bfa)
 Vertical Scroll area definition for ili9341. More...
 
void ili93xx_write_gram (ili93xx_color_t color)
 Write the graphical memory with a single color pixel. More...
 
static void ili93xx_write_ram (ili93xx_color_t ul_color)
 Write data to LCD GRAM. More...
 
static void ili93xx_write_ram_buffer (const ili93xx_color_t *p_ul_buf, uint32_t ul_size)
 Write multiple data in buffer to LCD controller for ili93xx. More...
 
static void ili93xx_write_ram_prepare (void)
 Prepare to write GRAM data for ili93xx. More...
 
static void ili93xx_write_register (uint8_t uc_reg, uint8_t *p_data, uint8_t uc_datacnt)
 Write data to LCD Register for ili93xx. More...
 
static void ili93xx_write_register_word (uint8_t uc_reg, uint16_t us_data)
 Write a word (16bits)to LCD Register. More...
 

Variables

static uint8_t g_uc_device_type = 0
 Device type. More...
 
static uint32_t g_ul_lcd_x_length = ILI93XX_LCD_WIDTH
 LCD X-axis and Y-axis length. More...
 
static uint32_t g_ul_lcd_y_length = ILI93XX_LCD_HEIGHT
 
static ili93xx_color_t g_ul_pixel_cache [LCD_DATA_CACHE_SIZE]
 
struct ili93xx_font gfont = {10, 14}
 Global variable describing the font size used by the driver. More...
 
static volatile ili93xx_coord_t limit_end_x
 
static volatile ili93xx_coord_t limit_end_y
 
static volatile ili93xx_coord_t limit_start_x
 
static volatile ili93xx_coord_t limit_start_y
 
const uint8_t p_uc_charset10x14 []
 Character set table for font 10x14 Coding format: Char height is 14 bits, which is coded using 2 bytes per column (2 unused bits). More...