lvgl update 1

This commit is contained in:
gemu2015 2021-04-24 12:29:05 +02:00
parent 04f56d71c4
commit 7b83e5d1e6
4 changed files with 38 additions and 18 deletions

View File

@ -31,6 +31,17 @@ uint16_t uDisplay::GetColorFromIndex(uint8_t index) {
return udisp_colors[index];
}
uint16_t uDisplay::fgcol(void) {
return fg_col;
}
uint16_t uDisplay::bgcol(void) {
return bg_col;
}
int8_t uDisplay::color_type(void) {
return col_type;
}
uDisplay::~uDisplay(void) {
if (framebuffer) {
@ -40,6 +51,8 @@ uDisplay::~uDisplay(void) {
uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
// analyse decriptor
pwr_cbp = 0;
dim_cbp = 0;
framebuffer = 0;
col_mode = 16;
sa_mode = 16;
@ -915,8 +928,8 @@ void uDisplay::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
SPI_CS_HIGH
SPI_END_TRANSACTION
} else {
SPI_CS_LOW
SPI_BEGIN_TRANSACTION
SPI_CS_LOW
setAddrWindow_int(x0, y0, x1 - x0, y1 - y0 );
}
}
@ -1092,7 +1105,11 @@ void uDisplay::DisplayOnff(int8_t on) {
return;
}
udisp_bpwr(on);
if (pwr_cbp) {
pwr_cbp(on);
}
// udisp_bpwr(on);
if (interface == _UDSP_I2C) {
if (on) {
@ -1162,7 +1179,10 @@ void uDisplay::dim(uint8_t dim) {
if (bpanel >= 0) {
ledcWrite(ESP32_PWM_CHANNEL, dimmer);
} else {
udisp_dimm(dim);
//udisp_dimm(dim);
if (dim_cbp) {
dim_cbp(dim);
}
}
#endif

View File

@ -79,9 +79,9 @@ class uDisplay : public Renderer {
void DisplayOnff(int8_t on);
void Splash(void);
char *devname(void);
uint16_t fgcol(void) const { return fg_col; };
uint16_t bgcol(void) const { return bg_col; };
int8_t color_type(void) const { return col_type; };
uint16_t fgcol(void);
uint16_t bgcol(void);
int8_t color_type(void);
void dim(uint8_t dim);
uint16_t GetColorFromIndex(uint8_t index);
void setRotation(uint8_t m);
@ -90,6 +90,8 @@ class uDisplay : public Renderer {
void pushColors(uint16_t *data, uint16_t len, boolean first);
void TS_RotConvert(int16_t *x, int16_t *y);
void invertDisplay(boolean i);
void SetPwrCB(pwr_cb cb) { pwr_cbp = cb; };
void SetDimCB(dim_cb cb) { dim_cbp = cb; };
private:
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);

View File

@ -165,7 +165,7 @@ static void lv_flush_callback(lv_disp_drv_t *disp, const lv_area_t *area, lv_col
return; // ok
}
uDisplay_lvgl *display = glue->display;
Renderer *display = glue->display;
if (!glue->first_frame) {
//display->dmaWait(); // Wait for prior DMA transfer to complete
@ -174,11 +174,9 @@ static void lv_flush_callback(lv_disp_drv_t *disp, const lv_area_t *area, lv_col
glue->first_frame = false;
}
// display->startWrite();
// display->setAddrWindow(area->x1, area->y1, width, height);
display->writePixels(area->x1, area->y1, width, height,
(uint16_t *)color_p, width * height);
// display->pushColors((uint16_t *)color_p, width * height, false);
display->setAddrWindow(area->x1, area->y1, area->x1+width, area->y1+height);
display->pushColors((uint16_t *)color_p, width * height, true);
display->setAddrWindow(0,0,0,0);
lv_disp_flush_ready(disp);
}
@ -286,11 +284,11 @@ Adafruit_LvGL_Glue::~Adafruit_LvGL_Glue(void) {
* * LVGL_ERR_TIMER : Failure to set up timers
* * LVGL_ERR_ALLOC : Failure to allocate memory
*/
LvGLStatus Adafruit_LvGL_Glue::begin(uDisplay_lvgl *tft, bool debug) {
LvGLStatus Adafruit_LvGL_Glue::begin(Renderer *tft, bool debug) {
return begin(tft, (void *)NULL, debug);
}
LvGLStatus Adafruit_LvGL_Glue::begin(uDisplay_lvgl *tft, void *touch, bool debug) {
LvGLStatus Adafruit_LvGL_Glue::begin(Renderer *tft, void *touch, bool debug) {
lv_init();
// #if (LV_USE_LOG)

View File

@ -2,7 +2,7 @@
#define _ADAFRUIT_LVGL_GLUE_H_
#include <lvgl.h> // LittlevGL core lib
#include <uDisplay_lvgl.h>
#include <renderer.h>
#include <Ticker.h> // ESP32-specific timer lib
#include <FS.h>
@ -27,10 +27,10 @@ public:
// bool debug = false);
// LvGLStatus begin(uDisplay_lvgl *tft, TouchScreen *touch,
// bool debug = false);
LvGLStatus begin(uDisplay_lvgl *tft, bool debug = false);
LvGLStatus begin(Renderer *tft, bool debug = false);
// These items need to be public for some internal callbacks,
// but should be avoided by user code please!
uDisplay_lvgl *display; ///< Pointer to the SPITFT display instance
Renderer *display; ///< Pointer to the SPITFT display instance
void *touchscreen; ///< Pointer to the touchscreen object to use
bool is_adc_touch; ///< determines if the touchscreen controlelr is ADC based
bool first_frame; ///< Tracks if a call to `lv_flush_callback` needs to wait
@ -40,7 +40,7 @@ public:
void stopScreenshot(void) { screenshot = nullptr; }
private:
LvGLStatus begin(uDisplay_lvgl *tft, void *touch, bool debug);
LvGLStatus begin(Renderer *tft, void *touch, bool debug);
lv_disp_drv_t lv_disp_drv;
lv_disp_buf_t lv_disp_buf;
lv_color_t *lv_pixel_buf;