Skip to content

Commit 88217ad

Browse files
Laurence BankLaurence Bank
Laurence Bank
authored and
Laurence Bank
committed
Added initial support for V7RAW PCB
1 parent 57409b4 commit 88217ad

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ I'm fascinated by displays of all types, especially eink. I already wrote a libr
99
<b>What's special about FastEPD?</b><br>
1010
Since writing several display libraries (OneBitDisplay, bb_spi_lcd, bb_epaper), I've used all of my experience with graphics and C++ APIs to create a clean design from the start. Libraries often grow in random ways over time as new features are bolted on and design problems are covered up with hacks. In this case, FastEPD has a better design from the begining and will be easier to maintain and understand. Some of the unique features are compressed fonts and graphics, more flexibility in display updates and a simple API which includes pre-configured setups for popular hardware.
1111

12+
<b> What devices are currently supported?</b><br>
13+
At the moment, FastEPD supports the EPDiy V7 PCB, M5Stack PaperS3, Inkplate6PLUS and the Inkplate5V2. With the EPDiy V7 PCB, various panels have been tested working: (list of panels)<br>
14+
<br>
1215
Please read the Wiki for API details.
1316

1417
If you find this code useful, please consider becoming a sponsor or sending a donation.

src/FastEPD.h

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ enum {
6363
BB_PANEL_EPDIY_V7_16,
6464
BB_PANEL_INKPLATE10,
6565
BB_PANEL_INKPLATE6,
66+
BB_PANEL_V7_RAW,
6667
BB_PANEL_CUSTOM,
6768
BB_PANEL_COUNT
6869
};

src/FastEPD.inl

+80-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <esp_lcd_panel_io.h>
1919
#include <esp_lcd_panel_ops.h>
2020

21-
#if !(defined(CONFIG_ESP32_SPIRAM_SUPPORT) || defined(CONFIG_ESP32S3_SPIRAM_SUPPORT))
21+
#if PSRAM != enabled && !defined(CONFIG_ESP32_SPIRAM_SUPPORT) && !defined(CONFIG_ESP32S3_SPIRAM_SUPPORT)
2222
#error "Please enable PSRAM support"
2323
#endif
2424

@@ -123,6 +123,8 @@ const BBPANELDEF panelDefs[] = {
123123
0, 7, 21, 22, 3, 5, 15, u8GrayMatrix, sizeof(u8GrayMatrix), 16}, // BB_PANEL_INKPLATE10
124124
{800, 600, 13333333, BB_PANEL_FLAG_SLOW_SPH, {4,5,18,19,23,25,26,27}, 8, 4, 2, 32, 33, 0, 2,
125125
0, 7, 21, 22, 3, 5, 15, u8GrayMatrix, sizeof(u8GrayMatrix), 16}, // BB_PANEL_INKPLATE6
126+
{0, 0, 20000000, BB_PANEL_FLAG_NONE, {5,6,7,15,16,17,18,8}, 8, 11, 45, 48, 41, 9, 42,
127+
4, 14, 39, 40, BB_NOT_USED, 0, 0, u8SixInchMatrix, sizeof(u8SixInchMatrix), 0}, // BB_PANEL_V7_RAW
126128
};
127129
//
128130
// Forward references for panel callback functions
@@ -139,6 +141,9 @@ void LilyGoV24RowControl(void *pBBEP, int iMode);
139141
int EPDiyV7EinkPower(void *pBBEP, int bOn);
140142
int EPDiyV7IOInit(void *pBBEP);
141143
void EPDiyV7RowControl(void *pBBEP, int iMode);
144+
// EPDiy V7 RAW
145+
int EPDiyV7RAWEinkPower(void *pBBEP, int bOn);
146+
int EPDiyV7RAWIOInit(void *pBBEP);
142147
// Inkplate6PLUS
143148
int Inkplate6PlusEinkPower(void *pBBEP, int bOn);
144149
int Inkplate6PlusIOInit(void *pBBEP);
@@ -161,6 +166,7 @@ const BBPANELPROCS panelProcs[] = {
161166
{EPDiyV7EinkPower, EPDiyV7IOInit, EPDiyV7RowControl}, // BB_PANEL_EPDIY_V7_16
162167
{Inkplate6PlusEinkPower, Inkplate6PlusIOInit, Inkplate6PlusRowControl}, // BB_PANEL_INKPLATE10
163168
{Inkplate6PlusEinkPower, Inkplate6PlusIOInit, Inkplate6PlusRowControl}, // BB_PANEL_INKPLATE6 (old)
169+
{EPDiyV7RAWEinkPower, EPDiyV7RAWIOInit, EPDiyV7RowControl}, // BB_PANEL_V7_RAW
164170
};
165171

166172
uint8_t ioRegs[24]; // MCP23017 copy of I/O register state so that we can just write new bits
@@ -546,6 +552,56 @@ uint8_t u8Value = 0; // I/O bits for the PCA9535
546552
return BBEP_SUCCESS;
547553
} /* EPDiyV7EinkPower() */
548554

