OMOTE/Platformio/HAL/DisplayInterface.cpp

35 lines
No EOL
1.1 KiB
C++

#include "DisplayInterface.h"
std::shared_ptr<DisplayInterface> DisplayInterface::mInstance = nullptr;
DisplayInterface::DisplayInterface(){
lv_init();
lv_disp_draw_buf_init(&mdraw_buf, mbufA, mbufB,
SCREEN_WIDTH * SCREEN_HEIGHT / 10);
// Initialize the display driver
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = SCREEN_WIDTH;
disp_drv.ver_res = SCREEN_HEIGHT;
disp_drv.flush_cb = &DisplayInterface::flushDisplayImpl;
disp_drv.draw_buf = &mdraw_buf;
lv_disp_drv_register(&disp_drv);
// Initialize the touchscreen driver
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = &DisplayInterface::screenInputImpl;
lv_indev_drv_register(&indev_drv);
}
void DisplayInterface::flushDisplayImpl(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
mInstance->flushDisplay(disp, area, color_p);
}
void DisplayInterface::screenInputImpl(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) {
mInstance->screenInput(indev_driver, data);
}