Does anyone know how the grayscale palette register on EZ-driven devices
differ from the previous one? Is it on the same address?

Before posting the question, I searched the archives. There wasn't much for
this topic there and I am posting something that Edward Keyes sent me
directly, which could be of help to others browsing.

Thanks,
Bobby
www.beiks.com


The IIIx and V have a special 16-shade grayscale mode, which is presently
not supported by the PalmOS.  They also can do the standard 4-shade mode
which is somewhat supported, although the palette selection register is
changed a little bit.

Anyway, here's the routine for getting into the 16-shade mode:

void GraySwitchDisplayMode(short int mode, VoidPtr *bwaddr, VoidPtr
*grayaddr)
// This performs all the register accesses to switch between grayscale and
// black and  white modes.  The B&W and grayscale pointers are read and
write,
// depending on which direction the mode is switching to.
// (mode=1 is switch to grayscale, mode=0 is switch to black and white)
{
   ULong *SSA;
   unsigned char *VPW,*PICF,*FRCM,*LBAR,*CKCON;

   SSA=(ULong *)0xFFFFFA00;
   VPW=(unsigned char *)0xFFFFFA05;
   PICF=(unsigned char *)0xFFFFFA20;
   LBAR=(unsigned char *)0xFFFFFA29;
   CKCON=(unsigned char *)0xFFFFFA27;
   if (mode==1) { //switch to grayscale
      if ((*PICF & 0x02)==0) { // not already in grayscale mode
         *bwaddr=(VoidPtr)*SSA; //save old display starting address
         *CKCON=*CKCON & 0x7F; //switch off LCD update temporarily
         *SSA=(ULong)*grayaddr; //set new display starting address
         *VPW=40; //virtual page width now 80 bytes (160 pixels)
         *PICF=*PICF | 0x02; //switch to grayscale mode
         *LBAR=40; //line buffer now 80 bytes
         SysTaskDelay(3); //let the LCD get to a new frame (30ms delay)
         *CKCON=*CKCON | 0x80; //switch LCD back on in new mode
      }
   }
   else if (mode==0) { //switch to black and white
      if ((*PICF & 0x02)==0x02) { // not already in B&W mode
         *grayaddr=(VoidPtr)*SSA; //save old display starting address
         *CKCON=*CKCON & 0x7F; //switch off LCD update temporarily
         *SSA=(ULong)*bwaddr; //set new display starting address
         *VPW=10; //virtual page width now 20 bytes (160 pixels)
         *PICF=*PICF & 0xFD; //switch to black and white mode
         *LBAR=10; // line buffer now 20 bytes
         SysTaskDelay(3); //let the LCD get to a new frame (30ms delay)
         *CKCON=*CKCON | 0x80; //switch LCD back on in new mode
      }
   }
}

- Edward Keyes
  [EMAIL PROTECTED]
Bobby Kolev
Software Engineer,
Interactive Edge LLC.
email: [EMAIL PROTECTED]
work:   (212) 462 49000 ext.216, voice #257
----------------------------------------------------------------------
I never say never

Reply via email to