mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2025-05-17 15:20:29 +08:00
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
#ifndef LCD_DISPLAY_H
|
|
#define LCD_DISPLAY_H
|
|
|
|
#include "display.h"
|
|
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <driver/gpio.h>
|
|
#include <esp_lcd_panel_io.h>
|
|
#include <esp_lcd_panel_ops.h>
|
|
#include <esp_timer.h>
|
|
|
|
class LcdDisplay : public Display {
|
|
protected:
|
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
|
gpio_num_t backlight_pin_ = GPIO_NUM_NC;
|
|
bool backlight_output_invert_ = false;
|
|
bool mirror_x_ = false;
|
|
bool mirror_y_ = false;
|
|
bool swap_xy_ = false;
|
|
int offset_x_ = 0;
|
|
int offset_y_ = 0;
|
|
SemaphoreHandle_t lvgl_mutex_ = nullptr;
|
|
esp_timer_handle_t lvgl_tick_timer_ = nullptr;
|
|
|
|
lv_obj_t* status_bar_ = nullptr;
|
|
lv_obj_t* content_ = nullptr;
|
|
lv_obj_t* container_ = nullptr;
|
|
lv_obj_t* side_bar_ = nullptr;
|
|
lv_obj_t* chat_message_label_ = nullptr;
|
|
const lv_font_t* text_font_ = nullptr;
|
|
const lv_font_t* icon_font_ = nullptr;
|
|
|
|
void InitializeBacklight(gpio_num_t backlight_pin);
|
|
void SetBacklight(uint8_t brightness);
|
|
void LvglTask();
|
|
|
|
virtual void SetupUI();
|
|
virtual bool Lock(int timeout_ms = 0) override;
|
|
virtual void Unlock() override;
|
|
|
|
public:
|
|
LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
|
|
gpio_num_t backlight_pin, bool backlight_output_invert,
|
|
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy,
|
|
const lv_font_t* text_font, const lv_font_t* icon_font);
|
|
~LcdDisplay();
|
|
|
|
void SetChatMessage(const std::string &role, const std::string &content) override;
|
|
void SetEmotion(const std::string &emotion) override;
|
|
};
|
|
|
|
#endif // LCD_DISPLAY_H
|