コード例 #1
0
ファイル: Display.c プロジェクト: akirakudobmt/clase-zigbee
/******************************************************************************
* This function writes a string to the display
*
* Interface assumptions:
* The pstr must be zero-terminated.
*
* Return value:
* None
*
*
******************************************************************************/
void LCD_WriteString
  (
  uint8_t line,  /* IN: Line in display */
  uint8_t *pstr	 /* Pointer to text string */
  )
{
  uint8_t len;
  uint8_t x;
  uint8_t *error = "Wrong line 1 & 2";

  if( line == 2 ) {
    LCDLine(LineTwo);
  }
  else if ( line == 1 ) {
    LCDLine(LineOne);
    }
    else {
	  LCD_ClearDisplay();
	  LCDLine(LineOne);
      pstr = error;
    }

  len = GetStrlen(pstr);
  for ( x = 0; x < len; x++ ) {
    LCD_WriteChar( pstr[x] );
  }

  /* Clear the rest of the line */
  for ( ; x < gMAX_LCD_CHARS_c; x++ ) {
    LCD_WriteChar( ' ' );
  }
}
コード例 #2
0
void LCDRectangle (int x1, int y1, int x2, int y2) {  //draw a rectangle
   LCDLine (x1, y1, x1, y2);
   LCDLine (x1, y1, x2, y1);
   LCDLine (x2, y1, x2, y2);
   LCDLine (x1, y2, x2, y2);
   return;
}
コード例 #3
0
void LCDSolidRectangle (int x1, int y1, int x2, int y2) {  //draw a solid rectangle
  int i = 0;
   if (x2>x1)
      for (i=x1; i<=x2;i++)
         LCDLine (i, y1, i, y2);
   else for (i=x2; i<=x1;i++)
         LCDLine (i, y1, i, y2);
   return;
}
コード例 #4
0
ファイル: Display.c プロジェクト: akirakudobmt/clase-zigbee
void LCD_Init
  (
  void
  )
{
  LCDWaitLong( Wait5mSec ); 
  /* This function setup Bits 6-7 as outputs (EN & RS) (PTEDD) */
  Setup_EN_RS;
  /* Setup the XX Port (4-7 data bits, 3 R/W ) (PTGDD)
     data is output (default), r/w is output */
  SetupDataBit;
  /* Initialize data port */
  InitDataPort;
  /* Setup the R/W for writing (PTGD) */
  Setup_R_W_Write;
  /* Initialize EN and RS to 0 */
  Init_EN_RS;

  /* Send the reset sequence */
  LCD_Write4bits( 0x30 );
  LCDToggleEN;

  LCDWaitLong( Wait5mSec );

  LCD_Write4bits( 0x30 );
  LCDToggleEN;

  LCDWaitShort( Wait30uSec );

  LCD_Write4bits( 0x30 );
  LCDToggleEN;

  LCDWaitShort( Wait30uSec );

  LCD_Write4bits( 0x20 );
  LCDToggleEN;

  LCDWaitShort( Wait15uSec );

  /* Function, 4 bit data length */
  LCD_Write4bits( 0x20 );
  LCDToggleEN;

  LCDWaitShort( Wait15uSec );

  /* 2 lines, 5x7 dot format */
  LCD_Write4bits( 0x80 );
  LCDToggleEN;

  LCDWaitShort( Wait60uSec );

  /* Entry Mode Inc, No Shift */
  LCD_Write4bits( 0x00 );
  LCDToggleEN;
  LCDWaitShort( Wait15uSec );
  LCD_Write4bits( 0x60 );
  LCDToggleEN;
  LCDWaitShort( Wait75uSec );

  /* Display ON/OFF Control - Display On, Cursor Off, Blink Off */
  LCD_Write4bits( 0x00 );
  LCDToggleEN;
  LCDWaitShort( Wait15uSec );
  LCD_Write4bits( 0xC0 );
  LCDToggleEN;
  LCDWaitShort( Wait75uSec );

  /* Display Clear */
  LCD_ClearDisplay();

  LCDLine(LineOne);
}
コード例 #5
0
void LCDTriangle (int x1, int y1, int x2, int y2, int x3, int y3) {   //draw a triangle
   LCDLine (x1, y1, x2, y2);
   LCDLine (x2, y2, x3, y3);
   LCDLine (x3, y3, x1, y1);
   return;
}