#1 Cleanup and add L58 as driver in this component
This commit is contained in:
parent
c55e32a9d4
commit
a66706d139
12 changed files with 451 additions and 237 deletions
|
@ -93,10 +93,7 @@ menu "LVGL TFT/Epaper Display controller"
|
|||
bool
|
||||
help
|
||||
EPDIY parallel epaper controller.
|
||||
config LV_EPAPER_CALEPD_DISPLAY_CONTROLLER
|
||||
bool
|
||||
help
|
||||
CalEPD SPI epaper controller.
|
||||
|
||||
config LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||
bool
|
||||
help
|
||||
|
@ -283,12 +280,6 @@ menu "LVGL TFT/Epaper Display controller"
|
|||
bool "EPDIY_GENERIC"
|
||||
select LV_EPAPER_EPDIY_DISPLAY_CONTROLLER
|
||||
select LV_EPAPER_DISPLAY_PROTOCOL_PARALLEL
|
||||
|
||||
config LV_EPAPER_DISPLAY_USER_CONTROLLER_CALEPD
|
||||
bool "CALEPD_GENERIC"
|
||||
# Use also Parallel to avoid LGVL SPI instantiation
|
||||
select LV_EPAPER_CALEPD_DISPLAY_CONTROLLER
|
||||
select LV_EPAPER_DISPLAY_PROTOCOL_PARALLEL
|
||||
config LV_TFT_DISPLAY_USER_CONTROLLER_ILI9341
|
||||
bool "ILI9341"
|
||||
select LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "calepd_epaper.h"
|
||||
|
||||
// NOTE: This needs Epdiy component https://github.com/vroland/epdiy
|
||||
// Run idf.py menuconfig-> Component Config -> E-Paper driver and select:
|
||||
// Display type: LILIGO 4.7 ED047TC1
|
||||
// Board: LILIGO T5-4.7 Epaper
|
||||
// In the same section Component Config -> ESP32 Specifics -> Enable PSRAM
|
||||
//#include "parallel/ED047TC1.h"
|
||||
//Ed047TC1 display;
|
||||
|
||||
// SPI Generic epapers (Goodisplay/ Waveshare)
|
||||
// Select the right class for your SPI epaper: https://github.com/martinberlin/cale-idf/wiki
|
||||
//#include <gdew0583t7.h>
|
||||
#include <gdew027w3.h>
|
||||
Gdew027w3 display(io);
|
||||
EpdSpi io;
|
||||
//Gdew0583T7 display(io);
|
||||
|
||||
/** test Display dimensions
|
||||
* Do not forget to set: menuconfig -> Components -> LVGL configuration
|
||||
* Max. Horizontal resolution 264 -> WIDTH of your epaper
|
||||
* Max. Vertical resolution 176 -> HEIGHT
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define TAG "EPDIY"
|
||||
|
||||
uint16_t flushcalls = 0;
|
||||
|
||||
/* Display initialization routine */
|
||||
void calepd_init(void)
|
||||
{
|
||||
printf("calepd_init\n");
|
||||
display.init();
|
||||
display.setRotation(0);
|
||||
// Clear screen
|
||||
//display.update();
|
||||
}
|
||||
|
||||
/* Required by LVGL */
|
||||
void calepd_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
|
||||
{
|
||||
++flushcalls;
|
||||
printf("flush %d x:%d y:%d w:%d h:%d\n", flushcalls,area->x1,area->y1,lv_area_get_width(area),lv_area_get_height(area));
|
||||
|
||||
// Full update
|
||||
if (lv_area_get_width(area)==display.width() && lv_area_get_height(area)==display.height()) {
|
||||
display.update();
|
||||
} else {
|
||||
// Partial update:
|
||||
display.update(); // Uncomment to disable partial update
|
||||
//display.updateWindow(area->x1,area->y1,lv_area_get_width(area),lv_area_get_height(area), true);
|
||||
//display.updateWindow(area->x1,area->y1,lv_area_get_width(area),lv_area_get_height(area));
|
||||
}
|
||||
|
||||
/* IMPORTANT!!!
|
||||
* Inform the graphics library that you are ready with the flushing */
|
||||
lv_disp_flush_ready(drv);
|
||||
}
|
||||
|
||||
/* Called for each pixel */
|
||||
void calepd_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf,
|
||||
lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
//If not drawing anything: Debug to see if this function is called:
|
||||
//printf("set_px %d %d\n",(int16_t)x,(int16_t)y);
|
||||
|
||||
// Test using RGB232
|
||||
int16_t epd_color = EPD_WHITE;
|
||||
|
||||
// Color setting use: RGB232
|
||||
// Only monochrome:All what is not white, turn black
|
||||
if ((int16_t)color.full<254) {
|
||||
epd_color = EPD_BLACK;
|
||||
}
|
||||
display.drawPixel((int16_t)x, (int16_t)y, epd_color);
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Display class for generic e-Paper driven by EPDiy class
|
||||
*/
|
||||
#ifndef CALEPD_H
|
||||
#define CALEPD_H
|
||||
|
||||
#define EPDIY_COLUMNS (LV_HOR_RES_MAX / 8)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "lvgl/lvgl.h"
|
||||
#endif
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* Configure your display */
|
||||
void calepd_init(void);
|
||||
|
||||
/* LVGL callbacks */
|
||||
void calepd_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
||||
|
||||
/* Only for monochrome displays. But we use epdiy_set_px also for epapers */
|
||||
//void epdiy_rounder(lv_disp_drv_t *disp_drv, lv_area_t *area);
|
||||
void calepd_set_px_cb(lv_disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* EPDIY_H */
|
|
@ -12,8 +12,6 @@ void disp_driver_init(void)
|
|||
ili9341_init();
|
||||
#elif defined CONFIG_LV_EPAPER_EPDIY_DISPLAY_CONTROLLER
|
||||
epdiy_init();
|
||||
#elif defined CONFIG_LV_EPAPER_CALEPD_DISPLAY_CONTROLLER
|
||||
calepd_init();
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481
|
||||
ili9481_init();
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488
|
||||
|
@ -54,9 +52,7 @@ void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t *
|
|||
#if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||
ili9341_flush(drv, area, color_map);
|
||||
#elif defined CONFIG_LV_EPAPER_EPDIY_DISPLAY_CONTROLLER
|
||||
epdiy_flush(drv, area, color_map);
|
||||
#elif defined CONFIG_LV_EPAPER_CALEPD_DISPLAY_CONTROLLER
|
||||
calepd_flush(drv, area, color_map);
|
||||
epdiy_flush(drv, area, color_map);
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481
|
||||
ili9481_flush(drv, area, color_map);
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488
|
||||
|
@ -115,8 +111,6 @@ void disp_driver_set_px(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_
|
|||
ssd1306_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
|
||||
#elif defined CONFIG_LV_EPAPER_EPDIY_DISPLAY_CONTROLLER
|
||||
epdiy_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
|
||||
#elif defined CONFIG_LV_EPAPER_CALEPD_DISPLAY_CONTROLLER
|
||||
calepd_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107
|
||||
sh1107_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820
|
||||
|
|
|
@ -22,8 +22,6 @@ extern "C" {
|
|||
#include "ili9341.h"
|
||||
#elif defined CONFIG_LV_EPAPER_EPDIY_DISPLAY_CONTROLLER
|
||||
#include "lvgl_tft/epdiy_epaper.h"
|
||||
#elif defined CONFIG_LV_EPAPER_CALEPD_DISPLAY_CONTROLLER
|
||||
#include "lvgl_tft/calepd_epaper.h"
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481
|
||||
#include "ili9481.h"
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "epdiy_epaper.h"
|
||||
|
||||
#include "epd_driver.h"
|
||||
#include "epd_highlevel.h"
|
||||
|
||||
/**************************************************************************************************
|
||||
* NOTE: This file iis the first version that writes directly on the set_px callback
|
||||
* each pixel into the epaper display buffer. The second version is not epdiy_epaper.cpp
|
||||
* It writes *buf and then it comes as *color_map on the flush callback.
|
||||
* Feel free to experiment with this 2. epdiy_epaper.cpp works better to make a small UX
|
||||
**************************************************************************************************/
|
||||
#define TAG "EPDIY"
|
||||
EpdiyHighlevelState hl;
|
||||
uint16_t flushcalls = 0;
|
||||
uint8_t * framebuffer;
|
||||
uint8_t temperature = 25;
|
||||
|
||||
/* Display initialization routine */
|
||||
void epdiy_init(void)
|
||||
{
|
||||
epd_init(EPD_OPTIONS_DEFAULT);
|
||||
hl = epd_hl_init(EPD_BUILTIN_WAVEFORM);
|
||||
framebuffer = epd_hl_get_framebuffer(&hl);
|
||||
epd_poweron();
|
||||
//Clear all always in init?
|
||||
//epd_fullclear(&hl, temperature);
|
||||
}
|
||||
|
||||
uint16_t xo = 0;
|
||||
uint16_t yo = 0;
|
||||
|
||||
/* Required by LVGL */
|
||||
void epdiy_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
|
||||
{
|
||||
++flushcalls;
|
||||
xo = area->x1;
|
||||
yo = area->y1;
|
||||
uint16_t w = lv_area_get_width(area);
|
||||
uint16_t h = lv_area_get_height(area);
|
||||
|
||||
EpdRect update_area = {
|
||||
.x = xo,
|
||||
.y = yo,
|
||||
.width = w,
|
||||
.height = h,
|
||||
};
|
||||
|
||||
epd_hl_update_area(&hl, MODE_GC16, temperature, update_area); //update_area
|
||||
|
||||
printf("epdiy_flush %d x:%d y:%d w:%d h:%d\n", flushcalls,xo,yo,w,h);
|
||||
/* Inform the graphics library that you are ready with the flushing */
|
||||
lv_disp_flush_ready(drv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called for each pixel. Designed with the idea to fill the buffer directly, not to set each pixel, see:
|
||||
* https://forum.lvgl.io/t/lvgl-port-to-be-used-with-epaper-displays/5630/3
|
||||
*/
|
||||
void epdiy_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf,
|
||||
lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
// Debug where x y is printed, not all otherwise is too much Serial
|
||||
/* if ((int16_t)y%10==0 && flushcalls>0){
|
||||
if ((int16_t)x%2==0){
|
||||
printf("x%d y%d\n", (int16_t)x, (int16_t)y);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Test using RGB232
|
||||
int16_t epd_color = 255;
|
||||
if ((int16_t)color.full<250) {
|
||||
epd_color = (int16_t)color.full/3;
|
||||
}
|
||||
|
||||
int16_t x1 = (int16_t)x;
|
||||
int16_t y1 = (int16_t)y;
|
||||
|
||||
//Instead of using epd_draw_pixel: Set pixel directly in buffer
|
||||
//epd_draw_pixel(x1, y1, epd_color, framebuffer);
|
||||
uint8_t *buf_ptr = &framebuffer[y1 * buf_w / 2 + x1 / 2];
|
||||
if (x % 2) {
|
||||
*buf_ptr = (*buf_ptr & 0x0F) | (epd_color & 0xF0);
|
||||
} else {
|
||||
*buf_ptr = (*buf_ptr & 0xF0) | (epd_color >> 4);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue