FluxDC/components/FluxDisplayPort/FluxDisplayPort.h
2025-04-28 17:49:47 +08:00

113 lines
2.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file FluxDisplayPort.h
* @brief LCD显示初始化
*
* 用于声明LCD控制IO及初始化函数
*
* @author wang xiang en
* @date 2025-04-18
* @version 版本号
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd
*/
#ifndef _FLUXDISPLAY_PORT_H
#define _FLUXDISPLAY_PORT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp_timer.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_vendor.h"
#include "esp_lcd_panel_ops.h"
#include "driver/gpio.h"
#include "lvgl.h"
#include "driver/i2c.h"
#include "esp_lcd_touch_ft5x06.h"
/* 定义LCD像素时钟频率 */
#define EXAMPLE_LCD_PIXEL_CLOCK_HZ CONFIG_EXAMPLE_LCD_PIXEL_CLOCK_HZ
/* 定义总线IO Num */
#define EXAMPLE_PIN_NUM_DATA0 GPIO_NUM_18
#define EXAMPLE_PIN_NUM_DATA1 GPIO_NUM_17
#define EXAMPLE_PIN_NUM_DATA2 GPIO_NUM_16
#define EXAMPLE_PIN_NUM_DATA3 GPIO_NUM_15
#define EXAMPLE_PIN_NUM_DATA4 GPIO_NUM_7
#define EXAMPLE_PIN_NUM_DATA5 GPIO_NUM_6
#define EXAMPLE_PIN_NUM_DATA6 GPIO_NUM_5
#define EXAMPLE_PIN_NUM_DATA7 GPIO_NUM_4
/* 定义80总线控制IO NUM */
#define EXAMPLE_PIN_NUM_PCLK GPIO_NUM_19
#define EXAMPLE_PIN_NUM_CS GPIO_NUM_0
#define EXAMPLE_PIN_NUM_DC GPIO_NUM_20
#define EXAMPLE_PIN_NUM_RST GPIO_NUM_8
#define EXAMPLE_PIN_NUM_BK_LIGHT GPIO_NUM_3
/* 定义背光开启/关闭GPIO电平值 */
#define EXAMPLE_LCD_BK_LIGHT_ON_LEVEL (0)
#define EXAMPLE_LCD_BK_LIGHT_OFF_LEVEL !EXAMPLE_LCD_BK_LIGHT_ON_LEVEL
/* 定义LCD参数 */
#define EXAMPLE_LCD_H_RES 320
#define EXAMPLE_LCD_V_RES 480
/* 定义80总线及RAM总线宽度 */
#define EXAMPLE_LCD_CMD_BITS 8
#define EXAMPLE_LCD_PARAM_BITS 8
/* 定义触摸屏控制IO */
#define EXAMPLE_I2C_NUM 0
#define EXAMPLE_I2C_SCL GPIO_NUM_39
#define EXAMPLE_I2C_SDA GPIO_NUM_38
/* 定义LVGL任务参数 */
#define EXAMPLE_LVGL_TICK_PERIOD_MS 2
#define EXAMPLE_LVGL_TASK_MAX_DELAY_MS 500
#define EXAMPLE_LVGL_TASK_MIN_DELAY_MS 1
#define EXAMPLE_LVGL_TASK_STACK_SIZE (16 * 1024)
#define EXAMPLE_LVGL_TASK_PRIORITY 3
#define EXAMPLE_DMA_BURST_SIZE (64)
/**
* @brief lvgl锁
*
* 加锁以保护临界资源
*
* @param[in] timeout_ms 锁住LVGL锁时间
* @return true lvgl锁成功
*
*/
bool example_lvgl_lock(int timeout_ms);
/**
* @brief lvgl解锁
*
* 解锁LVGL锁
*
*/
void example_lvgl_unlock(void);
/**
* @brief 最后总的触摸屏及LCD初始化函数
*
*/
void initialize_display_and_touch(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*_FLUXDISPLAY_PORT_H*/