lcd_display.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. virtual 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. };
  30. // RGB LCD显示器
  31. class RgbLcdDisplay : public LcdDisplay {
  32. public:
  33. RgbLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  34. int width, int height, int offset_x, int offset_y,
  35. bool mirror_x, bool mirror_y, bool swap_xy,
  36. DisplayFonts fonts);
  37. };
  38. // MIPI LCD显示器
  39. class MipiLcdDisplay : public LcdDisplay {
  40. public:
  41. MipiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  42. int width, int height, int offset_x, int offset_y,
  43. bool mirror_x, bool mirror_y, bool swap_xy,
  44. DisplayFonts fonts);
  45. };
  46. // // SPI LCD显示器
  47. class SpiLcdDisplay : public LcdDisplay {
  48. public:
  49. SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  50. int width, int height, int offset_x, int offset_y,
  51. bool mirror_x, bool mirror_y, bool swap_xy,
  52. DisplayFonts fonts);
  53. };
  54. // QSPI LCD显示器
  55. class QspiLcdDisplay : public LcdDisplay {
  56. public:
  57. QspiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  58. int width, int height, int offset_x, int offset_y,
  59. bool mirror_x, bool mirror_y, bool swap_xy,
  60. DisplayFonts fonts);
  61. };
  62. // MCU8080 LCD显示器
  63. class Mcu8080LcdDisplay : public LcdDisplay {
  64. public:
  65. Mcu8080LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
  66. int width, int height, int offset_x, int offset_y,
  67. bool mirror_x, bool mirror_y, bool swap_xy,
  68. DisplayFonts fonts);
  69. };
  70. #endif // LCD_DISPLAY_H