#include <stdio.h>
#include<CONIO.H>
#include "..\comp\lcd\lcdjtUr.h"

CLcdJitesUrne::CLcdJitesUrne(void)
{
    //ctor
}

CLcdJitesUrne::~CLcdJitesUrne(void)
{
    //dtor
}

/** @brief (one liner)
  *
  * (documentation goes here)
  */
int CLcdJitesUrne::Initialise(void)
{
    DisplayChar(3, 0x38);
    DisplayChar(3, 0x80);
    DisplayChar(3, 0x10);
    DisplayChar(3, 0x0F);
    DisplayChar(3, 0x01);
    DisplayChar(3, 0x06);
    return 0;
}

/** @brief (one liner)
  *
  * (documentation goes here)
  */
void CLcdJitesUrne::Display(int iLine, int iRow, char *pzString)
{
	DisplayScreen(iLine,  iRow, pzString);

    DisplayChar(3, (char) (0x80 | (iLine * 0x40 + iRow)));

    for (;*pzString;)
    {
        ++iRow;
        DisplayChar(1, *pzString++);
    }

    for (;++iRow < 21;)
        DisplayChar(1, ' ');
}


void CLcdJitesUrne::DisplayChar(unsigned char ucControle, unsigned char ucData)
{
    outp(eRegData, ucData);
    DelayLcd();
    outp(eRgControl, ucControle & 0x03);
    DelayLcd();
    outp(eRgControl, (ucControle & 0xFE) & 0x03);
    DelayLcd();
    outp(eRgControl, ucControle & 0x03);
    DelayLcd();
    outp(eRgControl, 0x03);
    DelayLcd();
}

/** @brief (one liner)
  *
  * (documentation goes here)
  */
int CLcdJitesUrne::DelayLcd(void)
{
    int i;
    for (i = 0; i < eWaitting; i++)
        ;

    return 0;
}
/** @brief (one liner)
  *
  * (documentation goes here)
  */
CLcd * CLcdJitesUrne::Instance(void)
{
    if(m_phInst == NULL)
    {
        m_phInst = new CLcdJitesUrne();
    }
    return m_phInst;
}


