added lcdSetPowerMode()

This commit is contained in:
Tectu 2012-06-20 00:17:10 +02:00
parent b3fedc8b80
commit 6a2a70e8e6
4 changed files with 62 additions and 42 deletions

View File

@ -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) {

View File

@ -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);

4
glcd.c
View File

@ -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);
}

2
glcd.h
View File

@ -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);