Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GDEP015OC1 by
Diff: GDEP015OC1.cpp
- Revision:
- 7:70c58d3cbc8b
- Parent:
- 6:45d2ec037fd6
- Child:
- 8:cd51988ee35d
--- 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++){