See Quick Start Guide for the ILI9341 Display Controller Component Driver.
This is the low level component driver for the ILI9341 display controller. It provides basic functions for initializing, writing and reading the controller. In addition to hardware control and use of the LCD controller internal functions.
Before writing data to the display call ili9341_init() which will set up the physical interface and the display. A configuration file conf_ili9341.h is needed to define which interface to use, pin connections and communication speed.
An example conf_ili9341.h file for the XMEGA could look like:
This component driver depends on the following modules:
Modules | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the ILI9341 Display Controller Component Driver. | |
Macros | |
#define | ILI9341_COLOR(r, g, b) |
This macro generates a 16-bit native color for the display from a 24-bit RGB value. More... | |
#define | ILI9341_DEFAULT_HEIGHT 240 |
Height of display using default orientation. More... | |
#define | ILI9341_DEFAULT_WIDTH 320 |
Width of display using default orientation. More... | |
#define | ILI9341_SWITCH_XY_HEIGHT 320 |
Height of display using swapped X/Y orientation. More... | |
#define | ILI9341_SWITCH_XY_WIDTH 240 |
Width of display using swapped X/Y orientation. More... | |
Typedefs | |
typedef uint16_t | ili9341_color_t |
Type define for an integer type large enough to store a pixel color. More... | |
typedef int16_t | ili9341_coord_t |
Type define for an integer type large enough to store a pixel coordinate. More... | |
Display orientation flags | |
#define | ILI9341_FLIP_X 1 |
Bit mask for flipping X for ili9341_set_orientation() More... | |
#define | ILI9341_FLIP_Y 2 |
Bit mask for flipping Y for ili9341_set_orientation() More... | |
#define | ILI9341_SWITCH_XY 4 |
Bit mask for swapping X and Y for ili9341_set_orientation() More... | |
Controller primitive graphical functions | |
ili9341_color_t | ili9341_read_gram (void) |
Read a single color from the graphical memory. More... | |
void | ili9341_write_gram (ili9341_color_t color) |
Write the graphical memory with a single color pixel. More... | |
void | ili9341_set_top_left_limit (ili9341_coord_t x, ili9341_coord_t y) |
Set the display top left drawing limit. More... | |
void | ili9341_set_bottom_right_limit (ili9341_coord_t x, ili9341_coord_t y) |
Set the display bottom right drawing limit. More... | |
void | ili9341_set_limits (ili9341_coord_t start_x, ili9341_coord_t start_y, ili9341_coord_t end_x, ili9341_coord_t end_y) |
Set the full display drawing limits. More... | |
void | ili9341_set_orientation (uint8_t flags) |
Sets the orientation of the display data. More... | |
void | ili9341_copy_pixels_to_screen (const ili9341_color_t *pixels, uint32_t count) |
Copy pixels from SRAM to the screen. More... | |
void | ili9341_copy_pixels_from_screen (ili9341_color_t *pixels, uint32_t count) |
Copy pixels from the screen to a pixel buffer. More... | |
void | ili9341_duplicate_pixel (const ili9341_color_t color, uint32_t count) |
Set a given number of pixels to the same color. More... | |
Controller and display initialization and management | |
void | ili9341_init (void) |
Initialize the controller. More... | |
static void | ili9341_backlight_on (void) |
Function to turn on the display back light. More... | |
static void | ili9341_backlight_off (void) |
Function to turn off the display back light. More... | |
#define ILI9341_COLOR | ( | r, | |
g, | |||
b | |||
) |
This macro generates a 16-bit native color for the display from a 24-bit RGB value.
Referenced by ili9341_copy_pixels_from_screen(), and ili9341_read_gram().
#define ILI9341_DEFAULT_HEIGHT 240 |
Height of display using default orientation.
Referenced by gfx_ili9341_init(), gfx_ili9341_set_orientation(), and ili9341_controller_init_registers().
#define ILI9341_DEFAULT_WIDTH 320 |
Width of display using default orientation.
Referenced by gfx_ili9341_init(), gfx_ili9341_set_orientation(), and ili9341_controller_init_registers().
#define ILI9341_FLIP_X 1 |
Bit mask for flipping X for ili9341_set_orientation()
Referenced by ili9341_set_orientation().
#define ILI9341_FLIP_Y 2 |
Bit mask for flipping Y for ili9341_set_orientation()
Referenced by ili9341_set_orientation().
#define ILI9341_SWITCH_XY 4 |
Bit mask for swapping X and Y for ili9341_set_orientation()
Referenced by ili9341_set_orientation().
#define ILI9341_SWITCH_XY_HEIGHT 320 |
Height of display using swapped X/Y orientation.
Referenced by gfx_ili9341_set_orientation().
#define ILI9341_SWITCH_XY_WIDTH 240 |
Width of display using swapped X/Y orientation.
Referenced by gfx_ili9341_set_orientation().
typedef uint16_t ili9341_color_t |
Type define for an integer type large enough to store a pixel color.
typedef int16_t ili9341_coord_t |
Type define for an integer type large enough to store a pixel coordinate.
|
inlinestatic |
Function to turn off the display back light.
Use this function to simply set the pin controlling the back light low to turn off the back light.
References ioport_set_pin_level().
|
inlinestatic |
Function to turn on the display back light.
Use this function to simply set the pin controlling the back light high to turn on the back light.
References ioport_set_pin_level().
Referenced by gfx_ili9341_init().
void ili9341_copy_pixels_from_screen | ( | ili9341_color_t * | pixels, |
uint32_t | count | ||
) |
Copy pixels from the screen to a pixel buffer.
Use this function to copy pixels from the display to an internal SRAM buffer.
Limits have to be set prior to calling this function, e.g.:
pixels | Pointer to the pixel buffer to read to |
count | Number of pixels to read |
References Assert, ILI9341_CMD_MEMORY_READ, ILI9341_COLOR, ili9341_deselect_chip(), ili9341_read_byte(), and ili9341_send_command().
void ili9341_copy_pixels_to_screen | ( | const ili9341_color_t * | pixels, |
uint32_t | count | ||
) |
Copy pixels from SRAM to the screen.
Used to copy a large quantitative of data to the screen in one go.
Limits have to be set prior to calling this function, e.g.:
pixels | Pointer to the pixel data |
count | Number of pixels to copy to the screen |
References Assert, ILI9341_CMD_MEMORY_WRITE, ili9341_deselect_chip(), ili9341_send_byte(), ili9341_send_command(), ili9341_wait_for_send_done(), le16_to_cpu, min, and NULL.
void ili9341_duplicate_pixel | ( | const ili9341_color_t | color, |
uint32_t | count | ||
) |
Set a given number of pixels to the same color.
Use this function to write a certain number of pixels to the same color within a set limit.
Limits have to be set prior to calling this function, e.g.:
color | The color to write to the display |
count | The number of pixels to write with this color |
References Assert, ILI9341_CMD_MEMORY_WRITE, ili9341_deselect_chip(), ili9341_send_byte(), ili9341_send_command(), ili9341_wait_for_send_done(), le16_to_cpu, min, and NULL.
void ili9341_init | ( | void | ) |
Initialize the controller.
Used to initialize the ILI9341 display controller by setting up the hardware interface, and setting up the controller according to the manufacturer's description. It also set up the screen orientation to the default state (portrait).
References ili9341_controller_init_registers(), ili9341_exit_standby(), ili9341_interface_init(), and ili9341_reset_display().
Referenced by gfx_ili9341_init().
ili9341_color_t ili9341_read_gram | ( | void | ) |
Read a single color from the graphical memory.
Use this function to read a color from the graphical memory of the controller.
Limits have to be set prior to calling this function, e.g.:
ili9341_color_t | The read color pixel |
References ILI9341_CMD_MEMORY_READ, ILI9341_COLOR, ili9341_deselect_chip(), ili9341_read_byte(), and ili9341_send_command().
Referenced by gfx_ili9341_get_pixel().
void ili9341_set_bottom_right_limit | ( | ili9341_coord_t | x, |
ili9341_coord_t | y | ||
) |
Set the display bottom right drawing limit.
Use this function to set the bottom right corner of the drawing limit box.
x | The x coordinate of the bottom right corner |
y | The y coordinate of the bottom right corner |
References ili9341_send_draw_limits(), limit_end_x, and limit_end_y.
void ili9341_set_limits | ( | ili9341_coord_t | start_x, |
ili9341_coord_t | start_y, | ||
ili9341_coord_t | end_x, | ||
ili9341_coord_t | end_y | ||
) |
Set the full display drawing limits.
Use this function to set the full drawing limit box.
start_x | The x coordinate of the top left corner |
start_y | The y coordinate of the top left corner |
end_x | The x coordinate of the bottom right corner |
end_y | The y coordinate of the bottom right corner |
References ili9341_send_draw_limits(), limit_end_x, limit_end_y, limit_start_x, and limit_start_y.
Referenced by ili9341_controller_init_registers().
void ili9341_set_orientation | ( | uint8_t | flags | ) |
Sets the orientation of the display data.
Configures the display for a given orientation, including mirroring and/or screen rotation.
flags | Orientation flags to use, see ILI9341_FLIP_X, ILI9341_FLIP_Y and ILI9341_SWITCH_XY. |
References ILI9341_CMD_MEMORY_ACCESS_CONTROL, ili9341_deselect_chip(), ILI9341_FLIP_X, ILI9341_FLIP_Y, ili9341_send_byte(), ili9341_send_command(), ILI9341_SWITCH_XY, and ili9341_wait_for_send_done().
Referenced by gfx_ili9341_set_orientation(), and ili9341_controller_init_registers().
void ili9341_set_top_left_limit | ( | ili9341_coord_t | x, |
ili9341_coord_t | y | ||
) |
Set the display top left drawing limit.
Use this function to set the top left limit of the drawing limit box.
x | The x coordinate of the top left corner |
y | The y coordinate of the top left corner |
References ili9341_send_draw_limits(), limit_start_x, and limit_start_y.
void ili9341_write_gram | ( | ili9341_color_t | color | ) |
Write the graphical memory with a single color pixel.
Use this function to write a single color pixel to the controller memory.
Limits have to be set prior to calling this function, e.g.:
color | The color pixel to write to the screen |
References Assert, ILI9341_CMD_MEMORY_WRITE, ili9341_deselect_chip(), ili9341_send_byte(), ili9341_send_command(), and ili9341_wait_for_send_done().
Referenced by gfx_ili9341_draw_line_pixel(), and gfx_ili9341_draw_pixel().