Skip to content

Commit 260086c

Browse files
authored
Merge pull request #28 from craftbyte/main
Add support for Inkplate 10
2 parents 40b652e + 150d515 commit 260086c

3 files changed

Lines changed: 98 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ I'm fascinated by displays of all types, especially eink. I already wrote a libr
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

1212
<b> What devices are currently supported?</b><br>
13-
At the moment, FastEPD supports the EPDiy V7 PCB, M5Stack PaperS3, LilyGo T5 S3 4.7 Pro, Inkplate 6PLUS and the Inkplate 5 gen 2. With the EPDiy V7 PCB, various 8 and 16-bit panels have been tested.<br>
13+
At the moment, FastEPD supports the EPDiy V7 PCB, M5Stack PaperS3, LilyGo T5 S3 4.7 Pro, Inkplate 6PLUS, Inkplate 5 gen 2, and Inkplate 10. With the EPDiy V7 PCB, various 8 and 16-bit panels have been tested.<br>
1414
<br>
1515
Please read the Wiki for API details.
1616

src/FastEPD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum {
6666
BB_PANEL_EPDIY_V7,
6767
BB_PANEL_INKPLATE6PLUS,
6868
BB_PANEL_INKPLATE5V2,
69+
BB_PANEL_INKPLATE10,
6970
BB_PANEL_EPDIY_V7_16,
7071
BB_PANEL_V7_RAW,
7172
BB_PANEL_LILYGO_T5PRO,

src/FastEPD.inl

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ const BBPANELDEF panelDefs[] = {
185185
{1280, 720, 13333333, BB_PANEL_FLAG_SLOW_SPH | BB_PANEL_FLAG_MIRROR_X, {4,5,18,19,23,25,26,27}, 8, 4, 2, 32, 33, 0, 2,
186186
0, 7, 21, 22, 3, 5, 0, u8Ink5V2Matrix, sizeof(u8Ink5V2Matrix), 16, -1600}, // BB_PANEL_INKPLATE5V2
187187

188+
{1200, 825, 13333333, BB_PANEL_FLAG_SLOW_SPH | BB_PANEL_FLAG_MIRROR_X | BB_PANEL_FLAG_MIRROR_Y, {4,5,18,19,23,25,26,27}, 8, 4, 2, 32, 33, 0, 2,
189+
0, 7, 21, 22, 3, 5, 15, u8NineInchMatrix, sizeof(u8NineInchMatrix), 16, -1800}, // BB_PANEL_INKPLATE10
190+
188191
{0, 0, 20000000, BB_PANEL_FLAG_NONE, {9,10,11,12,13,14,21,47,5,6,7,15,16,17,18,8}, 16, 11, 45, 48, 41, 8, 42,
189192
4, 14, 39, 40, BB_NOT_USED, 0, 46, u8GrayMatrix, sizeof(u8GrayMatrix), 16, -1600}, // BB_PANEL_EPDIY_V7_16
190193

@@ -232,6 +235,9 @@ void Inkplate6PlusRowControl(void *pBBEP, int iMode);
232235
int Inkplate5V2EinkPower(void *pBBEP, int bOn);
233236
int Inkplate5V2IOInit(void *pBBEP);
234237
void Inkplate5V2RowControl(void *pBBEP, int iMode);
238+
// Inkplate10 (9.7" 1200x825 panel, dual PCAL6416A expanders, TPS65186 PMIC)
239+
int Inkplate10EinkPower(void *pBBEP, int bOn);
240+
int Inkplate10IOInit(void *pBBEP);
235241
uint8_t EPDiyV7ExtIO(uint8_t iOp, uint8_t iPin, uint8_t iVal);
236242
uint8_t Inkplate5V2ExtIO(uint8_t iOp, uint8_t iPin, uint8_t iVal);
237243

@@ -243,6 +249,7 @@ const BBPANELPROCS panelProcs[] = {
243249
{EPDiyV7EinkPower, EPDiyV7IOInit, EPDiyV7RowControl, EPDiyV7IODeInit, EPDiyV7ExtIO}, // BB_PANEL_EPDIY_V7
244250
{Inkplate6PlusEinkPower, Inkplate6PlusIOInit, Inkplate6PlusRowControl, NULL, NULL}, // BB_PANEL_INKPLATE6PLUS
245251
{Inkplate5V2EinkPower, Inkplate5V2IOInit, Inkplate5V2RowControl, NULL, Inkplate5V2ExtIO}, // Inkplate5V2
252+
{Inkplate10EinkPower, Inkplate10IOInit, Inkplate5V2RowControl, NULL, NULL}, // BB_PANEL_INKPLATE10
246253
{EPDiyV7EinkPower, EPDiyV7IOInit, EPDiyV7RowControl, EPDiyV7IODeInit, EPDiyV7ExtIO}, // BB_PANEL_EPDIY_V7_16
247254
{EPDiyV7RAWEinkPower, EPDiyV7RAWIOInit, EPDiyV7RowControl, NULL, NULL}, // BB_PANEL_V7_RAW
248255
{LilyGoEinkPower, LilyGoIOInit, LilyGoRowControl, NULL, NULL},// BB_PANEL_LILYGO_T5PRO
@@ -1262,6 +1269,95 @@ void Inkplate5V2RowControl(void *pBBEP, int iType)
12621269
delayMicroseconds(0);
12631270
}
12641271
}
1272+
//
1273+
// Inkplate10 uses PCAL6416A expanders for panel control.
1274+
//
1275+
int Inkplate10EinkPower(void *pBBEP, int bOn)
1276+
{
1277+
FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
1278+
uint8_t ucTemp[4];
1279+
1280+
if (bOn == pState->pwr_on) return BBEP_SUCCESS;
1281+
1282+
if (bOn) {
1283+
bbepPCALDigitalWrite(pState->panelDef.ioShiftSTR, 1); // WAKEUP on
1284+
delay(5);
1285+
1286+
// Match the official Inkplate 10 TPS65186 sequence.
1287+
ucTemp[0] = 0x01;
1288+
ucTemp[1] = 0x20;
1289+
bbepI2CWrite(0x48, ucTemp, 2);
1290+
1291+
ucTemp[0] = 0x09;
1292+
ucTemp[1] = 0xe4;
1293+
bbepI2CWrite(0x48, ucTemp, 2);
1294+
1295+
ucTemp[0] = 0x0b;
1296+
ucTemp[1] = 0x1b;
1297+
bbepI2CWrite(0x48, ucTemp, 2);
1298+
1299+
bbepPCALDigitalWrite(pState->panelDef.ioPWR, 1); // PWRUP on
1300+
1301+
gpio_set_level((gpio_num_t)pState->panelDef.ioLE, 0); // LE off (GPIO 2)
1302+
bbepPCALDigitalWrite(pState->panelDef.ioOE, 0); // OE off
1303+
gpio_set_level((gpio_num_t)pState->panelDef.ioSPH, 1); // SPH on (GPIO 33)
1304+
bbepPCALDigitalWrite(1, 1); // GMOD on
1305+
bbepPCALDigitalWrite((uint8_t)pState->panelDef.ioSPV, 1); // SPV on
1306+
gpio_set_level((gpio_num_t)pState->panelDef.ioCKV, 0); // CKV off (GPIO 32)
1307+
bbepPCALDigitalWrite(pState->panelDef.ioShiftMask, 1); // VCOM on
1308+
1309+
unsigned long timer = millis();
1310+
do {
1311+
delay(1);
1312+
} while (!bbepReadPowerGood() && (millis() - timer) < 250);
1313+
1314+
if ((millis() - timer) >= 250) {
1315+
bbepPCALDigitalWrite(pState->panelDef.ioShiftMask, 0); // VCOM off
1316+
bbepPCALDigitalWrite(pState->panelDef.ioPWR, 0); // PWR off
1317+
return BBEP_IO_ERROR;
1318+
}
1319+
1320+
bbepPCALDigitalWrite(pState->panelDef.ioOE, 1); // OE on
1321+
pState->pwr_on = 1;
1322+
} else {
1323+
bbepPCALDigitalWrite(pState->panelDef.ioOE, 0); // OE off
1324+
bbepPCALDigitalWrite(1, 0); // GMOD off
1325+
bbepPCALDigitalWrite(pState->panelDef.ioLE, 0); // LE off
1326+
gpio_set_level((gpio_num_t)pState->panelDef.ioCKV, 0); // CKV off
1327+
gpio_set_level((gpio_num_t)pState->panelDef.ioSPH, 0); // SPH off
1328+
bbepPCALDigitalWrite(pState->panelDef.ioSPV, 0); // SPV off
1329+
bbepPCALDigitalWrite(pState->panelDef.ioShiftMask, 0); // VCOM off
1330+
bbepPCALDigitalWrite(pState->panelDef.ioPWR, 0); // PWR off
1331+
pState->pwr_on = 0;
1332+
}
1333+
return BBEP_SUCCESS;
1334+
} /* Inkplate10EinkPower() */
1335+
1336+
int Inkplate10IOInit(void *pBBEP)
1337+
{
1338+
// Start with the PCAL-based Inkplate5V2 initialization path.
1339+
int rc = Inkplate5V2IOInit(pBBEP);
1340+
if (rc != BBEP_SUCCESS) return rc;
1341+
1342+
#ifdef ARDUINO
1343+
Wire.setClock(400000);
1344+
#endif
1345+
1346+
// Inkplate10 touch buttons are read through PCAL pins 10, 11, and 12.
1347+
// They must stay configured as inputs on this board.
1348+
bbepPCALPinMode(10, INPUT);
1349+
bbepPCALPinMode(11, INPUT);
1350+
bbepPCALPinMode(12, INPUT);
1351+
1352+
// Unused pins are driven low for lower idle power.
1353+
bbepPCALPinMode(14, OUTPUT);
1354+
bbepPCALDigitalWrite(14, LOW);
1355+
bbepPCALPinMode(15, OUTPUT);
1356+
bbepPCALDigitalWrite(15, LOW);
1357+
1358+
return BBEP_SUCCESS;
1359+
} /* Inkplate10IOInit() */
1360+
12651361
void bbepRowControl(FASTEPDSTATE *pState, int iType)
12661362
{
12671363
(*(pState->pfnRowControl))(pState, iType);

0 commit comments

Comments
 (0)