IMO access would require patching the GxEPD2 library, as fiddling with linker scripts to get the buffer's memory location is a bad approach on PlatformIO.
diff --git i/src/GxEPD2_3C.h w/src/GxEPD2_3C.h
index 71fd96a..20cc71c 100644
--- i/src/GxEPD2_3C.h
+++ w/src/GxEPD2_3C.h
@@ -631,6 +631,11 @@ class GxEPD2_3C : public GxEPD2_GFX_BASE_CLASS
{
epd2.hibernate();
}
+ // returns a pointer to the internal black buffer memory
+ uint8_t *getBuffer(void) const { return _black_buffer; }
+ uint8_t *getBlackBuffer(void) const { return _black_buffer; }
+ // returns a pointer to the internal color buffer memory
+ uint8_t *getColorBuffer(void) const { return _color_buffer; }
private:
template <typename T> static inline void
_swap_(T & a, T & b)
@@ -667,9 +672,12 @@ class GxEPD2_3C : public GxEPD2_GFX_BASE_CLASS
break;
}
}
- private:
+
+ protected:
uint8_t _black_buffer[(GxEPD2_Type::WIDTH / 8) * page_height];
uint8_t _color_buffer[(GxEPD2_Type::WIDTH / 8) * page_height];
+
+ private:
bool _using_partial_mode, _second_phase, _mirror;
uint16_t _width_bytes, _pixel_bytes;
int16_t _current_page;
diff --git i/src/GxEPD2_4C.h w/src/GxEPD2_4C.h
index 5a31a4a..0e441f1 100644
--- i/src/GxEPD2_4C.h
+++ w/src/GxEPD2_4C.h
@@ -480,6 +480,8 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
{
epd2.hibernate();
}
+ // returns a pointer to the internal pixel buffer memory
+ uint8_t *getBuffer(void) const { return _pixel_buffer; }
private:
template <typename T> static inline void
_swap_(T & a, T & b)
@@ -551,8 +553,9 @@ class GxEPD2_4C : public GxEPD2_GFX_BASE_CLASS
_prev_color4 = cv4;
return cv4;
}
- private:
+ protected:
uint8_t _pixel_buffer[(GxEPD2_Type::WIDTH / 4) * page_height];
+ private:
bool _using_partial_mode, _second_phase, _mirror;
uint16_t _width_bytes, _pixel_bytes;
int16_t _current_page;
diff --git i/src/GxEPD2_BW.h w/src/GxEPD2_BW.h
index 045dc78..678123a 100644
--- i/src/GxEPD2_BW.h
+++ w/src/GxEPD2_BW.h
@@ -711,6 +711,8 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
{
epd2.hibernate();
}
+ // returns a pointer to the internal buffer memory
+ uint8_t *getBuffer(void) const { return _buffer; }
private:
template <typename T> static inline void
_swap_(T & a, T & b)
@@ -747,8 +749,10 @@ class GxEPD2_BW : public GxEPD2_GFX_BASE_CLASS
break;
}
}
- private:
+ protected:
uint8_t _buffer[(GxEPD2_Type::WIDTH / 8) * page_height];
+
+ private:
bool _using_partial_mode, _second_phase, _mirror, _reverse;
uint16_t _width_bytes, _pixel_bytes;
int16_t _current_page;
Best solution would be to get a feature like this directly in upstream GxEPD2 library.
I think you contacted the author Jean-Marc (@ZinggJM) before - maybe he is willing to incorporate such a feature. His repository has no "Issues" and I hesitate to file a pull request, as I have no hardware at hands currently to test it (OBP60 left on boat, no other epaper display to try).
This seems to be the way to go.
Modified GxEPD2_BW.h with function getBuffer().
Successfully ran some tests.
Had to remove the "const".
Tests ongoing...
Concerning your experiments in Picture2HTML branch:
GxEPD2 does not provide access to its framebuffer, as the buffers are marked "private".
IMO access would require patching the GxEPD2 library, as fiddling with linker scripts to get the buffer's memory location is a bad approach on PlatformIO.
The following is my untested proposal which follows Adafruit_GFX.h conventions:
Best solution would be to get a feature like this directly in upstream GxEPD2 library. I think you contacted the author Jean-Marc (@ZinggJM) before - maybe he is willing to incorporate such a feature. His repository has no "Issues" and I hesitate to file a pull request, as I have no hardware at hands currently to test it (OBP60 left on boat, no other epaper display to try).