Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.
Dependents: afero_poc15_180216 afero_poc15_180223 afero_poc15_180302 afero_poc15_180403R ... more
Fork of UniGraphic by
UniGraphic for La Suno Version.
To go with La Suno, WatchDog Reset functions were added in ILI9341.
Diff: Inits/UC1608.cpp
- Revision:
- 1:ff019d22b275
- Parent:
- 0:75ec1b3cde17
- Child:
- 3:48f3282c2be8
--- a/Inits/UC1608.cpp Thu Feb 12 22:22:47 2015 +0000 +++ b/Inits/UC1608.cpp Fri Feb 13 15:25:10 2015 +0000 @@ -21,8 +21,8 @@ set_orientation(1); locate(0,0); } -UC1608::UC1608(proto_t displayproto, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char *name) - : LCD(displayproto, mosi, miso, sclk, CS, reset, DC, LCDSIZE_X, LCDSIZE_Y, IC_X_SEGS, IC_Y_COMS, name) +UC1608::UC1608(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char *name) + : LCD(displayproto, Hz, mosi, miso, sclk, CS, reset, DC, LCDSIZE_X, LCDSIZE_Y, IC_X_SEGS, IC_Y_COMS, name) { hw_reset(); BusEnable(true); @@ -36,30 +36,30 @@ { /* Start Initial Sequence ----------------------------------------------------*/ - // wr_cmd(0xE2); // sw reset + // wr_cmd8(0xE2); // sw reset wait_ms(15); - wr_cmd(0x27); // Multiplex rate :128 set temperature consenpation 0% - wr_cmd(0xEA); //set bias:1/12bias + wr_cmd8(0x27); // Multiplex rate :128 set temperature consenpation 0% + wr_cmd8(0xEA); //set bias:1/12bias - wr_cmd(0xC4); // set mirror MX=1,MY=0 (controller->display SEGs wiring inverted) - // wr_cmd(0xA0); // ADC select seg0-seg223 - //wr_cmd(0xA1); // ADC select seg223-seg0 - // wr_cmd(0xC8); // SHL select com63-com0 - //wr_cmd(0xC0); // SHL select com0-com63 + wr_cmd8(0xC4); // set mirror MX=1,MY=0 (controller->display SEGs wiring inverted) + // wr_cmd8(0xA0); // ADC select seg0-seg223 + //wr_cmd8(0xA1); // ADC select seg223-seg0 + // wr_cmd8(0xC8); // SHL select com63-com0 + //wr_cmd8(0xC0); // SHL select com0-com63 - wr_cmd(0x2F); // //Power Control:internal, LCD capacitance 60nf-90nf + wr_cmd8(0x2F); // //Power Control:internal, LCD capacitance 60nf-90nf wait_ms(10); - // wr_cmd(0x81);//Set Gain and Potentiometer - // wr_cmd(0x40|46);//Set Gain and Potentiometer xx xxxxxx + // wr_cmd8(0x81);//Set Gain and Potentiometer + // wr_cmd8(0x40|46);//Set Gain and Potentiometer xx xxxxxx set_contrast(46); - wr_cmd(0x88); //disable colum/page address wraparound - wr_cmd(0xA4); // LCD display ram (EntireDisplayOn disable) - wr_cmd(0x40); // start line = 0 - wr_cmd(0xA6); // display normal (1 = illuminated) - wr_cmd(0xAF); // display ON + wr_cmd8(0x88); //disable colum/page address wraparound + wr_cmd8(0xA4); // LCD display ram (EntireDisplayOn disable) + wr_cmd8(0x40); // start line = 0 + wr_cmd8(0xA6); // display normal (1 = illuminated) + wr_cmd8(0xAF); // display ON } //////////////////////////////////////////////////////////////////// @@ -70,24 +70,25 @@ switch (mode) { case(NONE): - wr_cmd(0xC4); // this is in real X mirror command, but my display have SEGs wired inverted, so assume this is the default no-x-mirror + wr_cmd8(0xC4); // this is in real X mirror command, but my display have SEGs wired inverted, so assume this is the default no-x-mirror break; case(X): - wr_cmd(0xC0); + wr_cmd8(0xC0); break; case(Y): - wr_cmd(0xCC); + wr_cmd8(0xCC); break; case(XY): - wr_cmd(0xC8); + wr_cmd8(0xC8); break; } } void UC1608::set_contrast(int o) { contrast = o; - wr_cmd(0x81); // set volume - wr_cmd(0x40|(o&0x3F)); + // wr_cmd8(0x81); // set volume + // wr_cmd8(0x40|(o&0x3F)); + wr_cmd16(0x8140|(o&0x3F)); } void UC1608::BusEnable(bool enable) {