/**
Wrtie some text on screen
**/
void lcd_text(char *s)
{
	SetChrMode();
	while(*s)
	lcd_byte(*s++);
	SetCmdMode();
}
Exemplo n.º 2
0
Arquivo: lcd.c Projeto: abyman/garage
void lcd_text(mraa_gpio_context *g, char *s, int line)
{
   SetCmdMode(g); // set to cmd mode to send line cmd
   if(line == 1) 
      lcd_byte(g, 0x80); // line 1
   else
      lcd_byte(g, 0xC0); // line 2
   SetChrMode(g); // set to char mode to send text
   while(*s) 
      lcd_byte(g, *s++);
}
/**
 * This method is called periodically to have the display in a correct state
 no matter the random interference that could happen from time to time.
 **/
void resetLcd(){
	#ifndef PROD
	printf("Reset LCD\n");
	#endif

	SetCmdMode(); // set for commands
	lcd_byte(0x0C); // display on, cursor off, blink off
	lcd_byte(0x01);  // clear screen
	delay(10);        // clear screen is slow!

}
Exemplo n.º 4
0
int main (int argc, char *argv []) 
{
  lcd_init();
  
  SetChrMode(); 
  lcd_text("hello world!");
  SetCmdMode();
  lcd_gotoxy(1,2);
  SetChrMode();
  lcd_text("Luis");
  return 0 ;
}
/**
Init the screen
**/
void lcd_init()
{
	#ifndef PROD
	printf("Full reset LCD\n");
	#endif
	SetCmdMode(); // set for commands
	lcd_byte(0x33); // full init
	lcd_byte(0x32); // 4 bit mode
	lcd_byte(0x28); // 2 line mode
	lcd_byte(0x0C); // display on, cursor off, blink off
	lcd_byte(0x01);  // clear screen
	delay(10);        // clear screen is slow!
}
Exemplo n.º 6
0
void lcd_init()
{
   wiringPiSetup() ; // use BCIM numbering
   // set up pi pins for output
   pinMode (LCD_E,  OUTPUT);
   pinMode (LCD_RS, OUTPUT);
   pinMode (LCD_D4, OUTPUT);
   pinMode (LCD_D5, OUTPUT);
   pinMode (LCD_D6, OUTPUT);
   pinMode (LCD_D7, OUTPUT);
   
   // initialise LCD
   SetCmdMode(); // set for commands
   lcd_byte(0x33); // full init 
   lcd_byte(0x32); // 4 bit mode
   lcd_byte(0x28); // 2 line mode
   lcd_byte(0x0C); // display on, cursor off, blink off
   lcd_byte(0x01);  // clear screen
   delay(3);        // clear screen is slow!
}
Exemplo n.º 7
0
Arquivo: lcd.c Projeto: abyman/garage
void lcd_init(mraa_gpio_context *g)
{
   // set up pi pins for output
   g[0] = mraa_gpio_init(LCD_E);
   g[1] = mraa_gpio_init(LCD_RS);
   g[2] = mraa_gpio_init(LCD_D4);
   g[3] = mraa_gpio_init(LCD_D5);
   g[4] = mraa_gpio_init(LCD_D6);
   g[5] = mraa_gpio_init(LCD_D7);
   for(int i = 0; i < 6; i++) { 
      mraa_gpio_dir(g[i], MRAA_GPIO_OUT);
   }
   // initialise LCD
   SetCmdMode(g); // set for commands
   lcd_byte(g,0x33); // 2 line mode
   lcd_byte(g,0x32); // 2 line mode
   lcd_byte(g,0x06); // 2 line mode
   lcd_byte(g,0x0C); // 2 line mode
   lcd_byte(g,0x28); // display on, cursor off, blink off
   lcd_byte(g,0x01);  // clear screen
   usleep(3000);       // clear screen is slow!
   SetChrMode(g);
}
/*
Return at the begining of the line
*/
void goHome(){
	SetCmdMode(); // set for commands
	lcd_byte(lcd_Home);  // go home screen
	delay(7);        // You cannot write directly after putting the cursor at the 
	//beginning of the line. You have to wait for some time before it
}