Skip to content

Commit fcc9ae1

Browse files
Laurence BankLaurence Bank
authored andcommitted
Added support and cleanup for more Sharp LCDs
1 parent 35b9a2d commit fcc9ae1

4 files changed

Lines changed: 273 additions & 37 deletions

File tree

src/OneBitDisplay.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ int ONE_BIT_DISPLAY::allocBuffer(void)
141141
return OBD_ERROR_NO_MEMORY; // failed
142142
} /* allocBuffer() */
143143

144+
uint32_t ONE_BIT_DISPLAY::capabilities(void)
145+
{
146+
return _obd.iFlags;
147+
}
148+
144149
void * ONE_BIT_DISPLAY::getBuffer(void)
145150
{
146151
return (void *)_obd.ucScreen;
@@ -542,6 +547,11 @@ void ONE_BIT_DISPLAY::setPosition(int x, int y, int w, int h)
542547
else
543548
obdSetPosition(&_obd, x, y, 1);
544549
} /* setPosition() */
550+
void ONE_BIT_DISPLAY::writeRaw(uint8_t *pData, int iLen)
551+
{
552+
RawWrite(&_obd, pData, iLen);
553+
}
554+
545555
void ONE_BIT_DISPLAY::writeCommand(uint8_t ucCMD)
546556
{
547557
obdWriteCommand(&_obd, ucCMD);
@@ -557,6 +567,13 @@ void ONE_BIT_DISPLAY::pushImage(int x, int y, int w, int h, uint16_t *pixels)
557567
(void)x; (void)y; (void)w; (void)h; (void)pixels;
558568
}
559569

570+
int ONE_BIT_DISPLAY::displayFast(int x, int y, int cx, int cy) {
571+
if (_obd.type >= EPD42_400x300 && _obd.iFlags & OBD_HAS_FAST_UPDATE) {
572+
obdDumpFast(&_obd, x, y, cx, cy);
573+
return OBD_SUCCESS;
574+
}
575+
return OBD_ERROR_NOT_SUPPORTED;
576+
}
560577
int ONE_BIT_DISPLAY::displayFast()
561578
{
562579
if (_obd.type >= EPD42_400x300 && _obd.iFlags & OBD_HAS_FAST_UPDATE) {

src/OneBitDisplay.h

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ enum {
4949
OBD_CHIP_SH11xx, // OLED
5050
OBD_CHIP_SSD16xx, // EPD
5151
OBD_CHIP_UC8151, // EPD
52+
OBD_CHIP_SHARP, // all Sharp LCDs
5253
OBD_CHIP_COUNT
5354
};
5455

@@ -95,10 +96,12 @@ enum {
9596
SHARP_128x128,
9697
SHARP_144x168,
9798
SHARP_400x240,
99+
SHARP_160x68,
98100
#ifndef __AVR__
99101
LCD_ST7302,
100102
#endif
101103
EPD42_400x300, // WFT0420CZ15
104+
EPD42_4GRAY_400x300, // WFT0420CZ15
102105
EPD42B_400x300, // DEPG0420BN
103106
EPD42Y_400x300, // DEPG0420YN
104107
EPD29_128x296,
@@ -128,12 +131,9 @@ enum {
128131
EPD37Y_240x416, // DEPG0370YN
129132
EPD37_240x416, // GDEY037T03
130133
EPD579_792x272, // GDEY0579T93
131-
#ifndef __AVR__
132-
// requires too much RAM to run on AVR
133134
EPD583R_600x448,
134135
EPD74R_640x384,
135136
EPD75_800x480, // GDEY075T7
136-
#endif
137137
EPD583_648x480, // DEPG0583BN
138138
EPD29_BWYR_128x296, // GDEY029F51
139139
EPD29_BWYR_168x384, // GDEY029F51H
@@ -155,15 +155,22 @@ enum {
155155
#define OBD_BITBANG 0x0010
156156
#define OBD_3COLOR 0x0020
157157
#define OBD_4COLOR 0x0040
158-
#define OBD_FULLUPDATE 0x0080
159-
#define OBD_CS_EVERY_BYTE 0x0100
160-
#define OBD_HAS_FAST_UPDATE 0x0200
158+
#define OBD_4GRAY 0x0080
159+
#define OBD_FULLUPDATE 0x0100
160+
#define OBD_CS_EVERY_BYTE 0x0200
161+
#define OBD_HAS_FAST_UPDATE 0x0400
161162

162163
#define OBD_WHITE 0
163164
#define OBD_BLACK 1
164165
#define OBD_YELLOW 2
165166
#define OBD_RED 3
166167

168+
// 4 gray levels
169+
#define OBD_GRAY0 0
170+
#define OBD_GRAY1 1
171+
#define OBD_GRAY2 2
172+
#define OBD_GRAY3 3
173+
167174
#define OBD_ANY_ADDRESS -1
168175
// Rotation and flip angles to draw tiles
169176
enum {
@@ -195,6 +202,7 @@ enum reg {
195202
UC8151_LUT_BW = 0x22,
196203
UC8151_LUT_WB = 0x23,
197204
UC8151_LUT_BB = 0x24,
205+
UC8151_LUT_VCOM2 = 0x25,
198206
UC8151_PLL = 0x30,
199207
UC8151_TSC = 0x40,
200208
UC8151_TSE = 0x41,
@@ -335,9 +343,11 @@ class ONE_BIT_DISPLAY
335343
void setBB(BBI2C *pBB);
336344
OBDISP *getOBD();
337345
void setFlags(int iFlags);
346+
uint32_t capabilities();
338347
void setContrast(uint8_t ucContrast);
339348
int display(bool bRefresh = true, bool bWait = true);
340349
int displayFast();
350+
int displayFast(int x, int y, int w, int h);
341351
int displayPartial(int x, int y, int w, int h, uint8_t *pBuffer = NULL);
342352
void setBitBang(bool bBitBang);
343353
void setRender(bool bRAMOnly);
@@ -379,6 +389,7 @@ class ONE_BIT_DISPLAY
379389
int scrollBuffer(int iStartCol, int iEndCol, int iStartRow, int iEndRow, int bUp);
380390
void pushPixels(uint8_t *pPixels, int iCount);
381391
void writeCommand(uint8_t ucCMD);
392+
void writeRaw(uint8_t *pData, int iLen);
382393
void pushImage(int x, int y, int w, int h, uint16_t *pixels);
383394
void drawString(const char *pText, int x, int y);
384395
void drawString(String text, int x, int y);

0 commit comments

Comments
 (0)