Esempio n. 1
0
unsigned int LCD_GRAPH_Home(void)
{
	LCD_writeByte(LCD_DATA_REG,0x00);
	LCD_writeByte(LCD_DATA_REG,0x00);
        return(0);

}
Esempio n. 2
0
//------------------------------------------------------------------------------
//Puts a bit map to LCD
void LCD_drawFullBMP(uint8_t* bitmap)
{  
  uint8_t page,j;  
  for (page=0;page<LCD_LINES/LCD_PAGE_HEIGHT;page++){      
    LCD_setCursorXY(0,page*LCD_PAGE_HEIGHT);
    for (j=0;j<LCD_LINE_LENGTH;j++){              
      LCD_writeByte(pgm_read_byte(&bitmap[page*LCD_LINE_LENGTH+j]));
    }
  }
  
}
Esempio n. 3
0
unsigned int LCD_writeString(uint8_t* Buf, uint16_t bufferLen, uint32_t charDelay)
{
	uint16_t bufferIndex;

	if(bufferLen<=LCD_BUF_LENGTH)
	{
		for (bufferIndex = NO_ZERO; bufferIndex < bufferLen+1; bufferIndex++)
		{
			LCD_writeByte(LCD_DATA_REG, Buf[bufferIndex] - 0x20);
		}
		return (ERR_NO_ERROR);
	}

	else
	{
		for (bufferIndex = 0; bufferIndex < bufferLen+1; bufferIndex++)
		{
			LCD_writeByte(LCD_DATA_REG, Buf[bufferIndex]);
		}
	}
 return(0);
}
Esempio n. 4
0
//-----------------------------------------------------------------------
//put a graphical glyph on screen defined by font created with  
// created with FontCreator written by F. Maximilian Thiele
//  http://www.apetech.de/fontCreator
//
void LCD_putgchar(uint8_t c, uint8_t* font)
{
  uint8_t i,j,page,data;
  uint8_t x0=LCD_currentX;
  uint8_t y0=LCD_currentY;
  uint16_t index=0;
  uint8_t width=0;

  //see font definition .h file for data struct
  uint8_t height=pgm_read_byte(font+3);
  uint8_t bytes=(height+7)/8;
  uint8_t firstChar=pgm_read_byte(font+4); 
  uint8_t charCount=pgm_read_byte(font+5);

  if (c<firstChar || c>firstChar+charCount) return;
  
  c-=firstChar;

  for(i=0;i<c;i++)
    index+=pgm_read_byte(font+6+i); //6==font width table

  index=index*bytes+charCount+6;
  width=pgm_read_byte(font+6+c);

  for(i=0;i<bytes;i++){
    page=i*width;
    for(j=0;j<width;j++){
      data=pgm_read_byte(font+index+page+j);
      if(height<(i+1)*8)
	data >>= (i+1)*8-height;
      LCD_writeByte(data);
    }
    LCD_writeByte(0x00);
    LCD_setCursorXY(LCD_currentX-width-1,LCD_currentY+8);    
  }
  LCD_setCursorXY(x0+width+1,y0);

  
}
Esempio n. 5
0
unsigned int Gpio_init(void)
{
  int status;
  printk("Inside Gpio_init\n");
  status = gpio_request(DA850_LCD_RESET_PIN, "lcd_reset\n");
  if(status <0)
      printk("\n Error in gpio request for lcd_reset");
  status = gpio_request(DA850_LCD_MODE_PIN, "lcd_mode\n");
  if(status<0)
	   printk("\n Error in gpio request for lcd_mode\n");
  status = gpio_request(DA850_LCD_FS_PIN, "lcd_fs\n");
  if(status<0)
	   printk("\n Error in gpio request for lcd_fs\n");
  gpio_direction_output(DA850_LCD_RESET_PIN, 0);
  gpio_direction_output(DA850_LCD_MODE_PIN,  0);
  gpio_direction_output(DA850_LCD_FS_PIN, 0);
  printk("After Gpio_direction\n");
  LCD_writeByte(LCD_INST_REG, 0x00);
  return(0);
	
}
Esempio n. 6
0
void drawTest(int type){
  uint8_t i,j;
  
  uint8_t menuStrings[5][8] = {"Menu1\0","Menu2\0","Menu3\0","Menu4\0","Menu5\0"};
  
  switch (type){

  case 0: //simple text on screen
    LCD_clr();
    LCD_setCursorXY(15,0);
    LCD_puts ((uint8_t*)"Hello AVR world!\0");
    LCD_putsp((uint8_t*)"This LCD uses KS0107\0",3,3);
    LCD_putsp((uint8_t*)"Too long paged text is wrapped automatically\0",5,3);
    wait_100x_ms(30);
    break;

  case 1: //some of the drawing functions
    LCD_clr();
    LCD_drawLine(0,0,127,63);
    LCD_drawLine(0,63,127,0);
    LCD_drawRect(10,10,117,53);
    LCD_fillCirc(63,31,15);
    wait_100x_ms(20);

    break;

  case 2: //write on screen byte by byte
     for(j=0;j<8;j++){
	LCD_setCursorXY(0,j*8);
	for(i=0;i<LCD_LINE_LENGTH/4;i++){	  
	  LCD_writeByte(0b00110011);
	  LCD_writeByte(0b00110011);
	  LCD_writeByte(0b11001100);
	  LCD_writeByte(0b11001100);
	}
     }
    wait_100x_ms(20);
    break;

  case 3: //scrolling text up->down
    LCD_clr();
    LCD_setCursorXY(0,0);
    LCD_puts((uint8_t*)"Scrolling text\n goes here..!\0");      
    i=63;
    j=110;
    while(j>0){
      _delay_ms(30);      
      LCD_selectLeftChip();
      LCD_setInitialLineAddress(i);
      LCD_selectRightChip();
      LCD_setInitialLineAddress(i);
      if (i==0) i=63;
      else i--;
      j--;
    }
    LCD_clr();
    LCD_selectLeftChip();
    LCD_setInitialLineAddress(0);
    LCD_selectRightChip();
    LCD_setInitialLineAddress(0);
    break;

  case 4:  //using invert for menus
    
    for(i=0;i<5;i++){
      LCD_putsp(menuStrings[i],i+1,25);
    }
    j=2;
    while(j--){
      LCD_invertPage(1,20,58);
      wait_100x_ms(3);
      for(i=0;i<5;i++){      
	wait_100x_ms(3);
	LCD_invertPage(i+1,20,58);
	if(i<4)
	  LCD_invertPage(i+2,20,58);
	wait_100x_ms(3);
      }
    }
    break;

  case 5: //read status (on /off)
    j=4;
    while(j--){
      LCD_clr();
      if(!LCD_isOff()){
	LCD_putsp((uint8_t*)"LCD is On\0",1,10);
	wait_100x_ms(5);
	LCD_off();
      }
      else {
	wait_100x_ms(5);
	LCD_on();
	LCD_putsp((uint8_t*)"LCD was Off\0",1,10);
	wait_100x_ms(5);
      }
    }
    break;

  case 6: //"progress bar"
    LCD_clr();
    LCD_drawRect(5,5,122,58);
    LCD_putsp((uint8_t*)"Prosessing...\0",2,16);
    LCD_drawRect(10,30,113,41);

    for(j=0;j<100;j++){     
      LCD_setCursorXY(12+j,32);
      LCD_writeByte(0xff);
      wait_100x_ms(1); 
    }
    LCD_putsp((uint8_t*)"Done!        \0",2,16);
    wait_100x_ms(10);
    break;

  case 7:
    LCD_clr();
    LCD_drawFullBMP(girl_1_glcd_bmp);
    wait_100x_ms(20);
    break;

  case 8:
    i=0b10101010;
    LCD_clr();
    LCD_drawBMP((uint8_t*)atmel_glcd_bmp, 12, 12, 
		  ATMEL_GLCD_WIDTH,ATMEL_GLCD_HEIGHT);

    wait_100x_ms(20);
    break;

  case 9:
    LCD_clr();
    
    LCD_putgstr((uint8_t*)"Corsiva 12 test", Corsiva_12,10,10);
    LCD_putgstr((uint8_t*)"qwertyhjkl12345", Corsiva_12,12,30);
    
    //    LCD_putgstr((uint8_t*)"putgstr() test",Arial_Bold_14,10,10);
    //LCD_putgstr((uint8_t*)"1q2w3e4r5t6y8u9i0l",Arial_Bold_14,10,30);

    wait_100x_ms(20);
  }
}
Esempio n. 7
0
unsigned int LCD_Test(void)
{
	unsigned char low_byte1;
	unsigned char x, y;
	int i=1;
	//write text home address=0000h
	LCD_writeByte(LCD_DATA_REG, 0x00);
	LCD_writeByte(LCD_DATA_REG, 0x00);
	LCD_writeByte(LCD_INST_REG , 0x40);
	//write text area address
	low_byte1	=128 /8;
	LCD_writeByte(LCD_DATA_REG, low_byte1);
	LCD_writeByte(LCD_DATA_REG, 0x00);
	LCD_writeByte(LCD_INST_REG , 0x41);
	//set display mode Display mode set (Graphic only enable)
	LCD_writeByte(LCD_INST_REG , 0x80);
	LCD_writeByte(LCD_INST_REG , 0x94);
	
	
	//set character on graphics off
	LCD_writeByte(LCD_INST_REG , 0x94);
	LCD_writeByte(LCD_DATA_REG, 0x00);
	LCD_writeByte(LCD_DATA_REG, 0x00);
	//set address pointer
	LCD_writeByte(LCD_INST_REG , 0x24);
	//set auto write
	LCD_writeByte(LCD_INST_REG , 0xB0);
    //lcd_write(LCD_DATA_REG, 0x21);
	for (y=0; y<64/8;y++)
	{
		for (x=0; x<128/8;x++)
		{
	
		    LCD_writeByte(LCD_DATA_REG, i);
	
			if(i<128)
			{
				i++;
			}
		    else
			{
		    	i=33;
		    }
	
		}
	}
	
	//set auto write reset
	LCD_writeByte(LCD_INST_REG , 0xB2);
        return(0);
	
}
Esempio n. 8
0
unsigned int LCD_TextArea(void)
{
	LCD_writeByte(LCD_DATA_REG,0x15);
	LCD_writeByte(LCD_DATA_REG,0x00);
        return(0);
}
Esempio n. 9
0
unsigned int LCD_TextHome(void)
{
	LCD_writeByte(LCD_DATA_REG,0x40);
	LCD_writeByte(LCD_DATA_REG,0x05);
        return(0);
}