[Lcdproc] Re: lcdproc-0.5.1 and serialized HD44780 on k-data wake-up 2.0 module

Frank Jepsen lcdproc@jepsennet.de
Mon Jan 29 13:09:01 2007


Hello,

On Freitag, 19. Januar 2007 13:04 Peter Marschall wrote:
> > Was the patch from <http://www.jepsennet.de/vdr/html/lcdproc.html>
> > converted and integrated to the current lcdproc, i.e. the new unified
> > serial sub-driver for hd44780?
>
> No, the patch has not been included into LCDproc 0.5.1 yet.
> (Your mail is the first indication tat this patch exists ;-)
Perhaps you and/or your colleages were a bit busy with switching to V5.0 
when I posted then patch back in 2004.
Because I never got some response I published the patch on my website at 
http://www.jepsennet.de/vdr/html/lcdproc.html.

Here are the original posts:
http://article.gmane.org/gmane.comp.sysutils.lcdproc/9244
http://article.gmane.org/gmane.comp.sysutils.lcdproc/9245


For better understanding I copied the interesting code part from my 
firmware. I think it is very plain and self explaining:
----------------------------------------------------------------------------------
// Wakeup-LCD ASCII commands
#define WAKEUPLCD_MIN   0xC0
#define WAKEUPLCD_MAX   0xCF

#define WAKEUPLCD_LCDI  0xC0
#define WAKEUPLCD_LCDD  0xC4
#define WAKEUPLCD_BLON  0xC8
#define WAKEUPLCD_BLOFF 0xC9
#define WAKEUPLCD_END   0xCF
uint8_t lcdproc;
uint8_t lcdproc_relais;
uint8_t lcdproc_secs;
uint8_t lcdproc_deviceID;


void handle_lcdproc(void)
{
    int c;
    uint8_t retry;
    uint8_t rs;

    GetRTC();
    if (lcdproc && sec_timeout(lcdproc_secs,3)) // check for timeout
    {
        lcdproc=0;
        lcd_inituserchars();
        lcd_clrscr();
        if (lcdproc_relais) relais_off();
    }
    else while(1)
    {
        retry=0;
        rs=1;
        c=uart_peekc();                         // look at char in 
receive buffer
        if (c & UART_NO_DATA) break;
        if (WAKEUPLCD_MIN<=(uint8_t)c && (uint8_t)c<=WAKEUPLCD_MAX) // 
is LCDproc sending?
        {
            c=uart_getc();                      // get char from receive 
buffer
            if ((uint8_t)c == WAKEUPLCD_BLON)
            {
                lcdproc_relais=1;
                relais_on();
                return;
            }
            else if ((uint8_t)c == WAKEUPLCD_BLOFF)
            {
                relais_off();
                return;
            }
            else if ((uint8_t)c == WAKEUPLCD_END)
            {
                lcdproc=0;
                lcd_inituserchars();
                delay_us(20000);
                lcd_clrscr();
                if (lcdproc_relais) relais_off();
                return;
            }
            else
            {
                if (!lcdproc)
                {
                    lcd_clrscr();
                    lcdproc = 1;
                }
                lcdproc_secs=rtc.seconds;
                lcdproc_deviceID = c & 3;
                if (((uint8_t)c & 0xFC) == WAKEUPLCD_LCDI) rs=0;
                while (1)
                {
                    c=uart_getc();                      // get char from 
receive buffer
                    if (c & UART_NO_DATA)               // if no data 
make one retry after 5ms
                    {
                        if (retry++) return;
                        delay_us(5000);
                    }
                    else break;
                }
            }
        }
        else if (lcdproc) c=uart_getc();                // get char from 
receive buffer
        else return;
        if (rs || ((uint8_t)c<=0x03 || (uint8_t)c>=0x40))
        {
            lcd_write((uint8_t)c, rs, lcdproc_deviceID);
        }
    }
}
----------------------------------------------------------------------------------

I hope this helps. As you can see backlight is switched with 
WAKEUPLCD_BLON 0xC8 and WAKEUPLCD_BLOFF 0xC9. Also the backlight is 
switched of when WAKEUPLCD_END 0xCF is received or no commands from 
LCDproc are received for three seconds. Then the display goes to offline 
mode where only time and date is displayed.

I am very pleased that my patch finally makes it into the CVS. I never 
had time to port my patch to the current LCDproc version.

Bye Frank