Metal Detector
 
Loading...
Searching...
No Matches
display.c File Reference

Implementation file for display and touch handling. More...

#include "display.h"
#include "lvgl.h"
#include "spi.h"

Functions

static void dp_lvgl_flush (lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
 Flush the display buffer to the ILI9341 display.
 
static void dp_lvgl_read (lv_indev_t *indev, lv_indev_data_t *data)
 Read touch input data from the XPT2046 touchscreen.
 
void dp_init (void)
 Initialize the display and touchscreen.
 
void dp_lvgl_init (void)
 Initialize LVGL and set up the display buffer and input device.
 
void ILI9341_FillWindowCmpltCallBack (void)
 Callback function for ILI9341 fill window complete.
 

Variables

lv_display_t * display
 
lv_indev_t * indev
 
XPT2046Handle_t xpt2046Handle
 
SPI_HandleTypeDef * ili9341_spi = &hspi1
 
SPI_HandleTypeDef * xpt2046_spi = &hspi3
 

Detailed Description

Implementation file for display and touch handling.

This file contains the implementation for initializing and managing the display and touch input for the system. It includes functions for setting up the LVGL display buffer, flushing display data, and reading touch input from the XPT2046 touch screen controller. The file also includes a callback function for the ILI9341 display driver to indicate when a window fill operation is complete.

Created on: Jul 5, 2024 Author: Viktor

Function Documentation

◆ dp_init()

void dp_init ( void )

Initialize the display and touchscreen.

This function initializes the ILI9341 display and the XPT2046 touchscreen, including setting calibration values for the touchscreen.

◆ dp_lvgl_flush()

static void dp_lvgl_flush ( lv_display_t * disp,
const lv_area_t * area,
uint8_t * px_map )
static

Flush the display buffer to the ILI9341 display.

This function is called by LVGL to update the display area. It sets the window area on the ILI9341 and then starts the DMA transfer.

Parameters
dispPointer to the display structure.
areaPointer to the area to be updated.
px_mapPointer to the pixel map containing the buffer data.

◆ dp_lvgl_init()

void dp_lvgl_init ( void )

Initialize LVGL and set up the display buffer and input device.

This function initializes LVGL, creates a display and input device, sets up the display buffer, and assigns callback functions for display flushing and input reading.

◆ dp_lvgl_read()

static void dp_lvgl_read ( lv_indev_t * indev,
lv_indev_data_t * data )
static

Read touch input data from the XPT2046 touchscreen.

This function is called by LVGL to get touch input data from the XPT2046 touchscreen. It checks if the screen is pressed and reads the coordinates if it is.

Parameters
indevPointer to the input device structure.
dataPointer to the data structure where the touch input will be stored.

◆ ILI9341_FillWindowCmpltCallBack()

void ILI9341_FillWindowCmpltCallBack ( void )

Callback function for ILI9341 fill window complete.

Weak callback function for window fill completion.

This function is called when the DMA transfer to fill the window on the ILI9341 display is complete. It signals LVGL that the flush operation is done and the display is ready for the next update.

Variable Documentation

◆ display

lv_display_t* display

Pointer to the LVGL display object

◆ ili9341_spi

SPI_HandleTypeDef* ili9341_spi = &hspi1

SPI handle for the ILI9341 display

◆ indev

lv_indev_t* indev

Pointer to the LVGL input device object

◆ xpt2046_spi

SPI_HandleTypeDef* xpt2046_spi = &hspi3

SPI handle for the XPT2046 touch screen

◆ xpt2046Handle

XPT2046Handle_t xpt2046Handle

Handle for the XPT2046 touch screen controller