Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding drivers for EPDiy supported parallel epapers #75

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a0113e0
Setup epdiy_epaper generic driver REF: https://github.com/martinberli…
martinberlin May 28, 2021
2d3a1fa
Make grays darker
martinberlin May 28, 2021
f4a760d
Enlarge DISP_BUF_SIZE. Remove epdiy_rounder callback since is not used
martinberlin May 28, 2021
7d339be
Attempt to add partial update when flush area is not full screen
martinberlin May 29, 2021
c9660bd
#3 Start adding L58: Find a way to instantiate existing class or refa…
martinberlin May 30, 2021
debae0b
#3 Add touch hook for Lilygo L58
martinberlin May 30, 2021
19b1ecd
Update epdiy driver using it standalone, without CalEPD. Previous is …
martinberlin Jun 1, 2021
18350e6
Add old calepd version
martinberlin Jun 1, 2021
42ae32f
Update epdiy_epaper to make void epdiy_set_px_cb callback write direc…
martinberlin Jun 1, 2021
160035c
Add generic CalEPD SPI epaper driver
martinberlin Jun 3, 2021
c539322
Using epdiy_set_px_cb *buf and returning *color_map in flush method t…
martinberlin Jun 11, 2021
cd28318
Clean up example with buffer copy
martinberlin Jun 11, 2021
6dfa2a1
Fill *buf initially with white in first set_px call. Remove additiona…
martinberlin Jun 12, 2021
d71793f
Now first version is renamed to epdiy_epaper_v1.cpp
martinberlin Jun 12, 2021
97a330c
Now v2 is the official EPDiy driver of this fork
martinberlin Jun 12, 2021
255a1a7
Update callbacks to support also fast update MODE_DU configurable wit…
martinberlin Jun 13, 2021
9a16924
Related to commit in https://github.com/martinberlin/lv_port_esp32-ep…
martinberlin Jun 13, 2021
588b14f
Leave buf_copy_to_framebuffer as the default method and Gabor method …
martinberlin Jun 13, 2021
4650001
Rendering correctly in full screen and small updates
martinberlin Jun 15, 2021
4004726
Merge branch 'lvgl:master' into master
martinberlin Jun 21, 2021
c55e32a
Update Readme
martinberlin Jun 21, 2021
a66706d
#1 Cleanup and add L58 as driver in this component
martinberlin Jun 22, 2021
bcd2b80
Merge branch 'master' into master
martinberlin Jun 23, 2021
22893f0
Add a reference to L58 include directory
martinberlin Jun 23, 2021
2868e21
#75 Start resolving conflicts (updating component)
martinberlin Jan 2, 2022
63bc5f4
#75 Update lvgl_tft
martinberlin Jan 2, 2022
0636e26
Merge branch 'master' into master
martinberlin Jan 2, 2022
d738aaa
#75 update I2C references since lvgl_i2c_conf.h is not used
martinberlin Jan 2, 2022
87bf29d
Update with epdiy last version support
martinberlin Aug 24, 2023
9445dab
epdiy V7 made a bit faster
martinberlin Aug 26, 2023
5ffb67f
Add GT911 using esp_lcd_touch_gt911
martinberlin Sep 2, 2023
03cf7ec
Exclude CalEPD and other tests from main CMakeLists.txt
martinberlin Mar 10, 2024
58d5feb
Updated for color output on Kaleido e-paper
Mar 11, 2024
a1acc7e
Keep also a copy of epdiy driver for grayscale without color filter e…
martinberlin Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update epdiy driver using it standalone, without CalEPD. Previous is …
…not epdiy_cale.cpp
martinberlin committed Jun 1, 2021
commit 19b1ecde22425defd4a61fb0a6e718d5c7755119
88 changes: 59 additions & 29 deletions lvgl_tft/epdiy_epaper.cpp
Original file line number Diff line number Diff line change
@@ -4,63 +4,93 @@

#include "epdiy_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;
#include "epd_driver.h"
#include "epd_highlevel.h"

/*********************
* DEFINES
*********************/
#define TAG "EPDIY"

EpdiyHighlevelState hl;
uint16_t flushcalls = 0;
uint8_t * framebuffer;
uint8_t temperature = 25;

/* Display initialization routine */
void epdiy_init(void)
{
printf("epdiy_init\n");
display.init();
display.setRotation(0);
display.clearScreen();
epd_init(EPD_OPTIONS_DEFAULT);
hl = epd_hl_init(EPD_BUILTIN_WAVEFORM);
framebuffer = epd_hl_get_framebuffer(&hl);
epd_fullclear(&hl, temperature);
epd_poweron();
}

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;
printf("epdiy_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));
xo = area->x1;
yo = area->y1;
uint16_t w = lv_area_get_width(area);
uint16_t h = 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: Looks nice but should find a way to clear that area first. Mode: MODE_EPDIY_WHITE_TO_GL16
display.updateWindow(area->x1,area->y1,lv_area_get_width(area),lv_area_get_height(area),MODE_GC16);
}

/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing */
EpdRect update_area = {
.x = xo,
.y = yo,
.width = w,
.height = h,
};

// Debug test: Draw box x:232 y:78 w:496 h:198. Flush coords are correct:
/* EpdRect rect_area = {
.x = 232,
.y = 78,
.width = 496,
.height = 198,
};
epd_draw_rect(rect_area, 0, framebuffer); */
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 */
/*
* 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)
{
// Is printing Y axis only till 40 px: And flushing too many times
//printf("%d ", (int16_t)y); // Works and prints "Hello world"
//printf("%d ",(int16_t)color.full); // Debug colors
// 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 = EPD_WHITE;
int16_t epd_color = 255;

// Color setting use: RGB232
if ((int16_t)color.full<250) {
epd_color = (int16_t)color.full/3;
}
display.drawPixel((int16_t)x, (int16_t)y, epd_color);

int16_t x1 = (int16_t)x;
int16_t y1 = (int16_t)y;
// Add offsets from last flush test. Why is drawing in wrong place?
// Bad idea: But is just writing in different area. And I don't understand why:
/* if (flushcalls>0) {
x1 = x1 + xo;
y1 = y1 + yo;
} */
epd_draw_pixel(x1, y1, epd_color, framebuffer);
}