EPD display library. Check this version (it should work)
Fork of GDEP015OC1 by
Revision 7:70c58d3cbc8b, committed 2016-09-26
- Comitter:
- Anunnaki
- Date:
- Mon Sep 26 10:08:14 2016 +0000
- Parent:
- 6:45d2ec037fd6
- Child:
- 8:5ae728fa8820
- Commit message:
- Added in partia refresh and separate functions for full and partial refresh
Changed in this revision
GDEP015OC1.cpp | Show annotated file Show diff for this revision Revisions of this file |
GDEP015OC1.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/GDEP015OC1.cpp Thu Sep 22 14:11:37 2016 +0000 +++ b/GDEP015OC1.cpp Mon Sep 26 10:08:14 2016 +0000 @@ -10,6 +10,11 @@ 0x88, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51, 0x35, 0x51, 0x51, 0x19, 0x01, 0x00 }; +static const unsigned char _lutPart[] = { + 0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + GDEP015OC1::GDEP015OC1(SPI& spi, PinName cs=p5, PinName dc=p6, PinName rst=p7, PinName busy=p8) : _spi(spi), _cs(cs), _dc(dc), _rst(rst), _busy(busy){ _bold = true; _italic = false; @@ -36,7 +41,7 @@ empty(); } -void GDEP015OC1::_wakeUp(void){ +void GDEP015OC1::_wakeUp(bool partial){ _rst = 0; wait_ms(10); _rst = 1; @@ -107,8 +112,15 @@ //Write LUT _spiCommand(0x32); - for(uint8_t i = 0; i<30;i++) - _spiData(_lutFull[i]); + if(partial){ + for(uint8_t i = 0; i<30;i++){ + _spiData(_lutPart[i]); + } + } else{ + for(uint8_t i = 0; i<30;i++){ + _spiData(_lutFull[i]); + } + } //Power on _spiCommand(0x22); @@ -165,7 +177,31 @@ } void GDEP015OC1::write(void){ - _wakeUp(); + _wakeUp(true); + + _spiCommand(0x24); + for(int16_t x=0; x>=0 && x<200; x++){ + for(int16_t y=24; y>=0 && y<25; y--){ + _spiData(_mirrorData(_pixelConv(_buffer, x*25+y))); + wait_us(10); + } + } + + _spiCommand(0x22); + _spiData(0x04); + _spiCommand(0x22); + _spiData(0x08); + + //Update + _spiCommand(0x22); + _spiData(0xC7); + _spiCommand(0x20); + + _sleep(); +} + +void GDEP015OC1::writeFull(void){ + _wakeUp(false); _spiCommand(0x24); for(int16_t x=0; x>=0 && x<200; x++){
--- a/GDEP015OC1.h Thu Sep 22 14:11:37 2016 +0000 +++ b/GDEP015OC1.h Mon Sep 26 10:08:14 2016 +0000 @@ -18,7 +18,8 @@ unsigned char get(uint16_t i); void empty(void); void invert(void); - void write(void); + void write(void); + void writeFull(void); void drawPixel(uint16_t startX, uint16_t startY, bool color); void drawLine(uint16_t startX, uint16_t startY, uint16_t stopX, uint16_t stopY, bool color); void drawTriangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, bool color); @@ -43,7 +44,7 @@ void _spiCommand(unsigned char command); void _spiData(unsigned char data); void _init(void); - void _wakeUp(void); + void _wakeUp(bool partial); void _sleep(void); unsigned char _pixelConv(unsigned char *data, int i); uint8_t _mirrorData(uint8_t data);