fix epaper 29 non-universal display (#17999)

* make v1 configurable

* fix ep29 v1
This commit is contained in:
gemu 2023-02-19 22:25:45 +01:00 committed by GitHub
parent dcbf50a918
commit c1dec03adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 15 deletions

View File

@ -35,7 +35,6 @@
//#define BUSY_PIN 16 //#define BUSY_PIN 16
Epd::Epd(int16_t width, int16_t height) : Epd::Epd(int16_t width, int16_t height) :
Paint(width,height) { Paint(width,height) {
} }
@ -87,7 +86,6 @@ void Epd::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) {
setTextColor(WHITE,BLACK); setTextColor(WHITE,BLACK);
setCursor(0,0); setCursor(0,0);
fillScreen(BLACK); fillScreen(BLACK);
disp_bpp = 1; disp_bpp = 1;
} }
@ -102,7 +100,6 @@ void Epd::Begin(int16_t cs,int16_t mosi,int16_t sclk, int16_t rst, int16_t busy)
#endif #endif
} }
void Epd::Init(int8_t p) { void Epd::Init(int8_t p) {
if (p == DISPLAY_INIT_PARTIAL) { if (p == DISPLAY_INIT_PARTIAL) {
Init(lut_partial_update); Init(lut_partial_update);
@ -119,20 +116,14 @@ void Epd::Init(int8_t p) {
} }
} }
int Epd::Init(const unsigned char* lut) { int Epd::Init(const unsigned char* lut) {
/* this calls the peripheral hardware interface, see epdif */
/*if (IfInit() != 0) {
return -1;
}*/
/*
cs_pin=pin[GPIO_SSPI_CS];
mosi_pin=pin[GPIO_SSPI_MOSI];
sclk_pin=pin[GPIO_SSPI_SCLK];
*/
if (framebuffer) { if (iniz) {
// free(framebuffer); #ifndef EPD_29_V2
this->lut = lut;
SetLut(this->lut);
#endif
return 0;
} }
framebuffer = (uint8_t*)malloc(EPD_WIDTH * EPD_HEIGHT / 8); framebuffer = (uint8_t*)malloc(EPD_WIDTH * EPD_HEIGHT / 8);
if (!framebuffer) return -1; if (!framebuffer) return -1;
@ -207,6 +198,7 @@ int Epd::Init(const unsigned char* lut) {
SetLut(this->lut); SetLut(this->lut);
#endif #endif
/* EPD hardware init end */ /* EPD hardware init end */
iniz = 1;
return 0; return 0;
} }
@ -253,7 +245,9 @@ void Epd::Reset(void) {
digitalWrite(rst_pin, HIGH); digitalWrite(rst_pin, HIGH);
delay(200); delay(200);
} else { } else {
#ifdef EPD_29_V2
SendCommand(0x12); SendCommand(0x12);
#endif
} }
} }

View File

@ -109,6 +109,7 @@ private:
unsigned int mosi_pin; unsigned int mosi_pin;
unsigned int sclk_pin; unsigned int sclk_pin;
unsigned char mode; unsigned char mode;
uint8_t iniz = 0;
void delay_busy(uint32_t wait); void delay_busy(uint32_t wait);
void SetLut(const unsigned char* lut); void SetLut(const unsigned char* lut);
void SetMemoryArea(int x_start, int y_start, int x_end, int y_end); void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);