lcd_display.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef LCD_DISPLAY_H
  2. #define LCD_DISPLAY_H
  3. #include "display.h"
  4. #include <esp_lcd_panel_io.h>
  5. #include <esp_lcd_panel_ops.h>
  6. #include <font_emoji.h>
  7. #include <atomic>
  8. class LcdDisplay : public Display {
  9. protected:
  10. esp_lcd_panel_io_handle_t panel_io_ = nullptr;
  11. esp_lcd_panel_handle_t panel_ = nullptr;
  12. lv_draw_buf_t draw_buf_;
  13. lv_obj_t* status_bar_ = nullptr;
  14. lv_obj_t* content_ = nullptr;
  15. lv_obj_t* container_ = nullptr;
  16. lv_obj_t* side_bar_ = nullptr;
  17. DisplayFonts fonts_;
  18. void SetupUI();
  19. virtual bool Lock(int timeout_ms = 0) override;
  20. virtual void Unlock() override;
  21. protected:
  22. // 添加protected构造函数
  23. LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, DisplayFonts fonts)
  24. : panel_io_(panel_io), panel_(panel), fonts_(fonts) {}
  25. public:
  26. ~LcdDisplay();
  27. virtual void SetEmotion(const char* emotion) override;
  28. virtual void SetIcon(const char* icon) override;
  29. #if CONFIG_USE_WECHAT_MESSAGE_STYLE
  30. virtual void SetChatMessage(const char* role, const char* content) override;
  31. #endif
  32. // Add theme switching function
  33. virtual void SetTheme(const std::string& theme_name) override;
  34. };
  35. // RGB LCD显示器
  36. class RgbLcdDisplay : public LcdDisplay {
  37. public:
  38. RgbLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  39. int width, int height, int offset_x, int offset_y,
  40. bool mirror_x, bool mirror_y, bool swap_xy,
  41. DisplayFonts fonts);
  42. };
  43. // MIPI LCD显示器
  44. class MipiLcdDisplay : public LcdDisplay {
  45. public:
  46. MipiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,i2c_master_bus_handle_t i2c_handle,
  47. int width, int height, int offset_x, int offset_y,
  48. bool mirror_x, bool mirror_y, bool swap_xy,
  49. DisplayFonts fonts);
  50. };
  51. // // SPI LCD显示器
  52. class SpiLcdDisplay : public LcdDisplay {
  53. public:
  54. SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  55. int width, int height, int offset_x, int offset_y,
  56. bool mirror_x, bool mirror_y, bool swap_xy,
  57. DisplayFonts fonts);
  58. };
  59. // QSPI LCD显示器
  60. class QspiLcdDisplay : public LcdDisplay {
  61. public:
  62. QspiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  63. int width, int height, int offset_x, int offset_y,
  64. bool mirror_x, bool mirror_y, bool swap_xy,
  65. DisplayFonts fonts);
  66. };
  67. // MCU8080 LCD显示器
  68. class Mcu8080LcdDisplay : public LcdDisplay {
  69. public:
  70. Mcu8080LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  71. int width, int height, int offset_x, int offset_y,
  72. bool mirror_x, bool mirror_y, bool swap_xy,
  73. DisplayFonts fonts);
  74. };
  75. #endif // LCD_DISPLAY_H