40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
|
#include "lvgl.h"
|
|
#include "esp_lvgl_port.h"
|
|
#include "display/eink_display_handler.h"
|
|
#include "freertos/semphr.h"
|
|
#include "freertos/event_groups.h"
|
|
#include "esp_err.h"
|
|
#include <memory>
|
|
|
|
|
|
class LVGLHandler {
|
|
public:
|
|
LVGLHandler(
|
|
// an owning pointer to the display handler
|
|
// The display handler must outlive the LVGLHandler
|
|
// The display handler must be fully initialized before calling initLVGLDisplay
|
|
std::unique_ptr<EInkDisplayHandler> display_handler_in
|
|
);
|
|
~LVGLHandler();
|
|
esp_err_t initLVGL(EventGroupHandle_t system_event_group = nullptr);
|
|
|
|
private:
|
|
void rounder_cb_(lv_display_t* disp, lv_area_t* area);
|
|
void flush_cb_(lv_display_t* disp, const lv_area_t* area, uint8_t* px_map);
|
|
void touch_read_cb_(lv_indev_t* indev, lv_indev_data_t* data);
|
|
esp_err_t initLVGLDisplay_();
|
|
esp_err_t registerLVGLTouch_();
|
|
esp_err_t initLVGLPort_();
|
|
|
|
std::unique_ptr<EInkDisplayHandler> display_handler_ = nullptr;
|
|
|
|
lv_display_t* lvgl_display_ = nullptr;
|
|
lv_indev_t* lvgl_touch_indev_ = nullptr;
|
|
lv_draw_buf_t* lvgl_draw_buf_ = nullptr;
|
|
uint8_t* framebuffer_ = nullptr;
|
|
bool framebuffer_in_psram_ = false;
|
|
|
|
SemaphoreHandle_t lvgl_mutex_ = nullptr;
|
|
};
|