aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-06-23 14:04:56 +0200
committerTectu <joel@unormal.org>2012-06-23 14:04:56 +0200
commitde71035ce4bab711d03514d3137b812f8634e405 (patch)
tree22007b649e8c0da64ef8c1a85c1c39a67594645f
parent83f22aaeb65b2cbff240313a851748d3e771e03d (diff)
downloaduGFX-de71035ce4bab711d03514d3137b812f8634e405.tar.gz
uGFX-de71035ce4bab711d03514d3137b812f8634e405.tar.bz2
uGFX-de71035ce4bab711d03514d3137b812f8634e405.zip
ssd1289 powermodes implemented (powerOn, powerOff, sleepOn, sleepOff)
-rw-r--r--drivers/lcd/ssd1289_lld.c18
-rw-r--r--glcd.h2
2 files changed, 14 insertions, 6 deletions
diff --git a/drivers/lcd/ssd1289_lld.c b/drivers/lcd/ssd1289_lld.c
index cfacfb47..9f3303f9 100644
--- a/drivers/lcd/ssd1289_lld.c
+++ b/drivers/lcd/ssd1289_lld.c
@@ -142,14 +142,22 @@ static __inline void lld_lcdDelay(uint16_t us) {
}
void lld_lcdSetPowerMode(uint8_t powerMode) {
- /* TODO */
-
switch(powerMode) {
- case poweroff:
+ case powerOff:
+ lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
+ lld_lcdWriteReg(0x0007, 0x0000); // halt operation
+ lld_lcdWriteReg(0x0000, 0x0000); // turn off oszillator
+ lld_lcdWriteReg(0x0010, 0x0001); // enter sleepmode
+ break;
+ case powerOn:
+ lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
+ lld_lcdInit();
break;
- case poweron:
+ case sleepOn:
+ lld_lcdWriteReg(0x0010, 0x0001); // enter sleep mode
break;
- case standby:
+ case sleepOff:
+ lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
break;
}
}
diff --git a/glcd.h b/glcd.h
index 99032b2e..8108b21f 100644
--- a/glcd.h
+++ b/glcd.h
@@ -28,7 +28,7 @@
enum orientation {portrait, landscape, portraitInv, landscapeInv};
enum filled {frame, filled};
enum transparency {solid, transparent};
-enum powermode {poweroff, poweron, standby};
+enum powermode {powerOff, powerOn, sleepOn, sleepOff};
// For text rendering only
extern uint16_t bgcolor, fgcolor;