Files
xiaozhi-esp32/main/display.h

40 lines
769 B
C
Raw Normal View History

2024-10-01 14:16:12 +08:00
#ifndef DISPLAY_H
#define DISPLAY_H
2024-10-03 06:39:22 +08:00
#include <lvgl.h>
2024-10-15 03:56:35 +08:00
#include <esp_timer.h>
2024-10-01 14:16:12 +08:00
#include <string>
class Display {
public:
2024-11-06 06:18:56 +08:00
virtual ~Display();
2024-10-01 14:16:12 +08:00
2024-11-06 06:18:56 +08:00
void SetupUI();
2024-10-01 14:16:12 +08:00
void SetText(const std::string &text);
2024-10-15 03:56:35 +08:00
void ShowNotification(const std::string &text);
2024-10-01 14:16:12 +08:00
2024-10-29 00:22:29 +08:00
void UpdateDisplay();
2024-11-06 06:18:56 +08:00
int width() const { return width_; }
int height() const { return height_; }
2024-10-01 14:16:12 +08:00
2024-11-06 06:18:56 +08:00
protected:
2024-10-01 14:16:12 +08:00
lv_disp_t *disp_ = nullptr;
2024-10-29 00:22:29 +08:00
lv_font_t *font_ = nullptr;
2024-10-01 14:16:12 +08:00
lv_obj_t *label_ = nullptr;
2024-10-15 03:56:35 +08:00
lv_obj_t *notification_ = nullptr;
esp_timer_handle_t notification_timer_ = nullptr;
2024-10-29 00:22:29 +08:00
esp_timer_handle_t update_display_timer_ = nullptr;
2024-10-01 14:16:12 +08:00
2024-11-06 06:18:56 +08:00
int width_ = 0;
int height_ = 0;
2024-10-01 14:16:12 +08:00
std::string text_;
2024-11-06 06:18:56 +08:00
virtual void Lock() = 0;
virtual void Unlock() = 0;
2024-10-01 14:16:12 +08:00
};
#endif