Subversion Repositories HomeAutomation

Rev

Rev 193 | Blame | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * Library for printing views on a 20x4 characters LCD
  3.  *
  4.  * Author: Erik Larsson
  5.  * Date: 2006-12-30
  6.  *
  7.  */
  8.  
  9. /*-----------------------------------------------------
  10.  * Includes
  11.  * --------------------------------------------------*/
  12. #include <stdio.h>
  13. #include <clcd20x4.h>
  14. #include <lcd_HD44780.h>
  15.  
  16. /*-----------------------------------------------------
  17.  * Functions
  18.  * --------------------------------------------------*/
  19.  
  20. /*
  21.  * Prints "view" to LCD
  22.  */
  23. void printLCDview(uint8_t view){
  24.     uint8_t line;
  25.     uint8_t buffer[ MAX_LENGTH ];
  26.     lcd_clrscr();
  27.  
  28.     view = view*5;
  29.  
  30.     /* Print first 3 lines */
  31.     for(line = 0; line < LINES-1; line++ ){
  32.         lcd_gotoxy(0,line);
  33.         lcd_puts( viewStrings[ view+line ] );
  34.     }
  35.  
  36.     /* Print bottom line */
  37.     lcd_gotoxy(0,3);
  38.     snprintf( buffer, MAX_LENGTH, "<<%s", viewStrings[ view+3 ] );
  39.     lcd_puts( buffer );
  40.  
  41.     lcd_gotoxy(9,3);
  42.     lcd_puts( EDIT_MODE_SYMBOL );
  43.  
  44.     lcd_gotoxy(18,3);
  45.     lcd_puts( ">>" );
  46.  
  47.     lcd_gotoxy(12,3);
  48.     lcd_puts( viewStrings[ view+4 ] );
  49.  
  50. }
  51.  
  52. /*
  53.  * Prints data to "view"
  54.  */
  55. void printLCDviewData(uint8_t view, uint8_t *data, uint8_t size){
  56.     int m;
  57.     char buffer[ MAX_LENGTH ];
  58.  
  59.     if( view==MAIN_VIEW ){
  60.  
  61.     }else if( view==TEMPSENS_VIEW ){
  62.  
  63.     }else if( view==RELAYS_VIEW ){
  64.  
  65.     }else if( view==DIMMERS_VIEW ){
  66.  
  67.     }else{
  68.         /* Do nothing */
  69.         return;
  70.     }
  71.  
  72.  
  73.  
  74.  
  75.     for( m=0; m<size; m++ ){
  76.         lcd_gotoxy( dataPos[m][0],dataPos[m][1] );
  77.  
  78.  
  79.         snprintf( buffer, MAX_LENGTH, data[ m ] );
  80.         lcd_puts(buffer);
  81.         //TODO fixa rätt enheter för olika views
  82.     }
  83. }
  84.