555+
int EPDiyV7RAWEinkPower(void *pBBEP, int bOn)
556+
{
557+
FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
558+
uint8_t ucTemp[4];
559+
uint8_t u8Value = 0; // I/O bits for the PCA9535
560+
561+
if (bOn == pState->pwr_on) return BBEP_SUCCESS;
562+
if (bOn) {
563+
// u8Value |= 4; // STV on DEBUG - not sure why it's not used
564+
gpio_set_level((gpio_num_t)pState->panelDef.ioOE, 1); // OE on
565+
gpio_set_level((gpio_num_t)10, 1); // EP_MODE/GMOD on
566+
gpio_set_level((gpio_num_t)14, 1); // WAKEUP on
567+
gpio_set_level((gpio_num_t)11, 1); // PWRUP on
568+
gpio_set_level((gpio_num_t)12, 1); // VCOM CTRL on
569+
vTaskDelay(1); // allow time to power up
570+
while (!gpio_get_level((gpio_num_t)47)) { }
571+
ucTemp[0] = TPS_REG_ENABLE;
572+
ucTemp[1] = 0x3f; // enable output
573+
bbepI2CWrite(0x68, ucTemp, 2);
574+
// set VCOM to 1.6v (1600)
575+
ucTemp[0] = 3; // vcom voltage register 3+4 = L + H
576+
ucTemp[1] = (uint8_t)(160);
577+
ucTemp[2] = (uint8_t)(160 >> 8);
578+
bbepI2CWrite(0x68, ucTemp, 3);
579+
580+
int iTimeout = 0;
581+
u8Value = 0;
582+
while (iTimeout < 400 && ((u8Value & 0xfa) != 0xfa)) {
583+
bbepI2CReadRegister(0x68, TPS_REG_PG, &u8Value, 1); // read power good
584+
iTimeout++;
585+
vTaskDelay(1);
586+
}
587+
if (iTimeout >= 400) {
588+
// Serial.println("The power_good signal never arrived!");
589+
return BBEP_IO_ERROR;
590+
}
591+
pState->pwr_on = 1;
592+
} else { // power off
593+
gpio_set_level((gpio_num_t)pState->panelDef.ioOE, 0); // OE off
594+
gpio_set_level((gpio_num_t)10, 0); // EP_MODE/GMOD off
595+
gpio_set_level((gpio_num_t)14, 1); // WAKEUP on
596+
gpio_set_level((gpio_num_t)11, 1); // PWRUP on
597+
gpio_set_level((gpio_num_t)12, 1); // VCOM CTRL on
598+
vTaskDelay(1); // only leave WAKEUP on
599+
gpio_set_level((gpio_num_t)14, 0);// now turn everything off
600+
pState->pwr_on = 0;
601+
}
602+
return BBEP_SUCCESS;
603+
} /* EPDiyV7RAWEinkPower() */
604+
549605
int Inkplate6PlusEinkPower(void *pBBEP, int bOn)
550606
{
551607
FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
@@ -697,6 +753,29 @@ int EPDiyV7IOInit(void *pBBEP)
697753
bbepPCA9535SetConfig(0xc0); // set lower 6 bits as outputs and 6 (PWRGOOD) and 7 (INTR) as inputs
698754
return BBEP_SUCCESS;
699755
} /* EPDiyV7IOInit() */
756+
//
757+
// Initialize the IO for the V7 RAW PCB
758+
//
759+
int EPDiyV7RAWIOInit(void *pBBEP)
760+
{
761+
FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
762+
if (pState->panelDef.ioPWR < 0x100) bbepPinMode(pState->panelDef.ioPWR, OUTPUT);
763+
if (pState->panelDef.ioSPV < 0x100) bbepPinMode(pState->panelDef.ioSPV, OUTPUT);
764+
if (pState->panelDef.ioCKV < 0x100) bbepPinMode(pState->panelDef.ioCKV, OUTPUT);
765+
if (pState->panelDef.ioSPH < 0x100) bbepPinMode(pState->panelDef.ioSPH, OUTPUT);
766+
if (pState->panelDef.ioOE < 0x100) bbepPinMode(pState->panelDef.ioOE, OUTPUT);
767+
if (pState->panelDef.ioLE < 0x100) bbepPinMode(pState->panelDef.ioLE, OUTPUT);
768+
if (pState->panelDef.ioCL < 0x100) bbepPinMode(pState->panelDef.ioCL, OUTPUT);
769+
bbepPinMode(10, OUTPUT); // EP_MODE
770+
bbepPinMode(11, OUTPUT); // TPS_PWRUP
771+
bbepPinMode(12, OUTPUT); // TPS_VCOM_CTRL
772+
bbepPinMode(14, OUTPUT); // TPS_WAKEUP
773+
bbepPinMode(47, INPUT); // TPS_POWER_GOOD
774+
bbepI2CInit((uint8_t)pState->panelDef.ioSDA, (uint8_t)pState->panelDef.ioSCL);
775+
bbepPCA9535SetConfig(0xc0); // set lower 6 bits as outputs and 6 (PWRGOOD) and 7 (INTR) as inputs
776+
return BBEP_SUCCESS;
777+
} /* EPDiyV7RAWIOInit() */
778+
700779
//
701780
// Initialize the IO for the Inkplate6PLUS
702781
//

0 commit comments

Comments
 (0)