diff --git a/README.md b/README.md index b9ca14f..18a2ddb 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,10 @@ - promotion panels from suppliers are welcome, to add support to GxEPD2 - donation panels from users are welcome, to add support to GxEPD2 -### Version 1.3.8 +### Version 1.3.9 +- fix for STM32 official package pin number range (int16_t) +- fix for refresh(int16_t x, int16_t y, int16_t w, int16_t h) methods screen intersection +#### Version 1.3.8 - added support for GDEQ042Z21 4.2" b/w/r 400x300 panel or Waveshare 4.2" V2 b/w/r board - the Waveshare 4.2" V2 b/w/r board requires the shortened reset pulse - added support for GDEW029I6FD 2.9" b/w 128x296 flexible board diff --git a/examples/GxEPD2_Example/GxEPD2_Example.ino b/examples/GxEPD2_Example/GxEPD2_Example.ino index b73e614..56318be 100644 --- a/examples/GxEPD2_Example/GxEPD2_Example.ino +++ b/examples/GxEPD2_Example/GxEPD2_Example.ino @@ -37,7 +37,7 @@ // or select the display class and display driver class in the following file (new style): #include "GxEPD2_display_selection_new_style.h" -#if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_) +#if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_) && !defined(ARDUINO_BLUEPILL_F103C8) // note 16.11.2019: the compiler may exclude code based on constant if statements (display.epd2.panel == constant), // therefore bitmaps may get optimized out by the linker diff --git a/examples/GxEPD2_Example/GxEPD2_display_selection.h b/examples/GxEPD2_Example/GxEPD2_display_selection.h index ca418ee..e4aa65d 100644 --- a/examples/GxEPD2_Example/GxEPD2_display_selection.h +++ b/examples/GxEPD2_Example/GxEPD2_display_selection.h @@ -199,56 +199,56 @@ #define MAX_DISPLAY_BUFFER_SIZE 15000ul // ~15k is a good compromise #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8)) // select one and adapt to your mapping -//GxEPD2_BW display(GxEPD2_102(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0102T4 -//GxEPD2_BW display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEP015OC1 no longer available -//GxEPD2_BW display(GxEPD2_154_D67(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154D67 -//GxEPD2_BW display(GxEPD2_154_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154T8 152x152 -//GxEPD2_BW display(GxEPD2_154_M09(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M09 200x200 -//GxEPD2_BW display(GxEPD2_154_M10(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M10 152x152 -//GxEPD2_BW display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDE0213B1, phased out -//GxEPD2_BW display(GxEPD2_213_B72(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B72 -//GxEPD2_BW display(GxEPD2_213_B73(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B73 -//GxEPD2_BW display(GxEPD2_213_B74(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM0213B74 -//GxEPD2_BW display(GxEPD2_213_flex(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213I5F -//GxEPD2_BW display(GxEPD2_213_M21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213M21 -//GxEPD2_BW display(GxEPD2_213_T5D(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213T5D -//GxEPD2_BW display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH029A1 -//GxEPD2_BW display(GxEPD2_290_T5(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5 -//GxEPD2_BW display(GxEPD2_290_T5D(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5D -//GxEPD2_BW display(GxEPD2_290_I6FD(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029I6FD -//GxEPD2_BW display(GxEPD2_290_T94(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029T94 -//GxEPD2_BW display(GxEPD2_290_T94_V2(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029T94, Waveshare 2.9" V2 variant -//GxEPD2_BW display(GxEPD2_290_M06(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029M06 -//GxEPD2_BW display(GxEPD2_260(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW026T0 -//GxEPD2_BW display(GxEPD2_260_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW026M01 -//GxEPD2_BW display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW027W3 -//GxEPD2_BW display(GxEPD2_371(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0371W7 -//GxEPD2_BW display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042T2 -//GxEPD2_BW display(GxEPD2_420_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042M01 -//GxEPD2_BW display(GxEPD2_583(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583T7 -//GxEPD2_BW display(GxEPD2_583_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583T8 648x480 -//GxEPD2_BW display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T8 640x384 -//GxEPD2_BW display(GxEPD2_750_T7(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T7 800x480 -//GxEPD2_BW < GxEPD2_1160_T91, MAX_HEIGHT(GxEPD2_1160_T91)> display(GxEPD2_1160_T91(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH116T91 960x640 +//GxEPD2_BW display(GxEPD2_102(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0102T4 +//GxEPD2_BW display(GxEPD2_154(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEP015OC1 no longer available +//GxEPD2_BW display(GxEPD2_154_D67(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0154D67 +//GxEPD2_BW display(GxEPD2_154_T8(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154T8 152x152 +//GxEPD2_BW display(GxEPD2_154_M09(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154M09 200x200 +//GxEPD2_BW display(GxEPD2_154_M10(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154M10 152x152 +//GxEPD2_BW display(GxEPD2_213(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDE0213B1, phased out +//GxEPD2_BW display(GxEPD2_213_B72(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0213B72 +//GxEPD2_BW display(GxEPD2_213_B73(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0213B73 +//GxEPD2_BW display(GxEPD2_213_B74(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM0213B74 +//GxEPD2_BW display(GxEPD2_213_flex(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213I5F +//GxEPD2_BW display(GxEPD2_213_M21(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213M21 +//GxEPD2_BW display(GxEPD2_213_T5D(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213T5D +//GxEPD2_BW display(GxEPD2_290(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH029A1 +//GxEPD2_BW display(GxEPD2_290_T5(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029T5 +//GxEPD2_BW display(GxEPD2_290_T5D(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029T5D +//GxEPD2_BW display(GxEPD2_290_I6FD(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029I6FD +//GxEPD2_BW display(GxEPD2_290_T94(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029T94 +//GxEPD2_BW display(GxEPD2_290_T94_V2(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029T94, Waveshare 2.9" V2 variant +//GxEPD2_BW display(GxEPD2_290_M06(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029M06 +//GxEPD2_BW display(GxEPD2_260(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW026T0 +//GxEPD2_BW display(GxEPD2_260_M01(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW026M01 +//GxEPD2_BW display(GxEPD2_270(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW027W3 +//GxEPD2_BW display(GxEPD2_371(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0371W7 +//GxEPD2_BW display(GxEPD2_420(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042T2 +//GxEPD2_BW display(GxEPD2_420_M01(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042M01 +//GxEPD2_BW display(GxEPD2_583(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583T7 +//GxEPD2_BW display(GxEPD2_583_T8(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583T8 648x480 +//GxEPD2_BW display(GxEPD2_750(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075T8 640x384 +//GxEPD2_BW display(GxEPD2_750_T7(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075T7 800x480 +//GxEPD2_BW < GxEPD2_1160_T91, MAX_HEIGHT(GxEPD2_1160_T91)> display(GxEPD2_1160_T91(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH116T91 960x640 // 3-color e-papers #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8)) -//GxEPD2_3C display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154Z04 no longer available -//GxEPD2_3C display(GxEPD2_154_Z90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154Z90 -//GxEPD2_3C display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213Z16 -//GxEPD2_3C display(GxEPD2_213_Z19c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213Z19 -//GxEPD2_3C display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029Z10 -//GxEPD2_3C display(GxEPD2_290_Z13c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH029Z13 -//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029C90 -//GxEPD2_3C display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW027C44 -//GxEPD2_3C display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042Z15 -//GxEPD2_3C display(GxEPD2_420c_Z21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEQ042Z21 -//GxEPD2_3C display(GxEPD2_583c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583Z21 -//GxEPD2_3C display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z09 -//GxEPD2_3C display(GxEPD2_750c_Z08(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z08 800x480 -//GxEPD2_3C display(GxEPD2_750c_Z90(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH075Z90 880x528 +//GxEPD2_3C display(GxEPD2_154c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154Z04 no longer available +//GxEPD2_3C display(GxEPD2_154_Z90c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0154Z90 +//GxEPD2_3C display(GxEPD2_213c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213Z16 +//GxEPD2_3C display(GxEPD2_213_Z19c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213Z19 +//GxEPD2_3C display(GxEPD2_290c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029Z10 +//GxEPD2_3C display(GxEPD2_290_Z13c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH029Z13 +//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029C90 +//GxEPD2_3C display(GxEPD2_270c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW027C44 +//GxEPD2_3C display(GxEPD2_420c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042Z15 +//GxEPD2_3C display(GxEPD2_420c_Z21(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEQ042Z21 +//GxEPD2_3C display(GxEPD2_583c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583Z21 +//GxEPD2_3C display(GxEPD2_750c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075Z09 +//GxEPD2_3C display(GxEPD2_750c_Z08(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075Z08 800x480 +//GxEPD2_3C display(GxEPD2_750c_Z90(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH075Z90 880x528 // 7-color e-paper #define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte -//GxEPD2_7C display(GxEPD2_565c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // Waveshare 5.65" 7-color +//GxEPD2_7C display(GxEPD2_565c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // Waveshare 5.65" 7-color #endif #if defined(__AVR) diff --git a/examples/GxEPD2_Example/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_Example/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_Example/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_Example/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_GFX_Example/GxEPD2_display_selection.h b/examples/GxEPD2_GFX_Example/GxEPD2_display_selection.h index ca418ee..e4aa65d 100644 --- a/examples/GxEPD2_GFX_Example/GxEPD2_display_selection.h +++ b/examples/GxEPD2_GFX_Example/GxEPD2_display_selection.h @@ -199,56 +199,56 @@ #define MAX_DISPLAY_BUFFER_SIZE 15000ul // ~15k is a good compromise #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8)) // select one and adapt to your mapping -//GxEPD2_BW display(GxEPD2_102(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0102T4 -//GxEPD2_BW display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEP015OC1 no longer available -//GxEPD2_BW display(GxEPD2_154_D67(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154D67 -//GxEPD2_BW display(GxEPD2_154_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154T8 152x152 -//GxEPD2_BW display(GxEPD2_154_M09(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M09 200x200 -//GxEPD2_BW display(GxEPD2_154_M10(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M10 152x152 -//GxEPD2_BW display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDE0213B1, phased out -//GxEPD2_BW display(GxEPD2_213_B72(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B72 -//GxEPD2_BW display(GxEPD2_213_B73(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B73 -//GxEPD2_BW display(GxEPD2_213_B74(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM0213B74 -//GxEPD2_BW display(GxEPD2_213_flex(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213I5F -//GxEPD2_BW display(GxEPD2_213_M21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213M21 -//GxEPD2_BW display(GxEPD2_213_T5D(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213T5D -//GxEPD2_BW display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH029A1 -//GxEPD2_BW display(GxEPD2_290_T5(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5 -//GxEPD2_BW display(GxEPD2_290_T5D(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5D -//GxEPD2_BW display(GxEPD2_290_I6FD(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029I6FD -//GxEPD2_BW display(GxEPD2_290_T94(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029T94 -//GxEPD2_BW display(GxEPD2_290_T94_V2(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029T94, Waveshare 2.9" V2 variant -//GxEPD2_BW display(GxEPD2_290_M06(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029M06 -//GxEPD2_BW display(GxEPD2_260(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW026T0 -//GxEPD2_BW display(GxEPD2_260_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW026M01 -//GxEPD2_BW display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW027W3 -//GxEPD2_BW display(GxEPD2_371(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0371W7 -//GxEPD2_BW display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042T2 -//GxEPD2_BW display(GxEPD2_420_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042M01 -//GxEPD2_BW display(GxEPD2_583(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583T7 -//GxEPD2_BW display(GxEPD2_583_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583T8 648x480 -//GxEPD2_BW display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T8 640x384 -//GxEPD2_BW display(GxEPD2_750_T7(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T7 800x480 -//GxEPD2_BW < GxEPD2_1160_T91, MAX_HEIGHT(GxEPD2_1160_T91)> display(GxEPD2_1160_T91(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH116T91 960x640 +//GxEPD2_BW display(GxEPD2_102(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0102T4 +//GxEPD2_BW display(GxEPD2_154(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEP015OC1 no longer available +//GxEPD2_BW display(GxEPD2_154_D67(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0154D67 +//GxEPD2_BW display(GxEPD2_154_T8(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154T8 152x152 +//GxEPD2_BW display(GxEPD2_154_M09(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154M09 200x200 +//GxEPD2_BW display(GxEPD2_154_M10(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154M10 152x152 +//GxEPD2_BW display(GxEPD2_213(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDE0213B1, phased out +//GxEPD2_BW display(GxEPD2_213_B72(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0213B72 +//GxEPD2_BW display(GxEPD2_213_B73(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0213B73 +//GxEPD2_BW display(GxEPD2_213_B74(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM0213B74 +//GxEPD2_BW display(GxEPD2_213_flex(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213I5F +//GxEPD2_BW display(GxEPD2_213_M21(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213M21 +//GxEPD2_BW display(GxEPD2_213_T5D(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213T5D +//GxEPD2_BW display(GxEPD2_290(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH029A1 +//GxEPD2_BW display(GxEPD2_290_T5(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029T5 +//GxEPD2_BW display(GxEPD2_290_T5D(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029T5D +//GxEPD2_BW display(GxEPD2_290_I6FD(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029I6FD +//GxEPD2_BW display(GxEPD2_290_T94(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029T94 +//GxEPD2_BW display(GxEPD2_290_T94_V2(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029T94, Waveshare 2.9" V2 variant +//GxEPD2_BW display(GxEPD2_290_M06(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029M06 +//GxEPD2_BW display(GxEPD2_260(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW026T0 +//GxEPD2_BW display(GxEPD2_260_M01(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW026M01 +//GxEPD2_BW display(GxEPD2_270(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW027W3 +//GxEPD2_BW display(GxEPD2_371(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0371W7 +//GxEPD2_BW display(GxEPD2_420(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042T2 +//GxEPD2_BW display(GxEPD2_420_M01(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042M01 +//GxEPD2_BW display(GxEPD2_583(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583T7 +//GxEPD2_BW display(GxEPD2_583_T8(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583T8 648x480 +//GxEPD2_BW display(GxEPD2_750(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075T8 640x384 +//GxEPD2_BW display(GxEPD2_750_T7(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075T7 800x480 +//GxEPD2_BW < GxEPD2_1160_T91, MAX_HEIGHT(GxEPD2_1160_T91)> display(GxEPD2_1160_T91(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH116T91 960x640 // 3-color e-papers #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8)) -//GxEPD2_3C display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154Z04 no longer available -//GxEPD2_3C display(GxEPD2_154_Z90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154Z90 -//GxEPD2_3C display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213Z16 -//GxEPD2_3C display(GxEPD2_213_Z19c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213Z19 -//GxEPD2_3C display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029Z10 -//GxEPD2_3C display(GxEPD2_290_Z13c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH029Z13 -//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029C90 -//GxEPD2_3C display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW027C44 -//GxEPD2_3C display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042Z15 -//GxEPD2_3C display(GxEPD2_420c_Z21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEQ042Z21 -//GxEPD2_3C display(GxEPD2_583c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583Z21 -//GxEPD2_3C display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z09 -//GxEPD2_3C display(GxEPD2_750c_Z08(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z08 800x480 -//GxEPD2_3C display(GxEPD2_750c_Z90(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH075Z90 880x528 +//GxEPD2_3C display(GxEPD2_154c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154Z04 no longer available +//GxEPD2_3C display(GxEPD2_154_Z90c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0154Z90 +//GxEPD2_3C display(GxEPD2_213c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213Z16 +//GxEPD2_3C display(GxEPD2_213_Z19c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213Z19 +//GxEPD2_3C display(GxEPD2_290c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029Z10 +//GxEPD2_3C display(GxEPD2_290_Z13c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH029Z13 +//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029C90 +//GxEPD2_3C display(GxEPD2_270c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW027C44 +//GxEPD2_3C display(GxEPD2_420c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042Z15 +//GxEPD2_3C display(GxEPD2_420c_Z21(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEQ042Z21 +//GxEPD2_3C display(GxEPD2_583c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583Z21 +//GxEPD2_3C display(GxEPD2_750c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075Z09 +//GxEPD2_3C display(GxEPD2_750c_Z08(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075Z08 800x480 +//GxEPD2_3C display(GxEPD2_750c_Z90(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH075Z90 880x528 // 7-color e-paper #define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte -//GxEPD2_7C display(GxEPD2_565c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // Waveshare 5.65" 7-color +//GxEPD2_7C display(GxEPD2_565c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // Waveshare 5.65" 7-color #endif #if defined(__AVR) diff --git a/examples/GxEPD2_GFX_Example/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_GFX_Example/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_GFX_Example/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_GFX_Example/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_HelloWorld/GxEPD2_display_selection.h b/examples/GxEPD2_HelloWorld/GxEPD2_display_selection.h index ca418ee..e4aa65d 100644 --- a/examples/GxEPD2_HelloWorld/GxEPD2_display_selection.h +++ b/examples/GxEPD2_HelloWorld/GxEPD2_display_selection.h @@ -199,56 +199,56 @@ #define MAX_DISPLAY_BUFFER_SIZE 15000ul // ~15k is a good compromise #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8)) // select one and adapt to your mapping -//GxEPD2_BW display(GxEPD2_102(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0102T4 -//GxEPD2_BW display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEP015OC1 no longer available -//GxEPD2_BW display(GxEPD2_154_D67(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154D67 -//GxEPD2_BW display(GxEPD2_154_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154T8 152x152 -//GxEPD2_BW display(GxEPD2_154_M09(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M09 200x200 -//GxEPD2_BW display(GxEPD2_154_M10(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M10 152x152 -//GxEPD2_BW display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDE0213B1, phased out -//GxEPD2_BW display(GxEPD2_213_B72(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B72 -//GxEPD2_BW display(GxEPD2_213_B73(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B73 -//GxEPD2_BW display(GxEPD2_213_B74(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM0213B74 -//GxEPD2_BW display(GxEPD2_213_flex(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213I5F -//GxEPD2_BW display(GxEPD2_213_M21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213M21 -//GxEPD2_BW display(GxEPD2_213_T5D(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213T5D -//GxEPD2_BW display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH029A1 -//GxEPD2_BW display(GxEPD2_290_T5(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5 -//GxEPD2_BW display(GxEPD2_290_T5D(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5D -//GxEPD2_BW display(GxEPD2_290_I6FD(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029I6FD -//GxEPD2_BW display(GxEPD2_290_T94(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029T94 -//GxEPD2_BW display(GxEPD2_290_T94_V2(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029T94, Waveshare 2.9" V2 variant -//GxEPD2_BW display(GxEPD2_290_M06(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029M06 -//GxEPD2_BW display(GxEPD2_260(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW026T0 -//GxEPD2_BW display(GxEPD2_260_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW026M01 -//GxEPD2_BW display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW027W3 -//GxEPD2_BW display(GxEPD2_371(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0371W7 -//GxEPD2_BW display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042T2 -//GxEPD2_BW display(GxEPD2_420_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042M01 -//GxEPD2_BW display(GxEPD2_583(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583T7 -//GxEPD2_BW display(GxEPD2_583_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583T8 648x480 -//GxEPD2_BW display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T8 640x384 -//GxEPD2_BW display(GxEPD2_750_T7(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T7 800x480 -//GxEPD2_BW < GxEPD2_1160_T91, MAX_HEIGHT(GxEPD2_1160_T91)> display(GxEPD2_1160_T91(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH116T91 960x640 +//GxEPD2_BW display(GxEPD2_102(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0102T4 +//GxEPD2_BW display(GxEPD2_154(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEP015OC1 no longer available +//GxEPD2_BW display(GxEPD2_154_D67(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0154D67 +//GxEPD2_BW display(GxEPD2_154_T8(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154T8 152x152 +//GxEPD2_BW display(GxEPD2_154_M09(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154M09 200x200 +//GxEPD2_BW display(GxEPD2_154_M10(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154M10 152x152 +//GxEPD2_BW display(GxEPD2_213(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDE0213B1, phased out +//GxEPD2_BW display(GxEPD2_213_B72(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0213B72 +//GxEPD2_BW display(GxEPD2_213_B73(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0213B73 +//GxEPD2_BW display(GxEPD2_213_B74(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM0213B74 +//GxEPD2_BW display(GxEPD2_213_flex(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213I5F +//GxEPD2_BW display(GxEPD2_213_M21(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213M21 +//GxEPD2_BW display(GxEPD2_213_T5D(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213T5D +//GxEPD2_BW display(GxEPD2_290(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH029A1 +//GxEPD2_BW display(GxEPD2_290_T5(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029T5 +//GxEPD2_BW display(GxEPD2_290_T5D(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029T5D +//GxEPD2_BW display(GxEPD2_290_I6FD(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029I6FD +//GxEPD2_BW display(GxEPD2_290_T94(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029T94 +//GxEPD2_BW display(GxEPD2_290_T94_V2(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029T94, Waveshare 2.9" V2 variant +//GxEPD2_BW display(GxEPD2_290_M06(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029M06 +//GxEPD2_BW display(GxEPD2_260(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW026T0 +//GxEPD2_BW display(GxEPD2_260_M01(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW026M01 +//GxEPD2_BW display(GxEPD2_270(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW027W3 +//GxEPD2_BW display(GxEPD2_371(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0371W7 +//GxEPD2_BW display(GxEPD2_420(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042T2 +//GxEPD2_BW display(GxEPD2_420_M01(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042M01 +//GxEPD2_BW display(GxEPD2_583(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583T7 +//GxEPD2_BW display(GxEPD2_583_T8(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583T8 648x480 +//GxEPD2_BW display(GxEPD2_750(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075T8 640x384 +//GxEPD2_BW display(GxEPD2_750_T7(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075T7 800x480 +//GxEPD2_BW < GxEPD2_1160_T91, MAX_HEIGHT(GxEPD2_1160_T91)> display(GxEPD2_1160_T91(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH116T91 960x640 // 3-color e-papers #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8)) -//GxEPD2_3C display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154Z04 no longer available -//GxEPD2_3C display(GxEPD2_154_Z90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154Z90 -//GxEPD2_3C display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213Z16 -//GxEPD2_3C display(GxEPD2_213_Z19c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213Z19 -//GxEPD2_3C display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029Z10 -//GxEPD2_3C display(GxEPD2_290_Z13c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH029Z13 -//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEM029C90 -//GxEPD2_3C display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW027C44 -//GxEPD2_3C display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042Z15 -//GxEPD2_3C display(GxEPD2_420c_Z21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEQ042Z21 -//GxEPD2_3C display(GxEPD2_583c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0583Z21 -//GxEPD2_3C display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z09 -//GxEPD2_3C display(GxEPD2_750c_Z08(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z08 800x480 -//GxEPD2_3C display(GxEPD2_750c_Z90(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH075Z90 880x528 +//GxEPD2_3C display(GxEPD2_154c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0154Z04 no longer available +//GxEPD2_3C display(GxEPD2_154_Z90c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH0154Z90 +//GxEPD2_3C display(GxEPD2_213c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213Z16 +//GxEPD2_3C display(GxEPD2_213_Z19c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0213Z19 +//GxEPD2_3C display(GxEPD2_290c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW029Z10 +//GxEPD2_3C display(GxEPD2_290_Z13c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH029Z13 +//GxEPD2_3C display(GxEPD2_290_C90c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEM029C90 +//GxEPD2_3C display(GxEPD2_270c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW027C44 +//GxEPD2_3C display(GxEPD2_420c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW042Z15 +//GxEPD2_3C display(GxEPD2_420c_Z21(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEQ042Z21 +//GxEPD2_3C display(GxEPD2_583c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW0583Z21 +//GxEPD2_3C display(GxEPD2_750c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075Z09 +//GxEPD2_3C display(GxEPD2_750c_Z08(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEW075Z08 800x480 +//GxEPD2_3C display(GxEPD2_750c_Z90(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // GDEH075Z90 880x528 // 7-color e-paper #define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte -//GxEPD2_7C display(GxEPD2_565c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // Waveshare 5.65" 7-color +//GxEPD2_7C display(GxEPD2_565c(/*CS=PA4*/ SS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); // Waveshare 5.65" 7-color #endif #if defined(__AVR) diff --git a/examples/GxEPD2_HelloWorld/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_HelloWorld/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_HelloWorld/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_HelloWorld/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_MinimumExample/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_MinimumExample/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_MinimumExample/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_MinimumExample/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_NotPagedExample/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_NotPagedExample/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_NotPagedExample/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_NotPagedExample/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_PagedDisplayUsingCallback/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_PagedDisplayUsingCallback/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_PagedDisplayUsingCallback/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_PagedDisplayUsingCallback/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_SD_Example/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_SD_Example/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_SD_Example/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_SD_Example/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_SerialFlash_Example/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_SerialFlash_Example/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_SerialFlash_Example/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_SerialFlash_Example/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_Spiffs_Example/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_Spiffs_Example/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_Spiffs_Example/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_Spiffs_Example/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/examples/GxEPD2_U8G2_Fonts_Example/GxEPD2_display_selection_new_style.h b/examples/GxEPD2_U8G2_Fonts_Example/GxEPD2_display_selection_new_style.h index 68de969..88fe910 100644 --- a/examples/GxEPD2_U8G2_Fonts_Example/GxEPD2_display_selection_new_style.h +++ b/examples/GxEPD2_U8G2_Fonts_Example/GxEPD2_display_selection_new_style.h @@ -53,7 +53,7 @@ //#define GxEPD2_DRIVER_CLASS GxEPD2_1248 // GDEW1248T3 1303x984, UC8179 // 3-color e-papers //#define GxEPD2_DRIVER_CLASS GxEPD2_154c // GDEW0154Z04 200x200, IL0376F, no longer available -//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1682 +//#define GxEPD2_DRIVER_CLASS GxEPD2_154_Z90c // GDEH0154Z90 200x200, SSD1681 //#define GxEPD2_DRIVER_CLASS GxEPD2_213c // GDEW0213Z16 104x212, UC8151 (IL0373) //#define GxEPD2_DRIVER_CLASS GxEPD2_213_Z19c // GDEW0213Z19 104x212, UC8151D //#define GxEPD2_DRIVER_CLASS GxEPD2_290c // GDEW029Z10 128x296, UC8151 (IL0373) @@ -149,7 +149,7 @@ GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 > display(GxEPD2_1248(/*sck=*/ #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) #endif // adapt the constructor parameters to your wiring -GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); +GxEPD2_DISPLAY_CLASS display(GxEPD2_DRIVER_CLASS(/*CS=PA4*/ EPD_CS, /*DC=*/ PA3, /*RST=*/ PA2, /*BUSY=*/ PA1)); #endif #if defined(__AVR) diff --git a/extras/sw_spi/src/GxEPD2_EPD.cpp b/extras/sw_spi/src/GxEPD2_EPD.cpp index 20ff581..df22045 100644 --- a/extras/sw_spi/src/GxEPD2_EPD.cpp +++ b/extras/sw_spi/src/GxEPD2_EPD.cpp @@ -26,7 +26,7 @@ #include #endif -GxEPD2_EPD::GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout, +GxEPD2_EPD::GxEPD2_EPD(int16_t cs, int16_t dc, int16_t rst, int16_t busy, int16_t busy_level, uint32_t busy_timeout, uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu) : WIDTH(w), HEIGHT(h), panel(p), hasColor(c), hasPartialUpdate(pu), hasFastPartialUpdate(fpu), _sck(-1), _mosi(-1), @@ -78,7 +78,7 @@ void GxEPD2_EPD::init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset if (_sck < 0) SPI.begin(); } -void GxEPD2_EPD::init(int8_t sck, int8_t mosi, uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration, bool pulldown_rst_mode) +void GxEPD2_EPD::init(int16_t sck, int16_t mosi, uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration, bool pulldown_rst_mode) { if ((sck >= 0) && (mosi >= 0)) { diff --git a/extras/sw_spi/src/GxEPD2_EPD.h b/extras/sw_spi/src/GxEPD2_EPD.h index 6843989..d190572 100644 --- a/extras/sw_spi/src/GxEPD2_EPD.h +++ b/extras/sw_spi/src/GxEPD2_EPD.h @@ -40,11 +40,11 @@ class GxEPD2_EPD const bool hasPartialUpdate; const bool hasFastPartialUpdate; // constructor - GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout, + GxEPD2_EPD(int16_t cs, int16_t dc, int16_t rst, int16_t busy, int16_t busy_level, uint32_t busy_timeout, uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu); virtual void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled virtual void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); - virtual void init(int8_t sck, int8_t mosi, uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); + virtual void init(int16_t sck, int16_t mosi, uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); // Support for Bitmaps (Sprites) to Controller Buffer and to Screen virtual void clearScreen(uint8_t value) = 0; // init controller memory and screen (default white) virtual void writeScreenBuffer(uint8_t value) = 0; // init controller memory (default white) @@ -121,8 +121,8 @@ class GxEPD2_EPD uint8_t _readData(); void _readData(uint8_t* data, uint16_t n); protected: - int8_t _sck, _mosi; - int8_t _cs, _dc, _rst, _busy, _busy_level; + int16_t _sck, _mosi; + int16_t _cs, _dc, _rst, _busy, _busy_level; uint32_t _busy_timeout; bool _diag_enabled, _pulldown_rst_mode; SPISettings _spi_settings; diff --git a/library.properties b/library.properties index 24e3f9a..3acf687 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=GxEPD2 -version=1.3.8 +version=1.3.9 author=Jean-Marc Zingg maintainer=Jean-Marc Zingg sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare. diff --git a/src/GxEPD2_EPD.cpp b/src/GxEPD2_EPD.cpp index 876be88..e945aa7 100644 --- a/src/GxEPD2_EPD.cpp +++ b/src/GxEPD2_EPD.cpp @@ -17,7 +17,7 @@ #include #endif -GxEPD2_EPD::GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout, +GxEPD2_EPD::GxEPD2_EPD(int16_t cs, int16_t dc, int16_t rst, int16_t busy, int16_t busy_level, uint32_t busy_timeout, uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu) : WIDTH(w), HEIGHT(h), panel(p), hasColor(c), hasPartialUpdate(pu), hasFastPartialUpdate(fpu), _cs(cs), _dc(dc), _rst(rst), _busy(busy), _busy_level(busy_level), _busy_timeout(busy_timeout), _diag_enabled(false), diff --git a/src/GxEPD2_EPD.h b/src/GxEPD2_EPD.h index 2075ac9..8219074 100644 --- a/src/GxEPD2_EPD.h +++ b/src/GxEPD2_EPD.h @@ -30,7 +30,7 @@ class GxEPD2_EPD const bool hasPartialUpdate; const bool hasFastPartialUpdate; // constructor - GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout, + GxEPD2_EPD(int16_t cs, int16_t dc, int16_t rst, int16_t busy, int16_t busy_level, uint32_t busy_timeout, uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu); virtual void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled virtual void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); @@ -104,7 +104,7 @@ class GxEPD2_EPD void _transfer(uint8_t value); void _endTransfer(); protected: - int8_t _cs, _dc, _rst, _busy, _busy_level; + int16_t _cs, _dc, _rst, _busy, _busy_level; uint32_t _busy_timeout; bool _diag_enabled, _pulldown_rst_mode; SPISettings _spi_settings; diff --git a/src/epd/GxEPD2_102.cpp b/src/epd/GxEPD2_102.cpp index abdb704..f9f64b8 100644 --- a/src/epd/GxEPD2_102.cpp +++ b/src/epd/GxEPD2_102.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_102.h" -GxEPD2_102::GxEPD2_102(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_102::GxEPD2_102(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -248,14 +248,18 @@ void GxEPD2_102::refresh(bool partial_update_mode) void GxEPD2_102::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_102.h b/src/epd/GxEPD2_102.h index edd4026..77bfe68 100644 --- a/src/epd/GxEPD2_102.h +++ b/src/epd/GxEPD2_102.h @@ -33,7 +33,7 @@ class GxEPD2_102 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3600; // ms, e.g. 3507492us static const uint16_t partial_refresh_time = 1200; // ms, e.g. 1102149us // constructor - GxEPD2_102(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_102(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_1160_T91.cpp b/src/epd/GxEPD2_1160_T91.cpp index 23ee0d2..1c84142 100644 --- a/src/epd/GxEPD2_1160_T91.cpp +++ b/src/epd/GxEPD2_1160_T91.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_1160_T91.h" -GxEPD2_1160_T91::GxEPD2_1160_T91(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_1160_T91::GxEPD2_1160_T91(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -253,14 +253,18 @@ void GxEPD2_1160_T91::refresh(bool partial_update_mode) void GxEPD2_1160_T91::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_1160_T91.h b/src/epd/GxEPD2_1160_T91.h index bc3f4d4..713f285 100644 --- a/src/epd/GxEPD2_1160_T91.h +++ b/src/epd/GxEPD2_1160_T91.h @@ -31,7 +31,7 @@ class GxEPD2_1160_T91 : public GxEPD2_EPD static const uint16_t full_refresh_time = 6200; // ms, e.g. 6180001us static const uint16_t partial_refresh_time = 6200; // ms, e.g. 6180001us // constructor - GxEPD2_1160_T91(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_1160_T91(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_1248.cpp b/src/epd/GxEPD2_1248.cpp index bb67160..82f3e69 100644 --- a/src/epd/GxEPD2_1248.cpp +++ b/src/epd/GxEPD2_1248.cpp @@ -15,10 +15,10 @@ #if defined(ESP32) // general constructor for use with all parameters on ESP32, e.g. for Waveshare ESP32 driver board mounted on connection board -GxEPD2_1248::GxEPD2_1248(int8_t sck, int8_t miso, int8_t mosi, - int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, - int8_t dc1, int8_t dc2, int8_t rst1, int8_t rst2, - int8_t busy_m1, int8_t busy_s1, int8_t busy_m2, int8_t busy_s2) : +GxEPD2_1248::GxEPD2_1248(int16_t sck, int16_t miso, int16_t mosi, + int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, + int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2, + int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2) : GxEPD2_EPD(cs_m1, dc1, rst1, busy_m1, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate), _sck(sck), _miso(miso), _mosi(mosi), _dc1(dc1), _dc2(dc2), _rst1(rst1), _rst2(rst2), _cs_m1(cs_m1), _cs_s1(cs_s1), _cs_m2(cs_m2), _cs_s2(cs_s2), @@ -33,9 +33,9 @@ GxEPD2_1248::GxEPD2_1248(int8_t sck, int8_t miso, int8_t mosi, #endif // general constructor for use with standard SPI pins, default SCK, MISO and MOSI -GxEPD2_1248::GxEPD2_1248(int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, - int8_t dc1, int8_t dc2, int8_t rst1, int8_t rst2, - int8_t busy_m1, int8_t busy_s1, int8_t busy_m2, int8_t busy_s2) : +GxEPD2_1248::GxEPD2_1248(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, + int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2, + int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2) : GxEPD2_EPD(cs_m1, dc1, rst1, busy_m1, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate), _sck(SCK), _miso(MISO), _mosi(MOSI), _dc1(dc1), _dc2(dc2), _rst1(rst1), _rst2(rst2), _cs_m1(cs_m1), _cs_s1(cs_s1), _cs_m2(cs_m2), _cs_s2(cs_s2), @@ -49,7 +49,7 @@ GxEPD2_1248::GxEPD2_1248(int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, } // constructor with minimal parameter set, standard SPI, dc1 and dc2, rst1 and rst2 to one pin, one busy used (can be -1) -GxEPD2_1248::GxEPD2_1248(int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_1248::GxEPD2_1248(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(23, 25, 33, 32, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate), _sck(SCK), _miso(MISO), _mosi(MOSI), _dc1(dc), _dc2(dc), _rst1(rst), _rst2(rst), _cs_m1(cs_m1), _cs_s1(cs_s1), _cs_m2(cs_m2), _cs_s2(cs_s2), @@ -702,7 +702,7 @@ void GxEPD2_1248::_readController(uint8_t cmd, uint8_t* data, uint16_t n, int8_t _initSPI(); } -GxEPD2_1248::ScreenPart::ScreenPart(uint16_t width, uint16_t height, bool rev_scan, int8_t cs, int8_t dc) : +GxEPD2_1248::ScreenPart::ScreenPart(uint16_t width, uint16_t height, bool rev_scan, int16_t cs, int16_t dc) : WIDTH(width), HEIGHT(height), _rev_scan(rev_scan), _cs(cs), _dc(dc), _spi_settings(4000000, MSBFIRST, SPI_MODE0) { diff --git a/src/epd/GxEPD2_1248.h b/src/epd/GxEPD2_1248.h index cd06dd9..e6f5211 100644 --- a/src/epd/GxEPD2_1248.h +++ b/src/epd/GxEPD2_1248.h @@ -33,17 +33,17 @@ class GxEPD2_1248 : public GxEPD2_EPD // constructors #if defined(ESP32) // general constructor for use with all parameters on ESP32, e.g. for Waveshare ESP32 driver board mounted on connection board - GxEPD2_1248(int8_t sck, int8_t miso, int8_t mosi, - int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, - int8_t dc1, int8_t dc2, int8_t rst1, int8_t rst2, - int8_t busy_m1, int8_t busy_s1, int8_t busy_m2, int8_t busy_s2); + GxEPD2_1248(int16_t sck, int16_t miso, int16_t mosi, + int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, + int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2, + int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2); #endif // general constructor for use with standard SPI pins, default SCK, MISO and MOSI - GxEPD2_1248(int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, - int8_t dc1, int8_t dc2, int8_t rst1, int8_t rst2, - int8_t busy_m1, int8_t busy_s1, int8_t busy_m2, int8_t busy_s2); + GxEPD2_1248(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, + int16_t dc1, int16_t dc2, int16_t rst1, int16_t rst2, + int16_t busy_m1, int16_t busy_s1, int16_t busy_m2, int16_t busy_s2); // constructor with minimal parameter set, standard SPI, dc1 and dc2, rst1 and rst2 to one pin, one busy used (can be -1) - GxEPD2_1248(int8_t cs_m1, int8_t cs_s1, int8_t cs_m2, int8_t cs_s2, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_1248(int16_t cs_m1, int16_t cs_s1, int16_t cs_m2, int16_t cs_s2, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); @@ -99,9 +99,9 @@ class GxEPD2_1248 : public GxEPD2_EPD friend class GDEW1248T3_OTP; void _readController(uint8_t cmd, uint8_t* data, uint16_t n, int8_t cs = -1, int8_t dc = -1); private: - int8_t _sck, _miso, _mosi, _dc1, _dc2, _rst1, _rst2; - int8_t _cs_m1, _cs_s1, _cs_m2, _cs_s2; - int8_t _busy_m1, _busy_s1, _busy_m2, _busy_s2; + int16_t _sck, _miso, _mosi, _dc1, _dc2, _rst1, _rst2; + int16_t _cs_m1, _cs_s1, _cs_m2, _cs_s2; + int16_t _busy_m1, _busy_s1, _busy_m2, _busy_s2; int8_t _temperature; static const unsigned char lut_20_LUTC_partial[]; static const unsigned char lut_21_LUTWW_partial[]; @@ -113,7 +113,7 @@ class GxEPD2_1248 : public GxEPD2_EPD class ScreenPart { public: - ScreenPart(uint16_t width, uint16_t height, bool rev_scan, int8_t cs, int8_t dc); + ScreenPart(uint16_t width, uint16_t height, bool rev_scan, int16_t cs, int16_t dc); void writeScreenBuffer(uint8_t command, uint8_t value = 0xFF); // init controller memory current (default white) void writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); @@ -128,7 +128,7 @@ class GxEPD2_1248 : public GxEPD2_EPD const uint16_t WIDTH, HEIGHT; private: bool _rev_scan; - int8_t _cs, _dc; + int16_t _cs, _dc; const SPISettings _spi_settings; }; ScreenPart M1, S1, M2, S2; diff --git a/src/epd/GxEPD2_154.cpp b/src/epd/GxEPD2_154.cpp index ce3dc62..683d3f8 100644 --- a/src/epd/GxEPD2_154.cpp +++ b/src/epd/GxEPD2_154.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_154.h" -GxEPD2_154::GxEPD2_154(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154::GxEPD2_154(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -245,14 +245,18 @@ void GxEPD2_154::refresh(bool partial_update_mode) void GxEPD2_154::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_154.h b/src/epd/GxEPD2_154.h index 59c9975..16bb1bb 100644 --- a/src/epd/GxEPD2_154.h +++ b/src/epd/GxEPD2_154.h @@ -30,7 +30,7 @@ class GxEPD2_154 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1200; // ms, e.g. 1113273us static const uint16_t partial_refresh_time = 300; // ms, e.g. 290867us // constructor - GxEPD2_154(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_154_D67.cpp b/src/epd/GxEPD2_154_D67.cpp index c81c2f4..8e4cdc0 100644 --- a/src/epd/GxEPD2_154_D67.cpp +++ b/src/epd/GxEPD2_154_D67.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_154_D67.h" -GxEPD2_154_D67::GxEPD2_154_D67(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154_D67::GxEPD2_154_D67(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -252,14 +252,18 @@ void GxEPD2_154_D67::refresh(bool partial_update_mode) void GxEPD2_154_D67::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_154_D67.h b/src/epd/GxEPD2_154_D67.h index af6b824..7a7ac3b 100644 --- a/src/epd/GxEPD2_154_D67.h +++ b/src/epd/GxEPD2_154_D67.h @@ -31,7 +31,7 @@ class GxEPD2_154_D67 : public GxEPD2_EPD static const uint16_t full_refresh_time = 2600; // ms, e.g. 2509602us static const uint16_t partial_refresh_time = 500; // ms, e.g. 457282us // constructor - GxEPD2_154_D67(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154_D67(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_154_M09.cpp b/src/epd/GxEPD2_154_M09.cpp index a77d438..3027197 100644 --- a/src/epd/GxEPD2_154_M09.cpp +++ b/src/epd/GxEPD2_154_M09.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_154_M09.h" -GxEPD2_154_M09::GxEPD2_154_M09(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154_M09::GxEPD2_154_M09(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -250,14 +250,18 @@ void GxEPD2_154_M09::refresh(bool partial_update_mode) void GxEPD2_154_M09::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_154_M09.h b/src/epd/GxEPD2_154_M09.h index 5cee6b6..d3e156b 100644 --- a/src/epd/GxEPD2_154_M09.h +++ b/src/epd/GxEPD2_154_M09.h @@ -31,7 +31,7 @@ class GxEPD2_154_M09 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1000; // ms, e.g. 924485us static const uint16_t partial_refresh_time = 400; // ms, e.g. 324440us // constructor - GxEPD2_154_M09(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154_M09(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_154_M10.cpp b/src/epd/GxEPD2_154_M10.cpp index 839f86e..e429aae 100644 --- a/src/epd/GxEPD2_154_M10.cpp +++ b/src/epd/GxEPD2_154_M10.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_154_M10.h" -GxEPD2_154_M10::GxEPD2_154_M10(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154_M10::GxEPD2_154_M10(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -239,14 +239,18 @@ void GxEPD2_154_M10::refresh(bool partial_update_mode) void GxEPD2_154_M10::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_154_M10.h b/src/epd/GxEPD2_154_M10.h index a58bdf6..06e0105 100644 --- a/src/epd/GxEPD2_154_M10.h +++ b/src/epd/GxEPD2_154_M10.h @@ -31,7 +31,7 @@ class GxEPD2_154_M10 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4000; // ms, e.g. 3665378us static const uint16_t partial_refresh_time = 1700; // ms, e.g. 1635335us // constructor - GxEPD2_154_M10(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154_M10(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_154_T8.cpp b/src/epd/GxEPD2_154_T8.cpp index 17d9126..c73527d 100644 --- a/src/epd/GxEPD2_154_T8.cpp +++ b/src/epd/GxEPD2_154_T8.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_154_T8.h" -GxEPD2_154_T8::GxEPD2_154_T8(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154_T8::GxEPD2_154_T8(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -221,14 +221,18 @@ void GxEPD2_154_T8::refresh(bool partial_update_mode) void GxEPD2_154_T8::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_154_T8.h b/src/epd/GxEPD2_154_T8.h index fe3f5bb..2d6a0fc 100644 --- a/src/epd/GxEPD2_154_T8.h +++ b/src/epd/GxEPD2_154_T8.h @@ -31,7 +31,7 @@ class GxEPD2_154_T8 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1600; // ms, e.g. 1525624us static const uint16_t partial_refresh_time = 350; // ms, e.g. 349355us // constructor - GxEPD2_154_T8(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154_T8(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213.cpp b/src/epd/GxEPD2_213.cpp index 58b115a..ae27636 100644 --- a/src/epd/GxEPD2_213.cpp +++ b/src/epd/GxEPD2_213.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_213.h" -GxEPD2_213::GxEPD2_213(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213::GxEPD2_213(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -245,14 +245,18 @@ void GxEPD2_213::refresh(bool partial_update_mode) void GxEPD2_213::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_213.h b/src/epd/GxEPD2_213.h index 81e022e..7d95456 100644 --- a/src/epd/GxEPD2_213.h +++ b/src/epd/GxEPD2_213.h @@ -30,7 +30,7 @@ class GxEPD2_213 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4000; // ms, e.g. 3883686us static const uint16_t partial_refresh_time = 300; // ms, e.g. 268173us // constructor - GxEPD2_213(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213_B72.cpp b/src/epd/GxEPD2_213_B72.cpp index 1da4185..6854dd8 100644 --- a/src/epd/GxEPD2_213_B72.cpp +++ b/src/epd/GxEPD2_213_B72.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_213_B72.h" -GxEPD2_213_B72::GxEPD2_213_B72(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_B72::GxEPD2_213_B72(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -246,14 +246,18 @@ void GxEPD2_213_B72::refresh(bool partial_update_mode) void GxEPD2_213_B72::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_213_B72.h b/src/epd/GxEPD2_213_B72.h index a69f39a..4162dc1 100644 --- a/src/epd/GxEPD2_213_B72.h +++ b/src/epd/GxEPD2_213_B72.h @@ -30,7 +30,7 @@ class GxEPD2_213_B72 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1700; // ms, e.g. 1686008us static const uint16_t partial_refresh_time = 200; // ms, e.g. 192385us // constructor - GxEPD2_213_B72(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_B72(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213_B73.cpp b/src/epd/GxEPD2_213_B73.cpp index bc82a48..a4518ef 100644 --- a/src/epd/GxEPD2_213_B73.cpp +++ b/src/epd/GxEPD2_213_B73.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_213_B73.h" -GxEPD2_213_B73::GxEPD2_213_B73(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_B73::GxEPD2_213_B73(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -247,14 +247,18 @@ void GxEPD2_213_B73::refresh(bool partial_update_mode) void GxEPD2_213_B73::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_213_B73.h b/src/epd/GxEPD2_213_B73.h index 8655d53..f101b95 100644 --- a/src/epd/GxEPD2_213_B73.h +++ b/src/epd/GxEPD2_213_B73.h @@ -31,7 +31,7 @@ class GxEPD2_213_B73 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4000; // ms, e.g. 3820212us static const uint16_t partial_refresh_time = 200; // ms, e.g. 199006us // constructor - GxEPD2_213_B73(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_B73(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213_B74.cpp b/src/epd/GxEPD2_213_B74.cpp index 32e6c15..3105f42 100644 --- a/src/epd/GxEPD2_213_B74.cpp +++ b/src/epd/GxEPD2_213_B74.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_213_B74.h" -GxEPD2_213_B74::GxEPD2_213_B74(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_B74::GxEPD2_213_B74(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -253,14 +253,18 @@ void GxEPD2_213_B74::refresh(bool partial_update_mode) void GxEPD2_213_B74::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_213_B74.h b/src/epd/GxEPD2_213_B74.h index 42c7c65..d911e20 100644 --- a/src/epd/GxEPD2_213_B74.h +++ b/src/epd/GxEPD2_213_B74.h @@ -31,7 +31,7 @@ class GxEPD2_213_B74 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3600; // ms, e.g. 3501806us static const uint16_t partial_refresh_time = 500; // ms, e.g. 455406us // constructor - GxEPD2_213_B74(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_B74(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213_M21.cpp b/src/epd/GxEPD2_213_M21.cpp index 82f71c2..db51a7e 100644 --- a/src/epd/GxEPD2_213_M21.cpp +++ b/src/epd/GxEPD2_213_M21.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_213_M21.h" -GxEPD2_213_M21::GxEPD2_213_M21(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_M21::GxEPD2_213_M21(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -221,14 +221,18 @@ void GxEPD2_213_M21::refresh(bool partial_update_mode) void GxEPD2_213_M21::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_213_M21.h b/src/epd/GxEPD2_213_M21.h index cad9a08..355cb11 100644 --- a/src/epd/GxEPD2_213_M21.h +++ b/src/epd/GxEPD2_213_M21.h @@ -31,7 +31,7 @@ class GxEPD2_213_M21 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3500; // ms, e.g. 3286491us static const uint16_t partial_refresh_time = 600; // ms, e.g. 536658us // constructor - GxEPD2_213_M21(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_M21(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213_T5D.cpp b/src/epd/GxEPD2_213_T5D.cpp index 4dec9be..f99c9ee 100644 --- a/src/epd/GxEPD2_213_T5D.cpp +++ b/src/epd/GxEPD2_213_T5D.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_213_T5D.h" -GxEPD2_213_T5D::GxEPD2_213_T5D(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_T5D::GxEPD2_213_T5D(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -255,14 +255,18 @@ void GxEPD2_213_T5D::refresh(bool partial_update_mode) void GxEPD2_213_T5D::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_213_T5D.h b/src/epd/GxEPD2_213_T5D.h index 12ff49c..949defe 100644 --- a/src/epd/GxEPD2_213_T5D.h +++ b/src/epd/GxEPD2_213_T5D.h @@ -30,7 +30,7 @@ class GxEPD2_213_T5D : public GxEPD2_EPD static const uint16_t full_refresh_time = 4700; // ms, e.g. 4615853us static const uint16_t partial_refresh_time = 750; // ms, e.g. 699013us // constructor - GxEPD2_213_T5D(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_T5D(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_213_flex.cpp b/src/epd/GxEPD2_213_flex.cpp index 9c3ed22..3124e8e 100644 --- a/src/epd/GxEPD2_213_flex.cpp +++ b/src/epd/GxEPD2_213_flex.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_213_flex.h" -GxEPD2_213_flex::GxEPD2_213_flex(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_flex::GxEPD2_213_flex(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -220,14 +220,18 @@ void GxEPD2_213_flex::refresh(bool partial_update_mode) void GxEPD2_213_flex::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_213_flex.h b/src/epd/GxEPD2_213_flex.h index 73c07f4..2fed077 100644 --- a/src/epd/GxEPD2_213_flex.h +++ b/src/epd/GxEPD2_213_flex.h @@ -30,7 +30,7 @@ class GxEPD2_213_flex : public GxEPD2_EPD static const uint16_t full_refresh_time = 2100; // ms, e.g. 2056899us static const uint16_t partial_refresh_time = 300; // ms, e.g. 283622us // constructor - GxEPD2_213_flex(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_flex(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_260.cpp b/src/epd/GxEPD2_260.cpp index cacebfc..4b2e399 100644 --- a/src/epd/GxEPD2_260.cpp +++ b/src/epd/GxEPD2_260.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_260.h" -GxEPD2_260::GxEPD2_260(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_260::GxEPD2_260(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -221,14 +221,18 @@ void GxEPD2_260::refresh(bool partial_update_mode) void GxEPD2_260::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_260.h b/src/epd/GxEPD2_260.h index 96b5a5a..2ee86a1 100644 --- a/src/epd/GxEPD2_260.h +++ b/src/epd/GxEPD2_260.h @@ -32,7 +32,7 @@ class GxEPD2_260 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1600; // ms, e.g. 1543246us static const uint16_t partial_refresh_time = 1300; // ms, e.g. 1228991us // constructor - GxEPD2_260(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_260(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_260_M01.cpp b/src/epd/GxEPD2_260_M01.cpp index 388d67e..a94f0e2 100644 --- a/src/epd/GxEPD2_260_M01.cpp +++ b/src/epd/GxEPD2_260_M01.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_260_M01.h" -GxEPD2_260_M01::GxEPD2_260_M01(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_260_M01::GxEPD2_260_M01(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -221,14 +221,18 @@ void GxEPD2_260_M01::refresh(bool partial_update_mode) void GxEPD2_260_M01::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_260_M01.h b/src/epd/GxEPD2_260_M01.h index 883a240..68860c0 100644 --- a/src/epd/GxEPD2_260_M01.h +++ b/src/epd/GxEPD2_260_M01.h @@ -31,7 +31,7 @@ class GxEPD2_260_M01 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3400; // ms, e.g. 3308455us static const uint16_t partial_refresh_time = 1000; // ms, e.g. 938384us // constructor - GxEPD2_260_M01(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_260_M01(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_270.cpp b/src/epd/GxEPD2_270.cpp index bb41e3c..510df88 100644 --- a/src/epd/GxEPD2_270.cpp +++ b/src/epd/GxEPD2_270.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_270.h" -GxEPD2_270::GxEPD2_270(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_270::GxEPD2_270(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -242,14 +242,18 @@ void GxEPD2_270::refresh(bool partial_update_mode) void GxEPD2_270::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _refreshWindow(x1, y1, w1, h1); _waitWhileBusy("refresh", partial_refresh_time); } diff --git a/src/epd/GxEPD2_270.h b/src/epd/GxEPD2_270.h index e7abf69..8bd3a32 100644 --- a/src/epd/GxEPD2_270.h +++ b/src/epd/GxEPD2_270.h @@ -30,7 +30,7 @@ class GxEPD2_270 : public GxEPD2_EPD static const uint16_t full_refresh_time = 2000; // ms, e.g. 1979027us static const uint16_t partial_refresh_time = 400; // ms, e.g. 363637us // constructor - GxEPD2_270(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_270(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290.cpp b/src/epd/GxEPD2_290.cpp index 3cc04bf..89890a6 100644 --- a/src/epd/GxEPD2_290.cpp +++ b/src/epd/GxEPD2_290.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_290.h" -GxEPD2_290::GxEPD2_290(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290::GxEPD2_290(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -245,14 +245,18 @@ void GxEPD2_290::refresh(bool partial_update_mode) void GxEPD2_290::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_290.h b/src/epd/GxEPD2_290.h index c00ac7f..d252b7c 100644 --- a/src/epd/GxEPD2_290.h +++ b/src/epd/GxEPD2_290.h @@ -30,7 +30,7 @@ class GxEPD2_290 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1600; // ms, e.g. 1575016us static const uint16_t partial_refresh_time = 420; // ms, e.g. 412493us // constructor - GxEPD2_290(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290_I6FD.cpp b/src/epd/GxEPD2_290_I6FD.cpp index ee44d4b..991f5b0 100644 --- a/src/epd/GxEPD2_290_I6FD.cpp +++ b/src/epd/GxEPD2_290_I6FD.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_290_I6FD.h" -GxEPD2_290_I6FD::GxEPD2_290_I6FD(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_I6FD::GxEPD2_290_I6FD(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -256,14 +256,18 @@ void GxEPD2_290_I6FD::refresh(bool partial_update_mode) void GxEPD2_290_I6FD::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_290_I6FD.h b/src/epd/GxEPD2_290_I6FD.h index 655c647..d1cc6c6 100644 --- a/src/epd/GxEPD2_290_I6FD.h +++ b/src/epd/GxEPD2_290_I6FD.h @@ -31,7 +31,7 @@ class GxEPD2_290_I6FD : public GxEPD2_EPD static const uint16_t full_refresh_time = 3600; // ms, e.g. 3547960us static const uint16_t partial_refresh_time = 400; // ms, e.g. 380865us // constructor - GxEPD2_290_I6FD(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_I6FD(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290_M06.cpp b/src/epd/GxEPD2_290_M06.cpp index 6ec0b12..02b4e3c 100644 --- a/src/epd/GxEPD2_290_M06.cpp +++ b/src/epd/GxEPD2_290_M06.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_290_M06.h" -GxEPD2_290_M06::GxEPD2_290_M06(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_M06::GxEPD2_290_M06(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -221,14 +221,18 @@ void GxEPD2_290_M06::refresh(bool partial_update_mode) void GxEPD2_290_M06::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_290_M06.h b/src/epd/GxEPD2_290_M06.h index 952832e..16a5e4b 100644 --- a/src/epd/GxEPD2_290_M06.h +++ b/src/epd/GxEPD2_290_M06.h @@ -31,7 +31,7 @@ class GxEPD2_290_M06 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3600; // ms, e.g. 3527448us static const uint16_t partial_refresh_time = 600; // ms, e.g. 537169us // constructor - GxEPD2_290_M06(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_M06(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290_T5.cpp b/src/epd/GxEPD2_290_T5.cpp index 7ac786d..73a1255 100644 --- a/src/epd/GxEPD2_290_T5.cpp +++ b/src/epd/GxEPD2_290_T5.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_290_T5.h" -GxEPD2_290_T5::GxEPD2_290_T5(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_T5::GxEPD2_290_T5(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -220,14 +220,18 @@ void GxEPD2_290_T5::refresh(bool partial_update_mode) void GxEPD2_290_T5::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_290_T5.h b/src/epd/GxEPD2_290_T5.h index 963232c..15c8c38 100644 --- a/src/epd/GxEPD2_290_T5.h +++ b/src/epd/GxEPD2_290_T5.h @@ -30,7 +30,7 @@ class GxEPD2_290_T5 : public GxEPD2_EPD static const uint16_t full_refresh_time = 2100; // ms, e.g. 2056899us static const uint16_t partial_refresh_time = 400; // ms, e.g. 353649us // constructor - GxEPD2_290_T5(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_T5(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290_T5D.cpp b/src/epd/GxEPD2_290_T5D.cpp index ac5256f..2e9cb1e 100644 --- a/src/epd/GxEPD2_290_T5D.cpp +++ b/src/epd/GxEPD2_290_T5D.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_290_T5D.h" -GxEPD2_290_T5D::GxEPD2_290_T5D(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_T5D::GxEPD2_290_T5D(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -255,14 +255,18 @@ void GxEPD2_290_T5D::refresh(bool partial_update_mode) void GxEPD2_290_T5D::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_290_T5D.h b/src/epd/GxEPD2_290_T5D.h index 7c43b69..f27c7f5 100644 --- a/src/epd/GxEPD2_290_T5D.h +++ b/src/epd/GxEPD2_290_T5D.h @@ -30,7 +30,7 @@ class GxEPD2_290_T5D : public GxEPD2_EPD static const uint16_t full_refresh_time = 3500; // ms, e.g. 3251067us static const uint16_t partial_refresh_time = 750; // ms, e.g. 704907us // constructor - GxEPD2_290_T5D(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_T5D(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290_T94.cpp b/src/epd/GxEPD2_290_T94.cpp index 25d7711..263956b 100644 --- a/src/epd/GxEPD2_290_T94.cpp +++ b/src/epd/GxEPD2_290_T94.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_290_T94.h" -GxEPD2_290_T94::GxEPD2_290_T94(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_T94::GxEPD2_290_T94(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -253,14 +253,18 @@ void GxEPD2_290_T94::refresh(bool partial_update_mode) void GxEPD2_290_T94::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_290_T94.h b/src/epd/GxEPD2_290_T94.h index f7d70c5..df19158 100644 --- a/src/epd/GxEPD2_290_T94.h +++ b/src/epd/GxEPD2_290_T94.h @@ -31,7 +31,7 @@ class GxEPD2_290_T94 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3200; // ms, e.g. 3154996us static const uint16_t partial_refresh_time = 500; // ms, e.g. 458231us // constructor - GxEPD2_290_T94(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_T94(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_290_T94_V2.cpp b/src/epd/GxEPD2_290_T94_V2.cpp index af059b7..0242131 100644 --- a/src/epd/GxEPD2_290_T94_V2.cpp +++ b/src/epd/GxEPD2_290_T94_V2.cpp @@ -16,7 +16,7 @@ #include "GxEPD2_290_T94_V2.h" -GxEPD2_290_T94_V2::GxEPD2_290_T94_V2(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_T94_V2::GxEPD2_290_T94_V2(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -259,14 +259,18 @@ void GxEPD2_290_T94_V2::refresh(bool partial_update_mode) void GxEPD2_290_T94_V2::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd/GxEPD2_290_T94_V2.h b/src/epd/GxEPD2_290_T94_V2.h index a1aae4e..a72b237 100644 --- a/src/epd/GxEPD2_290_T94_V2.h +++ b/src/epd/GxEPD2_290_T94_V2.h @@ -34,7 +34,7 @@ class GxEPD2_290_T94_V2 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4100; // ms, e.g. 4011934us static const uint16_t partial_refresh_time = 750; // ms, e.g. 736721us // constructor - GxEPD2_290_T94_V2(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_T94_V2(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_371.cpp b/src/epd/GxEPD2_371.cpp index 9b5c95b..af6effc 100644 --- a/src/epd/GxEPD2_371.cpp +++ b/src/epd/GxEPD2_371.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_371.h" -GxEPD2_371::GxEPD2_371(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_371::GxEPD2_371(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -229,14 +229,18 @@ void GxEPD2_371::refresh(bool partial_update_mode) void GxEPD2_371::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_371.h b/src/epd/GxEPD2_371.h index 2499df9..972385a 100644 --- a/src/epd/GxEPD2_371.h +++ b/src/epd/GxEPD2_371.h @@ -32,7 +32,7 @@ class GxEPD2_371 : public GxEPD2_EPD static const uint16_t full_refresh_time = 3000; // ms, e.g. 2953630us static const uint16_t partial_refresh_time = 1500; // ms, e.g. 1482735us // constructor - GxEPD2_371(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_371(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_420.cpp b/src/epd/GxEPD2_420.cpp index 5560c72..550e874 100644 --- a/src/epd/GxEPD2_420.cpp +++ b/src/epd/GxEPD2_420.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_420.h" -GxEPD2_420::GxEPD2_420(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_420::GxEPD2_420(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -230,14 +230,18 @@ void GxEPD2_420::refresh(bool partial_update_mode) void GxEPD2_420::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_420.h b/src/epd/GxEPD2_420.h index 874ab6b..cdcb7ab 100644 --- a/src/epd/GxEPD2_420.h +++ b/src/epd/GxEPD2_420.h @@ -31,7 +31,7 @@ class GxEPD2_420 : public GxEPD2_EPD static const uint16_t full_refresh_time = 1600; // ms, e.g. 1545659us static const uint16_t partial_refresh_time = 600; // ms, e.g. 563754us // constructor - GxEPD2_420(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_420(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_420_M01.cpp b/src/epd/GxEPD2_420_M01.cpp index 6484ad0..1016414 100644 --- a/src/epd/GxEPD2_420_M01.cpp +++ b/src/epd/GxEPD2_420_M01.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_420_M01.h" -GxEPD2_420_M01::GxEPD2_420_M01(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_420_M01::GxEPD2_420_M01(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -231,14 +231,18 @@ void GxEPD2_420_M01::refresh(bool partial_update_mode) void GxEPD2_420_M01::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_420_M01.h b/src/epd/GxEPD2_420_M01.h index 42b623e..ec774fb 100644 --- a/src/epd/GxEPD2_420_M01.h +++ b/src/epd/GxEPD2_420_M01.h @@ -32,7 +32,7 @@ class GxEPD2_420_M01 : public GxEPD2_EPD static const uint16_t full_refresh_time = 5000; // ms, e.g. 4653207us static const uint16_t partial_refresh_time = hasPartialUpdate ? 1200 : full_refresh_time; // ms, e.g. 1128540us // constructor - GxEPD2_420_M01(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_420_M01(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_583.cpp b/src/epd/GxEPD2_583.cpp index 25bea42..f76f6b8 100644 --- a/src/epd/GxEPD2_583.cpp +++ b/src/epd/GxEPD2_583.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_583.h" -GxEPD2_583::GxEPD2_583(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_583::GxEPD2_583(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -255,14 +255,18 @@ void GxEPD2_583::refresh(bool partial_update_mode) void GxEPD2_583::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_583.h b/src/epd/GxEPD2_583.h index 164229f..35ca21f 100644 --- a/src/epd/GxEPD2_583.h +++ b/src/epd/GxEPD2_583.h @@ -30,7 +30,7 @@ class GxEPD2_583 : public GxEPD2_EPD static const uint16_t full_refresh_time = 15000; // ms, e.g. 14598868us static const uint16_t partial_refresh_time = 15000; // ms, e.g. 14598868us // constructor - GxEPD2_583(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_583(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_583_T8.cpp b/src/epd/GxEPD2_583_T8.cpp index af8f6ca..681e8e3 100644 --- a/src/epd/GxEPD2_583_T8.cpp +++ b/src/epd/GxEPD2_583_T8.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_583_T8.h" -GxEPD2_583_T8::GxEPD2_583_T8(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_583_T8::GxEPD2_583_T8(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -229,14 +229,18 @@ void GxEPD2_583_T8::refresh(bool partial_update_mode) void GxEPD2_583_T8::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_583_T8.h b/src/epd/GxEPD2_583_T8.h index dd41a4b..6dc2b36 100644 --- a/src/epd/GxEPD2_583_T8.h +++ b/src/epd/GxEPD2_583_T8.h @@ -32,7 +32,7 @@ class GxEPD2_583_T8 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4200; // ms, e.g. 4108238us static const uint16_t partial_refresh_time = 1600; // ms, e.g. 1584124us // constructor - GxEPD2_583_T8(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_583_T8(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_750.cpp b/src/epd/GxEPD2_750.cpp index 184801c..50e6fbd 100644 --- a/src/epd/GxEPD2_750.cpp +++ b/src/epd/GxEPD2_750.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_750.h" -GxEPD2_750::GxEPD2_750(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_750::GxEPD2_750(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -255,14 +255,18 @@ void GxEPD2_750::refresh(bool partial_update_mode) void GxEPD2_750::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_750.h b/src/epd/GxEPD2_750.h index 7fb2f5e..92620f3 100644 --- a/src/epd/GxEPD2_750.h +++ b/src/epd/GxEPD2_750.h @@ -30,7 +30,7 @@ class GxEPD2_750 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4500; // ms, e.g. 4273474us static const uint16_t partial_refresh_time = 4500; // ms, e.g. 4273474us // constructor - GxEPD2_750(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_750(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white) diff --git a/src/epd/GxEPD2_750_T7.cpp b/src/epd/GxEPD2_750_T7.cpp index 2d31b40..f474f85 100644 --- a/src/epd/GxEPD2_750_T7.cpp +++ b/src/epd/GxEPD2_750_T7.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_750_T7.h" -GxEPD2_750_T7::GxEPD2_750_T7(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_750_T7::GxEPD2_750_T7(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -229,14 +229,18 @@ void GxEPD2_750_T7::refresh(bool partial_update_mode) void GxEPD2_750_T7::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { if (_initial_refresh) return refresh(false); // initial update needs be full update - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; if (!_using_partial_mode) _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd/GxEPD2_750_T7.h b/src/epd/GxEPD2_750_T7.h index e973e95..ceff3e5 100644 --- a/src/epd/GxEPD2_750_T7.h +++ b/src/epd/GxEPD2_750_T7.h @@ -32,7 +32,7 @@ class GxEPD2_750_T7 : public GxEPD2_EPD static const uint16_t full_refresh_time = 4200; // ms, e.g. 4108238us static const uint16_t partial_refresh_time = 1600; // ms, e.g. 1584124us // constructor - GxEPD2_750_T7(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_750_T7(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_154_Z90c.cpp b/src/epd3c/GxEPD2_154_Z90c.cpp index f71229b..68ddcc9 100644 --- a/src/epd3c/GxEPD2_154_Z90c.cpp +++ b/src/epd3c/GxEPD2_154_Z90c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_154_Z90c.h" -GxEPD2_154_Z90c::GxEPD2_154_Z90c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154_Z90c::GxEPD2_154_Z90c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -275,14 +275,18 @@ void GxEPD2_154_Z90c::refresh(bool partial_update_mode) void GxEPD2_154_Z90c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd3c/GxEPD2_154_Z90c.h b/src/epd3c/GxEPD2_154_Z90c.h index 57afa3b..5fdb63c 100644 --- a/src/epd3c/GxEPD2_154_Z90c.h +++ b/src/epd3c/GxEPD2_154_Z90c.h @@ -30,7 +30,7 @@ class GxEPD2_154_Z90c : public GxEPD2_EPD static const uint16_t full_refresh_time = 14000; // ms, e.g. 13608449us static const uint16_t partial_refresh_time = 14000; // ms, e.g. 13608449us // constructor - GxEPD2_154_Z90c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154_Z90c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_154c.cpp b/src/epd3c/GxEPD2_154c.cpp index f7af1d3..beebb84 100644 --- a/src/epd3c/GxEPD2_154c.cpp +++ b/src/epd3c/GxEPD2_154c.cpp @@ -20,7 +20,7 @@ const uint8_t GxEPD2_154c::bw2grey[] = 0b11110000, 0b11110011, 0b11111100, 0b11111111, }; -GxEPD2_154c::GxEPD2_154c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_154c::GxEPD2_154c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { _paged = false; diff --git a/src/epd3c/GxEPD2_154c.h b/src/epd3c/GxEPD2_154c.h index 5b2cc82..1aea22f 100644 --- a/src/epd3c/GxEPD2_154c.h +++ b/src/epd3c/GxEPD2_154c.h @@ -30,7 +30,7 @@ class GxEPD2_154c : public GxEPD2_EPD static const uint16_t full_refresh_time = 7500; // ms, e.g. 7135635us static const uint16_t partial_refresh_time = 7500; // ms, e.g. 7135635us // constructor - GxEPD2_154c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_154c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); diff --git a/src/epd3c/GxEPD2_213_Z19c.cpp b/src/epd3c/GxEPD2_213_Z19c.cpp index ed98672..583d83c 100644 --- a/src/epd3c/GxEPD2_213_Z19c.cpp +++ b/src/epd3c/GxEPD2_213_Z19c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_213_Z19c.h" -GxEPD2_213_Z19c::GxEPD2_213_Z19c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213_Z19c::GxEPD2_213_Z19c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -264,14 +264,18 @@ void GxEPD2_213_Z19c::refresh(bool partial_update_mode) void GxEPD2_213_Z19c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= w % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_213_Z19c.h b/src/epd3c/GxEPD2_213_Z19c.h index ffbf4ed..e654198 100644 --- a/src/epd3c/GxEPD2_213_Z19c.h +++ b/src/epd3c/GxEPD2_213_Z19c.h @@ -31,7 +31,7 @@ class GxEPD2_213_Z19c : public GxEPD2_EPD static const uint16_t full_refresh_time = 17000; // ms, e.g. 16788187us static const uint16_t partial_refresh_time = 17000; // ms, e.g. 16788187us // constructor - GxEPD2_213_Z19c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213_Z19c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_213c.cpp b/src/epd3c/GxEPD2_213c.cpp index 299ae0f..6e958b2 100644 --- a/src/epd3c/GxEPD2_213c.cpp +++ b/src/epd3c/GxEPD2_213c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_213c.h" -GxEPD2_213c::GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_213c::GxEPD2_213c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -283,14 +283,18 @@ void GxEPD2_213c::refresh(bool partial_update_mode) void GxEPD2_213c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_213c.h b/src/epd3c/GxEPD2_213c.h index 6fc004f..d56d014 100644 --- a/src/epd3c/GxEPD2_213c.h +++ b/src/epd3c/GxEPD2_213c.h @@ -31,7 +31,7 @@ class GxEPD2_213c : public GxEPD2_EPD static const uint16_t full_refresh_time = 15000; // ms, e.g. 14896608us static const uint16_t partial_refresh_time = 15000; // ms, e.g. 14896608us // constructor - GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_213c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_270c.cpp b/src/epd3c/GxEPD2_270c.cpp index 4736a32..f5b6491 100644 --- a/src/epd3c/GxEPD2_270c.cpp +++ b/src/epd3c/GxEPD2_270c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_270c.h" -GxEPD2_270c::GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_270c::GxEPD2_270c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -271,14 +271,18 @@ void GxEPD2_270c::refresh(bool partial_update_mode) void GxEPD2_270c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; //_refreshWindow(x1, y1, w1, h1); w1 = (w1 + 7 + (x1 % 8)) & 0xfff8; // byte boundary exclusive (round up) h1 = gx_uint16_min(h1, 256); // strange controller error diff --git a/src/epd3c/GxEPD2_270c.h b/src/epd3c/GxEPD2_270c.h index 102e321..3d3f3ea 100644 --- a/src/epd3c/GxEPD2_270c.h +++ b/src/epd3c/GxEPD2_270c.h @@ -30,7 +30,7 @@ class GxEPD2_270c : public GxEPD2_EPD static const uint16_t full_refresh_time = 16000; // ms, e.g. 15524093us static const uint16_t partial_refresh_time = 16000; // ms, e.g. 15524093us // constructor - GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_270c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_290_C90c.cpp b/src/epd3c/GxEPD2_290_C90c.cpp index 14e73e9..38c7c35 100644 --- a/src/epd3c/GxEPD2_290_C90c.cpp +++ b/src/epd3c/GxEPD2_290_C90c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_290_C90c.h" -GxEPD2_290_C90c::GxEPD2_290_C90c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_C90c::GxEPD2_290_C90c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 30000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -275,14 +275,18 @@ void GxEPD2_290_C90c::refresh(bool partial_update_mode) void GxEPD2_290_C90c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd3c/GxEPD2_290_C90c.h b/src/epd3c/GxEPD2_290_C90c.h index a1dc33c..6218788 100644 --- a/src/epd3c/GxEPD2_290_C90c.h +++ b/src/epd3c/GxEPD2_290_C90c.h @@ -30,7 +30,7 @@ class GxEPD2_290_C90c : public GxEPD2_EPD static const uint16_t full_refresh_time = 27000; // ms, e.g. 26130024us static const uint16_t partial_refresh_time = 27000; // ms, e.g. 26130024us // constructor - GxEPD2_290_C90c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_C90c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_290_Z13c.cpp b/src/epd3c/GxEPD2_290_Z13c.cpp index 304fab4..e9d837f 100644 --- a/src/epd3c/GxEPD2_290_Z13c.cpp +++ b/src/epd3c/GxEPD2_290_Z13c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_290_Z13c.h" -GxEPD2_290_Z13c::GxEPD2_290_Z13c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290_Z13c::GxEPD2_290_Z13c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -264,14 +264,18 @@ void GxEPD2_290_Z13c::refresh(bool partial_update_mode) void GxEPD2_290_Z13c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= w % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_290_Z13c.h b/src/epd3c/GxEPD2_290_Z13c.h index ad213b8..a7572e6 100644 --- a/src/epd3c/GxEPD2_290_Z13c.h +++ b/src/epd3c/GxEPD2_290_Z13c.h @@ -31,7 +31,7 @@ class GxEPD2_290_Z13c : public GxEPD2_EPD static const uint16_t full_refresh_time = 18000; // ms, e.g. 17812004us static const uint16_t partial_refresh_time = 18000; // ms, e.g. 17812004us // constructor - GxEPD2_290_Z13c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290_Z13c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_290c.cpp b/src/epd3c/GxEPD2_290c.cpp index ed0cb49..4987b6d 100644 --- a/src/epd3c/GxEPD2_290c.cpp +++ b/src/epd3c/GxEPD2_290c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_290c.h" -GxEPD2_290c::GxEPD2_290c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_290c::GxEPD2_290c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -283,14 +283,18 @@ void GxEPD2_290c::refresh(bool partial_update_mode) void GxEPD2_290c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_290c.h b/src/epd3c/GxEPD2_290c.h index 26a3e99..659a938 100644 --- a/src/epd3c/GxEPD2_290c.h +++ b/src/epd3c/GxEPD2_290c.h @@ -31,7 +31,7 @@ class GxEPD2_290c : public GxEPD2_EPD static const uint16_t full_refresh_time = 15000; // ms, e.g. 14845408us static const uint16_t partial_refresh_time = 15000; // ms, e.g. 14845408us // constructor - GxEPD2_290c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_290c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_420c.cpp b/src/epd3c/GxEPD2_420c.cpp index 306950d..e348c40 100644 --- a/src/epd3c/GxEPD2_420c.cpp +++ b/src/epd3c/GxEPD2_420c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_420c.h" -GxEPD2_420c::GxEPD2_420c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_420c::GxEPD2_420c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -299,14 +299,18 @@ void GxEPD2_420c::refresh(bool partial_update_mode) void GxEPD2_420c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_420c.h b/src/epd3c/GxEPD2_420c.h index 82eec5e..7935fd5 100644 --- a/src/epd3c/GxEPD2_420c.h +++ b/src/epd3c/GxEPD2_420c.h @@ -31,7 +31,7 @@ class GxEPD2_420c : public GxEPD2_EPD static const uint16_t full_refresh_time = 16000; // ms, e.g. 15771891us static const uint16_t partial_refresh_time = 16000; // ms, e.g. 15771891us // constructor - GxEPD2_420c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_420c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_420c_Z21.cpp b/src/epd3c/GxEPD2_420c_Z21.cpp index 322c6fa..899d858 100644 --- a/src/epd3c/GxEPD2_420c_Z21.cpp +++ b/src/epd3c/GxEPD2_420c_Z21.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_420c_Z21.h" -GxEPD2_420c_Z21::GxEPD2_420c_Z21(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_420c_Z21::GxEPD2_420c_Z21(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -300,14 +300,18 @@ void GxEPD2_420c_Z21::refresh(bool partial_update_mode) void GxEPD2_420c_Z21::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdateWindow) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_420c_Z21.h b/src/epd3c/GxEPD2_420c_Z21.h index a85b600..22806d6 100644 --- a/src/epd3c/GxEPD2_420c_Z21.h +++ b/src/epd3c/GxEPD2_420c_Z21.h @@ -32,7 +32,7 @@ class GxEPD2_420c_Z21 : public GxEPD2_EPD static const uint16_t full_refresh_time = 16000; // ms, e.g. 15171828us static const uint16_t partial_refresh_time = 16000; // ms, e.g. 15171828us // constructor - GxEPD2_420c_Z21(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_420c_Z21(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_565c.cpp b/src/epd3c/GxEPD2_565c.cpp index 1a62693..1c69d4a 100644 --- a/src/epd3c/GxEPD2_565c.cpp +++ b/src/epd3c/GxEPD2_565c.cpp @@ -14,7 +14,7 @@ #include "GxEPD2_565c.h" -GxEPD2_565c::GxEPD2_565c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_565c::GxEPD2_565c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 25000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { _paged = false; diff --git a/src/epd3c/GxEPD2_565c.h b/src/epd3c/GxEPD2_565c.h index 7e8b9ae..097e164 100644 --- a/src/epd3c/GxEPD2_565c.h +++ b/src/epd3c/GxEPD2_565c.h @@ -31,7 +31,7 @@ class GxEPD2_565c : public GxEPD2_EPD static const uint16_t full_refresh_time = 12000; // ms, e.g. 11354001us static const uint16_t partial_refresh_time = 12000; // ms, e.g. 11354001us // constructor - GxEPD2_565c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_565c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_583c.cpp b/src/epd3c/GxEPD2_583c.cpp index 6697c93..566e6bd 100644 --- a/src/epd3c/GxEPD2_583c.cpp +++ b/src/epd3c/GxEPD2_583c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_583c.h" -GxEPD2_583c::GxEPD2_583c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_583c::GxEPD2_583c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -341,14 +341,18 @@ void GxEPD2_583c::refresh(bool partial_update_mode) void GxEPD2_583c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd3c/GxEPD2_583c.h b/src/epd3c/GxEPD2_583c.h index 6dd89ae..041420c 100644 --- a/src/epd3c/GxEPD2_583c.h +++ b/src/epd3c/GxEPD2_583c.h @@ -30,7 +30,7 @@ class GxEPD2_583c : public GxEPD2_EPD static const uint16_t full_refresh_time = 32000; // ms, e.g. 29165492us static const uint16_t partial_refresh_time = 32000; // ms, e.g. 29165492us // constructor - GxEPD2_583c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_583c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_750c.cpp b/src/epd3c/GxEPD2_750c.cpp index fcd6188..4bf055f 100644 --- a/src/epd3c/GxEPD2_750c.cpp +++ b/src/epd3c/GxEPD2_750c.cpp @@ -12,7 +12,7 @@ #include "GxEPD2_750c.h" -GxEPD2_750c::GxEPD2_750c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_750c::GxEPD2_750c(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -338,14 +338,18 @@ void GxEPD2_750c::refresh(bool partial_update_mode) void GxEPD2_750c::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); _setPartialRamArea(x1, y1, w1, h1); _Update_Part(); diff --git a/src/epd3c/GxEPD2_750c.h b/src/epd3c/GxEPD2_750c.h index a4fe53c..6c7a742 100644 --- a/src/epd3c/GxEPD2_750c.h +++ b/src/epd3c/GxEPD2_750c.h @@ -30,7 +30,7 @@ class GxEPD2_750c : public GxEPD2_EPD static const uint16_t full_refresh_time = 32000; // ms, e.g. 31094507us static const uint16_t partial_refresh_time = 32000; // ms, e.g. 31094507us // constructor - GxEPD2_750c(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_750c(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0x33); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_750c_Z08.cpp b/src/epd3c/GxEPD2_750c_Z08.cpp index 635c4b7..b33a3f7 100644 --- a/src/epd3c/GxEPD2_750c_Z08.cpp +++ b/src/epd3c/GxEPD2_750c_Z08.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_750c_Z08.h" -GxEPD2_750c_Z08::GxEPD2_750c_Z08(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_750c_Z08::GxEPD2_750c_Z08(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } @@ -300,14 +300,18 @@ void GxEPD2_750c_Z08::refresh(bool partial_update_mode) void GxEPD2_750c_Z08::refresh(int16_t x, int16_t y, int16_t w, int16_t h) { - x -= x % 8; // byte boundary - w -= x % 8; // byte boundary + // intersection with screen + int16_t w1 = x < 0 ? w + x : w; // reduce + int16_t h1 = y < 0 ? h + y : h; // reduce int16_t x1 = x < 0 ? 0 : x; // limit int16_t y1 = y < 0 ? 0 : y; // limit - int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit - int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit - w1 -= x1 - x; - h1 -= y1 - y; + w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit + h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit + if ((w1 <= 0) || (h1 <= 0)) return; + // make x1, w1 multiple of 8 + w1 += x1 % 8; + if (w1 % 8 > 0) w1 += 8 - w1 % 8; + x1 -= x1 % 8; _Init_Part(); if (usePartialUpdate) _writeCommand(0x91); // partial in _setPartialRamArea(x1, y1, w1, h1); diff --git a/src/epd3c/GxEPD2_750c_Z08.h b/src/epd3c/GxEPD2_750c_Z08.h index 823d5ef..0d200f8 100644 --- a/src/epd3c/GxEPD2_750c_Z08.h +++ b/src/epd3c/GxEPD2_750c_Z08.h @@ -32,7 +32,7 @@ class GxEPD2_750c_Z08 : public GxEPD2_EPD static const uint16_t full_refresh_time = 18000; // ms, e.g. 17133490us static const uint16_t partial_refresh_time = 18000; // ms, e.g. 17133490us // constructor - GxEPD2_750c_Z08(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_750c_Z08(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/epd3c/GxEPD2_750c_Z90.cpp b/src/epd3c/GxEPD2_750c_Z90.cpp index db539c3..3e46899 100644 --- a/src/epd3c/GxEPD2_750c_Z90.cpp +++ b/src/epd3c/GxEPD2_750c_Z90.cpp @@ -13,7 +13,7 @@ #include "GxEPD2_750c_Z90.h" -GxEPD2_750c_Z90::GxEPD2_750c_Z90(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_750c_Z90::GxEPD2_750c_Z90(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 25000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate) { } diff --git a/src/epd3c/GxEPD2_750c_Z90.h b/src/epd3c/GxEPD2_750c_Z90.h index 0dbeef3..f01906e 100644 --- a/src/epd3c/GxEPD2_750c_Z90.h +++ b/src/epd3c/GxEPD2_750c_Z90.h @@ -33,7 +33,7 @@ class GxEPD2_750c_Z90 : public GxEPD2_EPD static const uint16_t partial_refresh_time = 25000; // ms, e.g. 22780001us static const uint8_t entry_mode = 0x03; // 0x03:normal, 0x00:rotated 180, 0x01,0x02:flipped // constructor - GxEPD2_750c_Z90(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_750c_Z90(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) // Support for Bitmaps (Sprites) to Controller Buffer and to Screen void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) diff --git a/src/it8951/GxEPD2_it60.cpp b/src/it8951/GxEPD2_it60.cpp index 2e47fcb..658daab 100644 --- a/src/it8951/GxEPD2_it60.cpp +++ b/src/it8951/GxEPD2_it60.cpp @@ -55,7 +55,7 @@ #define MCSR_BASE_ADDR 0x0200 #define LISAR (MCSR_BASE_ADDR + 0x0008) -GxEPD2_it60::GxEPD2_it60(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_it60::GxEPD2_it60(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate), _spi_settings(24000000, MSBFIRST, SPI_MODE0), _spi_settings_for_read(1000000, MSBFIRST, SPI_MODE0) diff --git a/src/it8951/GxEPD2_it60.h b/src/it8951/GxEPD2_it60.h index b2d87bf..c9e45e6 100644 --- a/src/it8951/GxEPD2_it60.h +++ b/src/it8951/GxEPD2_it60.h @@ -40,7 +40,7 @@ class GxEPD2_it60 : public GxEPD2_EPD static const uint16_t diag_min_time = 3; // ms, e.g. > refresh_par_time static const uint16_t set_vcom_time = 40; // ms, e.g. 37833us // constructor - GxEPD2_it60(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_it60(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); diff --git a/src/it8951/GxEPD2_it60_1448x1072.cpp b/src/it8951/GxEPD2_it60_1448x1072.cpp index a35ca76..094d14a 100644 --- a/src/it8951/GxEPD2_it60_1448x1072.cpp +++ b/src/it8951/GxEPD2_it60_1448x1072.cpp @@ -55,7 +55,7 @@ #define MCSR_BASE_ADDR 0x0200 #define LISAR (MCSR_BASE_ADDR + 0x0008) -GxEPD2_it60_1448x1072::GxEPD2_it60_1448x1072(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_it60_1448x1072::GxEPD2_it60_1448x1072(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate), _spi_settings(24000000, MSBFIRST, SPI_MODE0), _spi_settings_for_read(1000000, MSBFIRST, SPI_MODE0) diff --git a/src/it8951/GxEPD2_it60_1448x1072.h b/src/it8951/GxEPD2_it60_1448x1072.h index 7df4002..d332ca6 100644 --- a/src/it8951/GxEPD2_it60_1448x1072.h +++ b/src/it8951/GxEPD2_it60_1448x1072.h @@ -40,7 +40,7 @@ class GxEPD2_it60_1448x1072 : public GxEPD2_EPD static const uint16_t diag_min_time = 3; // ms, e.g. > refresh_par_time static const uint16_t set_vcom_time = 500; // ms, e.g. 408377us // constructor - GxEPD2_it60_1448x1072(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_it60_1448x1072(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false); diff --git a/src/it8951/GxEPD2_it78_1872x1404.cpp b/src/it8951/GxEPD2_it78_1872x1404.cpp index e9ee197..ade3251 100644 --- a/src/it8951/GxEPD2_it78_1872x1404.cpp +++ b/src/it8951/GxEPD2_it78_1872x1404.cpp @@ -55,7 +55,7 @@ #define MCSR_BASE_ADDR 0x0200 #define LISAR (MCSR_BASE_ADDR + 0x0008) -GxEPD2_it78_1872x1404::GxEPD2_it78_1872x1404(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : +GxEPD2_it78_1872x1404::GxEPD2_it78_1872x1404(int16_t cs, int16_t dc, int16_t rst, int16_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate), _spi_settings(24000000, MSBFIRST, SPI_MODE0), _spi_settings_for_read(1000000, MSBFIRST, SPI_MODE0) diff --git a/src/it8951/GxEPD2_it78_1872x1404.h b/src/it8951/GxEPD2_it78_1872x1404.h index c04c4b6..20383ed 100644 --- a/src/it8951/GxEPD2_it78_1872x1404.h +++ b/src/it8951/GxEPD2_it78_1872x1404.h @@ -40,7 +40,7 @@ class GxEPD2_it78_1872x1404 : public GxEPD2_EPD static const uint16_t diag_min_time = 3; // ms, e.g. > refresh_par_time static const uint16_t set_vcom_time = 500; // ms, e.g. 454967us // constructor - GxEPD2_it78_1872x1404(int8_t cs, int8_t dc, int8_t rst, int8_t busy); + GxEPD2_it78_1872x1404(int16_t cs, int16_t dc, int16_t rst, int16_t busy); // methods (virtual) void init(uint32_t serial_diag_bitrate = 0); // serial_diag_bitrate = 0 : disabled void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false);