added lcdInvert

added possibility to output the display buffer inverted
This commit is contained in:
bsx 2011-05-22 17:48:02 +02:00
parent 4618351462
commit f9cb3d0992
3 changed files with 21 additions and 4 deletions

View File

@ -30,6 +30,7 @@ void delayms(uint32_t ms)
/**************************************************************************/ /**************************************************************************/
uint8_t lcdBuffer[RESX*RESY_B]; uint8_t lcdBuffer[RESX*RESY_B];
int inverted = 0;
/* /*
//TODO FIXME why doenst that work ? //TODO FIXME why doenst that work ?
@ -160,7 +161,16 @@ void lcdDisplay(uint32_t shift)
uint16_t i,page; uint16_t i,page;
for(page=0; page<RESY_B;page++) { for(page=0; page<RESY_B;page++) {
for(i=0; i<RESX; i++) { for(i=0; i<RESX; i++) {
if (inverted) {
lcdWrite(1,~lcdBuffer[page*RESX+((i+shift)%RESX)]);
} else {
lcdWrite(1,lcdBuffer[page*RESX+((i+shift)%RESX)]); lcdWrite(1,lcdBuffer[page*RESX+((i+shift)%RESX)]);
} }
} }
}
} }
void lcdInvert(void) {
inverted = ~inverted;
}

View File

@ -22,5 +22,6 @@ void lcdRead(uint8_t data);
void lcdInit(void); void lcdInit(void);
void lcdFill(char f); void lcdFill(char f);
void lcdDisplay(uint32_t shift); void lcdDisplay(uint32_t shift);
void lcdInvert(void);
#endif #endif

View File

@ -32,20 +32,25 @@ void module_bsx(void) {
brightness++; brightness++;
if (brightness > 100) brightness = 100; if (brightness > 100) brightness = 100;
backlightSetBrightness(brightness); backlightSetBrightness(brightness);
}; }
if(gpioGetValue(RB_BTN0)==0){ if(gpioGetValue(RB_BTN0)==0){
brightness--; brightness--;
if (brightness > 100) brightness = 0; if (brightness > 100) brightness = 0;
backlightSetBrightness(brightness); backlightSetBrightness(brightness);
}; }
if (gpioGetValue(RB_BTN3) == 0) {
while(gpioGetValue(RB_BTN3)==0);
lcdInvert();
}
if (gpioGetValue(RB_BTN4)==0) { if (gpioGetValue(RB_BTN4)==0) {
while(gpioGetValue(RB_BTN4)==0); while(gpioGetValue(RB_BTN4)==0);
DoString(0,8,"Enter ISP!"); DoString(0,8,"Enter ISP!");
lcdDisplay(0); lcdDisplay(0);
ReinvokeISP(); ReinvokeISP();
}; }
dx = DoString(0, yctr, "Bright:"); dx = DoString(0, yctr, "Bright:");
dx = DoInt(dx, yctr, brightness); dx = DoInt(dx, yctr, brightness);
@ -72,3 +77,4 @@ void module_bsx(void) {
return; return;
} }