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},
{"lcdmirror", 0, 0, 1 },
{"lcdinvert", 0, 0, 1 },
{"lcdcontrast", 0, 1, 6 },
{"lcdcontrast", 3, 0, 31 },
{ NULL, 0, 0, 0 },
};

View File

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

View File

@ -62,6 +62,55 @@ static void lcdWrite(uint8_t cd, uint8_t data) {
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) {
sspInit(0, sspClockPolarity_Low, sspClockPhase_RisingEdge);
@ -173,8 +222,9 @@ inline void lcdInvert(void) {
}
void lcdSetContrast(int c) {
c+=0x20;
if(c>0x2e) c=0x24;
c+=0x80;
if(c>0x9F)
return;
lcd_select();
lcdWrite(TYPE_CMD,c);
lcd_deselect();

View File

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