@@ -194,10 +194,16 @@ const BBPANELDEF panelDefs[] = {
194
194
// D8 15 D0 D7 STV,CKV,XSTL,OE,XLE
195
195
{1872 , 1404 , 20000000 , BB_PANEL_FLAG_MIRROR_X, {8 ,18 ,17 ,16 ,15 ,7 ,6 ,5 ,47 ,21 ,14 ,13 ,12 ,11 ,10 ,9 }, 16 , 11 , 41 , 42 , 45 , 8 , 48 ,
196
196
4 , 14 , 39 , 40 , BB_NOT_USED, 0 , 46 , u8GrayMatrix, sizeof (u8GrayMatrix), 0 }, // BB_PANEL_V7_103
197
+ {960 , 540 , 20000000 , BB_PANEL_FLAG_SLOW_SPH, {11 ,12 ,13 ,14 ,21 ,47 ,45 ,38 }, 8 , BB_NOT_USED, BB_NOT_USED, 39 , 9 , 0 , 0 ,
198
+ 10 , 0 , 2 , 42 , 1 , 0 , 46 /* LoRa CS */ , u8M5Matrix, sizeof (u8M5Matrix), 0 }, // BB_PANEL_LILYGO_T5PRO
197
199
};
198
200
//
199
201
// Forward references for panel callback functions
200
202
//
203
+ // LilyGo T5S3-Pro
204
+ int LilyGoEinkPower (void *pBBEP, int bOn);
205
+ int LilyGoIOInit (void *pBBEP);
206
+ void LilyGoRowControl (void *pBBEP, int iMode);
201
207
// M5Stack PaperS3
202
208
int PaperS3EinkPower (void *pBBEP, int bOn);
203
209
int PaperS3IOInit (void *pBBEP);
@@ -232,6 +238,7 @@ const BBPANELPROCS panelProcs[] = {
232
238
{EPDiyV7EinkPower, EPDiyV7IOInit, EPDiyV7RowControl, EPDiyV7IODeInit, EPDiyV7ExtIO}, // BB_PANEL_EPDIY_V7_16
233
239
{EPDiyV7RAWEinkPower, EPDiyV7RAWIOInit, EPDiyV7RowControl, NULL , NULL }, // BB_PANEL_V7_RAW
234
240
{EPDiyV7EinkPower, EPDiyV7IOInit, EPDiyV7RowControl, EPDiyV7IODeInit, EPDiyV7ExtIO}, // BB_PANEL_V7_103
241
+ {LilyGoEinkPower, LilyGoIOInit, LilyGoRowControl, NULL , NULL },// BB_PANEL_LILYGO_T5PRO
235
242
};
236
243
237
244
uint8_t ioRegs[24 ]; // MCP23017 copy of I/O register state so that we can just write new bits
@@ -539,7 +546,7 @@ uint8_t Inkplate5V2ExtIO(uint8_t iOp, uint8_t iPin, uint8_t iVal)
539
546
void bbepSendShiftData (FASTEPDSTATE *pState)
540
547
{
541
548
uint8_t uc = pState->shift_data ;
542
- // Serial.printf("Sending shift data: 0x%02x\n", uc);
549
+ // Serial.printf("Sending shift data: 0x%02x\n", uc);
543
550
// Clear STR (store) to allow updating the value
544
551
gpio_set_level ((gpio_num_t )pState->panelDef .ioShiftSTR , 0 );
545
552
for (int i=0 ; i<8 ; i++) { // bits get pushed in reverse order (bit 7 first)
@@ -550,24 +557,108 @@ void bbepSendShiftData(FASTEPDSTATE *pState)
550
557
gpio_set_level ((gpio_num_t )pState->panelDef .ioSDA , 0 );
551
558
uc <<= 1 ;
552
559
gpio_set_level ((gpio_num_t )pState->panelDef .ioSCL , 1 );
553
- delayMicroseconds (1 );
554
560
}
555
561
// set STR to write the new data to the output to pins
556
562
gpio_set_level ((gpio_num_t )pState->panelDef .ioShiftSTR , 1 );
557
563
} /* bbepSendShiftData() */
558
564
//
559
- // change the state of a bit in the shift register mask, and update the outputs
565
+ // LilyGo T5S3 Pro control functions
560
566
//
561
- void bbepSetShiftBit (FASTEPDSTATE *pBBEP, uint8_t u8Bit, uint8_t u8State )
567
+ int LilyGoEinkPower ( void *pBBEP, int bOn )
562
568
{
563
- if (u8State) { // set it
564
- pBBEP->shift_data |= (1 << u8Bit);
565
- } else {
566
- pBBEP->shift_data &= ~(1 << u8Bit);
569
+ FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
570
+ if (bOn == pState->pwr_on ) return BBEP_SUCCESS; // already on
571
+ if (bOn) {
572
+ pState->shift_data |= 0x80 ; // OE on
573
+ bbepSendShiftData (pState);
574
+ delayMicroseconds (100 );
575
+ pState->shift_data &= ~0x02 ; // !power_disable
576
+ bbepSendShiftData (pState);
577
+ delayMicroseconds (100 );
578
+ pState->shift_data |= 0x08 ; // neg_power_enable
579
+ bbepSendShiftData (pState);
580
+ delayMicroseconds (500 );
581
+ pState->shift_data |= 0x04 ; // pos_power_enable
582
+ bbepSendShiftData (pState);
583
+ delayMicroseconds (100 );
584
+ pState->shift_data |= 0x10 ; // stv = true
585
+ bbepSendShiftData (pState);
586
+ delayMicroseconds (100 );
587
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioSPH , 1 );
588
+ pState->pwr_on = 1 ;
589
+ } else { // off
590
+ pState->shift_data &= ~0x04 ; // pos_power_enable = false
591
+ bbepSendShiftData (pState);
592
+ delayMicroseconds (10 );
593
+ pState->shift_data &= ~0x08 ; // neg_power_enable = false
594
+ bbepSendShiftData (pState);
595
+ delayMicroseconds (100 );
596
+ pState->shift_data |= 0x02 ; // power_disable = true
597
+ bbepSendShiftData (pState);
598
+ delayMicroseconds (100 );
599
+ pState->shift_data &= ~0x80 ; // OE off
600
+ bbepSendShiftData (pState);
601
+ delayMicroseconds (100 );
602
+ pState->shift_data &= ~0x10 ; // stv = false
603
+ bbepSendShiftData (pState);
604
+ pState->pwr_on = 0 ;
567
605
}
568
- bbepSendShiftData (pBBEP);
569
- }
570
- //
606
+ return BBEP_SUCCESS;
607
+ } /* LilyGoEinkPower() */
608
+
609
+ int LilyGoIOInit (void *pBBEP)
610
+ {
611
+ FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
612
+ bbepPinMode (pState->panelDef .ioSDA , OUTPUT);
613
+ bbepPinMode (pState->panelDef .ioSCL , OUTPUT);
614
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioSCL , 0 );
615
+ bbepPinMode (pState->panelDef .ioShiftSTR , OUTPUT);
616
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioShiftSTR , 0 );
617
+ bbepPinMode (pState->panelDef .ioCKV , OUTPUT);
618
+ bbepPinMode (pState->panelDef .ioSPH , OUTPUT);
619
+ bbepPinMode (pState->panelDef .ioCL , OUTPUT);
620
+ pState->shift_data = 0x2 ; // power disable
621
+ pState->shift_data |= 0x20 ; // ep_scan_direction
622
+ pState->shift_data |= 0x10 ; // ep_stv
623
+ bbepSendShiftData (pState);
624
+ return BBEP_SUCCESS;
625
+
626
+ } /* LilyGoIOInit() */
627
+
628
+ void LilyGoRowControl (void *pBBEP, int iMode)
629
+ {
630
+ FASTEPDSTATE *pState = (FASTEPDSTATE *)pBBEP;
631
+ if (iMode == ROW_START) {
632
+ pState->shift_data |= 0x40 ; // ep_mode = true
633
+ bbepSendShiftData (pState);
634
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 1 ); // CKV on
635
+ delayMicroseconds (7 );
636
+ pState->shift_data &= ~0x10 ; // spv = off
637
+ bbepSendShiftData (pState);
638
+ delayMicroseconds (10 );
639
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 0 ); // CKV off
640
+ delayMicroseconds (0 );
641
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 1 ); // CKV on
642
+ delayMicroseconds (8 );
643
+ pState->shift_data |= 0x10 ; // spv = on
644
+ bbepSendShiftData (pState);
645
+ delayMicroseconds (10 );
646
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 0 ); // CKV off
647
+ delayMicroseconds (0 );
648
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 1 ); // CKV on
649
+ delayMicroseconds (18 );
650
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 0 ); // CKV off
651
+ delayMicroseconds (0 );
652
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 1 ); // CKV on
653
+ } else if (iMode == ROW_STEP) {
654
+ gpio_set_level ((gpio_num_t )pState->panelDef .ioCKV , 0 ); // CKV off
655
+ pState->shift_data |= 0x01 ; // latch_enable = true
656
+ bbepSendShiftData (pState);
657
+ pState->shift_data &= ~0x01 ; // latch_enable = false
658
+ bbepSendShiftData (pState);
659
+ }
660
+ } /* LilyGoRowControl() */
661
+
571
662
// Control the DC/DC power circuit of the M5Stack PaperS3
572
663
//
573
664
int PaperS3EinkPower (void *pBBEP, int bOn)
0 commit comments