Przeglądaj źródła

Version 1.5.2

- added support for Waveshare 4.37" 4-color e-paper display 512x368
- fixed __has_include test (for packages that don't support __has_include)
- added WIDTH_VISIBLE for correct graphics width for 2.13" b/w 122x250
- added end() method, to release SPI and reset all pins to INPUT
ZinggJM 3 lat temu
rodzic
commit
37d8d8ac7b
3 zmienionych plików z 24 dodań i 24 usunięć
  1. 5 5
      src/GxEPD2_4C.h
  2. 5 5
      src/GxEPD2_7C.h
  3. 14 14
      src/GxEPD2_BW.h

+ 5 - 5
src/GxEPD2_4C.h

@@ -170,7 +170,7 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
     // display buffer content to screen, useful for full screen buffer
     void display(bool partial_update_mode = false)
     {
-      epd2.writeNative(_pixel_buffer, 0, 0, 0, WIDTH, _page_height);
+      epd2.writeNative(_pixel_buffer, 0, 0, 0, GxEPD2_Type::WIDTH, _page_height);
       epd2.refresh(partial_update_mode);
       if (!partial_update_mode) epd2.powerOff();
     }
@@ -188,7 +188,7 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
       w = gx_uint16_min(w, width() - x);
       h = gx_uint16_min(h, height() - y);
       _rotate(x, y, w, h);
-      epd2.writeNativePart(_pixel_buffer, 0, x, y, WIDTH, _page_height, x, y, w, h);
+      epd2.writeNativePart(_pixel_buffer, 0, x, y, GxEPD2_Type::WIDTH, _page_height, x, y, w, h);
       epd2.refresh(x, y, w, h);
     }
 
@@ -197,7 +197,7 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
       _using_partial_mode = false;
       _pw_x = 0;
       _pw_y = 0;
-      _pw_w = WIDTH;
+      _pw_w = GxEPD2_Type::WIDTH;
       _pw_h = HEIGHT;
     }
 
