Fix lcdRead().

reading ID1/ID2/ID3/VM appears to work. reading ID4 or TEMP hangs/crashes the display. Currently no idea why.
This commit is contained in:
Stefan `Sec` Zehl 2011-08-22 01:19:42 +02:00
parent 0b51bdbd42
commit a22c2dd60b
1 changed files with 13 additions and 5 deletions

View File

@ -70,19 +70,23 @@ static void lcdWrite(uint8_t cd, uint8_t data) {
#define SDA 0,9 #define SDA 0,9
#define RST 2,2 #define RST 2,2
#ifdef NOTYET
uint8_t lcdRead(uint8_t data) uint8_t lcdRead(uint8_t data)
{ {
uint32_t op211cache=IOCON_PIO2_11;
uint32_t op09cache=IOCON_PIO0_9;
uint32_t dircache=GPIO_GPIO2DIR;
IOCON_PIO2_11=IOCON_PIO2_11_FUNC_GPIO|IOCON_PIO2_11_MODE_PULLUP;
IOCON_PIO0_9=IOCON_PIO0_9_FUNC_GPIO|IOCON_PIO0_9_MODE_PULLUP;
gpioSetDir(SCK, 1);
uint8_t i; uint8_t i;
gpioSetDir(SDA, 1); gpioSetDir(SDA, 1);
gpioSetValue(SCK, 0); gpioSetValue(SCK, 0);
delayms(1);
gpioSetValue(CS, 0); gpioSetValue(CS, 0);
delayms(1); delayms(1);
gpioSetValue(SDA, 0); gpioSetValue(SDA, 0);
delayms(1);
gpioSetValue(SCK, 1); gpioSetValue(SCK, 1);
delayms(1); delayms(1);
@ -108,12 +112,16 @@ uint8_t lcdRead(uint8_t data)
gpioSetValue(SCK, 1); gpioSetValue(SCK, 1);
delayms(1); delayms(1);
} }
gpioSetValue(SCK, 0);
gpioSetValue(CS, 0); gpioSetValue(CS, 1);
gpioSetDir(SDA, 1); gpioSetDir(SDA, 1);
IOCON_PIO2_11=op211cache;
IOCON_PIO0_9=op09cache;
GPIO_GPIO2DIR=dircache;
delayms(1); delayms(1);
return ret;
} }
#endif
void lcdInit(void) { void lcdInit(void) {