aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-06-20 00:17:10 +0200
committerTectu <joel@unormal.org>2012-06-20 00:17:10 +0200
commit6a2a70e8e68d999e5b8cea74ef49b37e8be3aeda (patch)
treecf10a99441dd03da79bf8e19b2e5a7c0de838763
parentb3fedc8b80bed89957c02eedfb5af336a8399a4e (diff)
downloaduGFX-6a2a70e8e68d999e5b8cea74ef49b37e8be3aeda.tar.gz
uGFX-6a2a70e8e68d999e5b8cea74ef49b37e8be3aeda.tar.bz2
uGFX-6a2a70e8e68d999e5b8cea74ef49b37e8be3aeda.zip
added lcdSetPowerMode()
-rw-r--r--drivers/lcd/ssd1289_lld.c97
-rw-r--r--drivers/lcd/ssd1289_lld.h1
-rw-r--r--glcd.c4
-rw-r--r--glcd.h2
4 files changed, 62 insertions, 42 deletions
diff --git a/drivers/lcd/ssd1289_lld.c b/drivers/lcd/ssd1289_lld.c
index 5382dd27..cfacfb47 100644
--- a/drivers/lcd/ssd1289_lld.c
+++ b/drivers/lcd/ssd1289_lld.c
@@ -137,10 +137,23 @@ __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) {
}
#endif
-static __inline void lcdDelay(uint16_t us) {
+static __inline void lld_lcdDelay(uint16_t us) {
chThdSleepMicroseconds(us);
}
+void lld_lcdSetPowerMode(uint8_t powerMode) {
+ /* TODO */
+
+ switch(powerMode) {
+ case poweroff:
+ break;
+ case poweron:
+ break;
+ case standby:
+ break;
+ }
+}
+
void lld_lcdSetCursor(uint16_t x, uint16_t y) {
if(PORTRAIT) {
lld_lcdWriteReg(0x004e, x);
@@ -277,47 +290,47 @@ void lld_lcdInit(void) {
#endif
DeviceCode = lld_lcdReadReg(0x0000);
- lld_lcdWriteReg(0x0000,0x0001); lcdDelay(5);
- lld_lcdWriteReg(0x0003,0xA8A4); lcdDelay(5);
- lld_lcdWriteReg(0x000C,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x000D,0x080C); lcdDelay(5);
- lld_lcdWriteReg(0x000E,0x2B00); lcdDelay(5);
- lld_lcdWriteReg(0x001E,0x00B0); lcdDelay(5);
- lld_lcdWriteReg(0x0001,0x2B3F); lcdDelay(5);
- lld_lcdWriteReg(0x0002,0x0600); lcdDelay(5);
- lld_lcdWriteReg(0x0010,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0011,0x6070); lcdDelay(5);
- lld_lcdWriteReg(0x0005,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0006,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0016,0xEF1C); lcdDelay(5);
- lld_lcdWriteReg(0x0017,0x0003); lcdDelay(5);
- lld_lcdWriteReg(0x0007,0x0133); lcdDelay(5);
- lld_lcdWriteReg(0x000B,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x000F,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0041,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0042,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0048,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0049,0x013F); lcdDelay(5);
- lld_lcdWriteReg(0x004A,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x004B,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0044,0xEF00); lcdDelay(5);
- lld_lcdWriteReg(0x0045,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0046,0x013F); lcdDelay(5);
- lld_lcdWriteReg(0x0030,0x0707); lcdDelay(5);
- lld_lcdWriteReg(0x0031,0x0204); lcdDelay(5);
- lld_lcdWriteReg(0x0032,0x0204); lcdDelay(5);
- lld_lcdWriteReg(0x0033,0x0502); lcdDelay(5);
- lld_lcdWriteReg(0x0034,0x0507); lcdDelay(5);
- lld_lcdWriteReg(0x0035,0x0204); lcdDelay(5);
- lld_lcdWriteReg(0x0036,0x0204); lcdDelay(5);
- lld_lcdWriteReg(0x0037,0x0502); lcdDelay(5);
- lld_lcdWriteReg(0x003A,0x0302); lcdDelay(5);
- lld_lcdWriteReg(0x003B,0x0302); lcdDelay(5);
- lld_lcdWriteReg(0x0023,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0024,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x0025,0x8000); lcdDelay(5);
- lld_lcdWriteReg(0x004f,0x0000); lcdDelay(5);
- lld_lcdWriteReg(0x004e,0x0000); lcdDelay(5);
+ lld_lcdWriteReg(0x0000,0x0001); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0003,0xA8A4); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x000C,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x000D,0x080C); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x000E,0x2B00); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x001E,0x00B0); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0001,0x2B3F); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0002,0x0600); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0010,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0011,0x6070); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0005,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0006,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0016,0xEF1C); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0017,0x0003); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0007,0x0133); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x000B,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x000F,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0041,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0042,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0048,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0049,0x013F); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x004A,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x004B,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0044,0xEF00); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0045,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0046,0x013F); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0030,0x0707); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0031,0x0204); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0032,0x0204); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0033,0x0502); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0034,0x0507); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0035,0x0204); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0036,0x0204); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0037,0x0502); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x003A,0x0302); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x003B,0x0302); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0023,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0024,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x0025,0x8000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x004f,0x0000); lld_lcdDelay(5);
+ lld_lcdWriteReg(0x004e,0x0000); lld_lcdDelay(5);
}
uint16_t lld_lcdGetOrientation(void) {
diff --git a/drivers/lcd/ssd1289_lld.h b/drivers/lcd/ssd1289_lld.h
index 49e6d0f0..5462acd6 100644
--- a/drivers/lcd/ssd1289_lld.h
+++ b/drivers/lcd/ssd1289_lld.h
@@ -20,6 +20,7 @@ void lld_lcdSetWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void lld_lcdClear(uint16_t color);
void lld_lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color);
void lld_lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
+void lld_lcdSetPowerMode(uint8_t powerMode);
uint16_t lld_lcdGetPixelColor(uint16_t x, uint16_t y);
uint16_t lld_lcdGetOrientation(void);
uint16_t lld_lcdGetHeight(void);
diff --git a/glcd.c b/glcd.c
index 52318a0c..ec89a8d4 100644
--- a/glcd.c
+++ b/glcd.c
@@ -35,6 +35,10 @@ static void lcdSetCursor(uint16_t x, uint16_t y) {
lld_lcdSetCursor(x, y);
}
+void lcdSetPowerMode(uint8_t powerMode) {
+ lld_lcdSetPowerMode(powerMode);
+}
+
void lcdSetOrientation(uint8_t newOrientation) {
lld_lcdSetOrientation(newOrientation);
}
diff --git a/glcd.h b/glcd.h
index 29f92f68..0bf192a7 100644
--- a/glcd.h
+++ b/glcd.h
@@ -28,6 +28,7 @@
enum orientation {portrait, landscape, portraitInv, landscapeInv};
enum filled {frame, filled};
enum transparency {solid, transparent};
+enum powermode {poweroff, poweron, standby};
// For text rendering only
extern uint16_t bgcolor, fgcolor;
@@ -49,6 +50,7 @@ void lcdClear(uint16_t color);
void lcdSetOrientation(uint8_t newOrientation);
void lcdSetWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
+void lcdSetPowerMode(uint8_t powerMode);
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t point);
void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);