@@ -271,7 +271,7 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
       }
       else // full update
       {
-        epd2.writeNative(_pixel_buffer, 0, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+        epd2.writeNative(_pixel_buffer, 0, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         _current_page++;
         if (_current_page == int16_t(_pages))
         {
@@ -323,7 +323,7 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
           uint16_t page_ys = _current_page * _page_height;
           fillScreen(GxEPD_WHITE);
           drawCallback(pv);
-          epd2.writeNative(_pixel_buffer, 0, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+          epd2.writeNative(_pixel_buffer, 0, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         }
         epd2.refresh(false); // full update
         epd2.powerOff();

+ 5 - 5
src/GxEPD2_7C.h

@@ -169,7 +169,7 @@ class GxEPD2_7C : public GxEPD2_GFX_BASE_CLASS
     // display buffer content to screen, useful for full screen buffer
     void display(bool partial_update_mode = false)
     {
-      epd2.writeNative(_pixel_buffer, 0, 0, 0, WIDTH, _page_height);
+      epd2.writeNative(_pixel_buffer, 0, 0, 0, GxEPD2_Type::WIDTH, _page_height);
       epd2.refresh(partial_update_mode);
       if (!partial_update_mode) epd2.powerOff();
     }
@@ -187,7 +187,7 @@ class GxEPD2_7C : public GxEPD2_GFX_BASE_CLASS
       w = gx_uint16_min(w, width() - x);
       h = gx_uint16_min(h, height() - y);
       _rotate(x, y, w, h);
-      epd2.writeNativePart(_pixel_buffer, 0, x, y, WIDTH, _page_height, x, y, w, h);
+      epd2.writeNativePart(_pixel_buffer, 0, x, y, GxEPD2_Type::WIDTH, _page_height, x, y, w, h);
       epd2.refresh(x, y, w, h);
     }
 
@@ -196,7 +196,7 @@ class GxEPD2_7C : public GxEPD2_GFX_BASE_CLASS
       _using_partial_mode = false;
       _pw_x = 0;
       _pw_y = 0;
-      _pw_w = WIDTH;
+      _pw_w = GxEPD2_Type::WIDTH;
       _pw_h = HEIGHT;
     }
 
@@ -270,7 +270,7 @@ class GxEPD2_7C : public GxEPD2_GFX_BASE_CLASS
       }
       else // full update
       {
-        epd2.writeNative(_pixel_buffer, 0, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+        epd2.writeNative(_pixel_buffer, 0, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         _current_page++;
         if (_current_page == int16_t(_pages))
         {
@@ -322,7 +322,7 @@ class GxEPD2_7C : public GxEPD2_GFX_BASE_CLASS
           uint16_t page_ys = _current_page * _page_height;
           fillScreen(GxEPD_WHITE);
           drawCallback(pv);
-          epd2.writeNative(_pixel_buffer, 0, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+          epd2.writeNative(_pixel_buffer, 0, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         }
         epd2.refresh(false); // full update
         epd2.powerOff();

+ 14 - 14
src/GxEPD2_BW.h

@@ -314,12 +314,12 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
     // display buffer content to screen, useful for full screen buffer
     void display(bool partial_update_mode = false)
     {
-      if (partial_update_mode) epd2.writeImage(_buffer, 0, 0, WIDTH, _page_height);
-      else epd2.writeImageForFullRefresh(_buffer, 0, 0, WIDTH, _page_height);
+      if (partial_update_mode) epd2.writeImage(_buffer, 0, 0, GxEPD2_Type::WIDTH, _page_height);
+      else epd2.writeImageForFullRefresh(_buffer, 0, 0, GxEPD2_Type::WIDTH, _page_height);
       epd2.refresh(partial_update_mode);
       if (epd2.hasFastPartialUpdate)
       {
-        epd2.writeImageAgain(_buffer, 0, 0, WIDTH, _page_height);
+        epd2.writeImageAgain(_buffer, 0, 0, GxEPD2_Type::WIDTH, _page_height);
       }
       if (!partial_update_mode) epd2.powerOff();
     }
@@ -338,11 +338,11 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
       h = gx_uint16_min(h, height() - y);
       _rotate(x, y, w, h);
       uint16_t y_part = _reverse ? HEIGHT - h - y : y;
-      epd2.writeImagePart(_buffer, x, y_part, WIDTH, _page_height, x, y, w, h);
+      epd2.writeImagePart(_buffer, x, y_part, GxEPD2_Type::WIDTH, _page_height, x, y, w, h);
       epd2.refresh(x, y, w, h);
       if (epd2.hasFastPartialUpdate)
       {
-        epd2.writeImagePartAgain(_buffer, x, y_part, WIDTH, _page_height, x, y, w, h);
+        epd2.writeImagePartAgain(_buffer, x, y_part, GxEPD2_Type::WIDTH, _page_height, x, y, w, h);
       }
     }
 
@@ -351,7 +351,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
       _using_partial_mode = false;
       _pw_x = 0;
       _pw_y = 0;
-      _pw_w = WIDTH;
+      _pw_w = GxEPD2_Type::WIDTH;
       _pw_h = HEIGHT;
     }
 
@@ -398,11 +398,11 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
         }
         else // full update
         {
-          epd2.writeImageForFullRefresh(_buffer, 0, 0, WIDTH, HEIGHT);
+          epd2.writeImageForFullRefresh(_buffer, 0, 0, GxEPD2_Type::WIDTH, HEIGHT);
           epd2.refresh(false);
           if (epd2.hasFastPartialUpdate)
           {
-            epd2.writeImageAgain(_buffer, 0, 0, WIDTH, HEIGHT);
+            epd2.writeImageAgain(_buffer, 0, 0, GxEPD2_Type::WIDTH, HEIGHT);
             //epd2.refresh(true); // not needed
           }
           epd2.powerOff();
@@ -452,8 +452,8 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
       }
       else // full update
       {
-        if (!_second_phase) epd2.writeImageForFullRefresh(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
-        else epd2.writeImageAgain(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+        if (!_second_phase) epd2.writeImageForFullRefresh(_buffer, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+        else epd2.writeImageAgain(_buffer, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         _current_page++;
         if (_current_page == int16_t(_pages))
         {
@@ -497,11 +497,11 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
         }
         else // full update
         {
-          epd2.writeImageForFullRefresh(_buffer, 0, 0, WIDTH, HEIGHT);
+          epd2.writeImageForFullRefresh(_buffer, 0, 0, GxEPD2_Type::WIDTH, HEIGHT);
           epd2.refresh(false);
           if (epd2.hasFastPartialUpdate)
           {
-            epd2.writeImageAgain(_buffer, 0, 0, WIDTH, HEIGHT);
+            epd2.writeImageAgain(_buffer, 0, 0, GxEPD2_Type::WIDTH, HEIGHT);
             //epd2.refresh(true); // not needed
             epd2.powerOff();
           }
@@ -539,7 +539,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
           uint16_t page_ys = _current_page * _page_height;
           fillScreen(GxEPD_WHITE);
           drawCallback(pv);
-          epd2.writeImageForFullRefresh(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+          epd2.writeImageForFullRefresh(_buffer, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
         }
         epd2.refresh(false); // full update after first phase
         if (epd2.hasFastPartialUpdate)
@@ -550,7 +550,7 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
             uint16_t page_ys = _current_page * _page_height;
             fillScreen(GxEPD_WHITE);
             drawCallback(pv);
-            epd2.writeImageAgain(_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
+            epd2.writeImageAgain(_buffer, 0, page_ys, GxEPD2_Type::WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
           }
           //epd2.refresh(true); // partial update after second phase // not needed
         }