Merge branch 'master' of github.com:r0ket/r0ket

Conflicts:
	firmware/basic/config.c
This commit is contained in:
Stefan `Sec` Zehl 2011-08-01 05:05:47 +02:00
commit d5e93a1fca
4 changed files with 55 additions and 3 deletions

View File

@ -17,7 +17,7 @@ struct CDESC the_config[]= {
{"lcdbacklight", 50, 0, 100}, {"lcdbacklight", 50, 0, 100},
{"lcdmirror", 0, 0, 1 }, {"lcdmirror", 0, 0, 1 },
{"lcdinvert", 0, 0, 1 }, {"lcdinvert", 0, 0, 1 },
{"lcdcontrast", 0, 1, 6 }, {"lcdcontrast", 3, 0, 31 },
{ NULL, 0, 0, 0 }, { NULL, 0, 0, 0 },
}; };

View File

@ -66,6 +66,7 @@ int selectFile(char *filename, char *extension)
} }
lcdRefresh(); lcdRefresh();
key=getInputWait(); key=getInputWait();
getInputWaitRelease();
if( key==BTN_DOWN ){ if( key==BTN_DOWN ){
if( selected < count-1 ){ if( selected < count-1 ){
selected++; selected++;

View File

@ -62,6 +62,55 @@ static void lcdWrite(uint8_t cd, uint8_t data) {
frame = SSP_SSP0DR; frame = SSP_SSP0DR;
} }
#define CS 2,1
#define SCK 2,11
#define SDA 0,9
#define RST 2,2
uint8_t lcdRead(uint8_t data)
{
uint8_t i;
gpioSetDir(SDA, 1);
gpioSetValue(SCK, 0);
delayms(1);
gpioSetValue(CS, 0);
delayms(1);
gpioSetValue(SDA, 0);
delayms(1);
gpioSetValue(SCK, 1);
delayms(1);
for(i=0; i<8; i++){
gpioSetValue(SCK, 0);
delayms(1);
if( data & 0x80 )
gpioSetValue(SDA, 1);
else
gpioSetValue(SDA, 0);
data <<= 1;
gpioSetValue(SCK, 1);
delayms(1);
}
uint8_t ret = 0;
gpioSetDir(SDA, 0);
for(i=0; i<8; i++){
gpioSetValue(SCK, 0);
delayms(1);
ret <<= 1;
ret |= gpioGetValue(SDA);
gpioSetValue(SCK, 1);
delayms(1);
}
gpioSetValue(CS, 0);
gpioSetDir(SDA, 1);
delayms(1);
}
void lcdInit(void) { void lcdInit(void) {
sspInit(0, sspClockPolarity_Low, sspClockPhase_RisingEdge); sspInit(0, sspClockPolarity_Low, sspClockPhase_RisingEdge);
@ -173,8 +222,9 @@ inline void lcdInvert(void) {
} }
void lcdSetContrast(int c) { void lcdSetContrast(int c) {
c+=0x20; c+=0x80;
if(c>0x2e) c=0x24; if(c>0x9F)
return;
lcd_select(); lcd_select();
lcdWrite(TYPE_CMD,c); lcdWrite(TYPE_CMD,c);
lcd_deselect(); lcd_deselect();

View File

@ -20,6 +20,7 @@
/* Display buffer */ /* Display buffer */
extern uint8_t lcdBuffer[RESX*RESY_B]; extern uint8_t lcdBuffer[RESX*RESY_B];
uint8_t lcdRead(uint8_t data);
void lcdInit(void); void lcdInit(void);
void lcdFill(char f); void lcdFill(char f);
void lcdDisplay(void); void lcdDisplay(void);