Subversion Repositories HomeAutomation

Rev

Rev 193 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 193 Rev 196
Line -... Line 1...
-
 
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
 * --------------------------------------------------*/
1
#include <stdio.h>
12
#include <stdio.h>
2
#include <clcd20x4.h>
13
#include <clcd20x4.h>
-
 
14
#include <lcd_HD44780.h>
-
 
15
 
-
 
16
/*-----------------------------------------------------
-
 
17
 * Functions
-
 
18
 * --------------------------------------------------*/
3
 
19
 
4
/*
20
/*
5
 * Prints "view" to LCD
21
 * Prints "view" to LCD
6
 */
22
 */
7
 
-
 
8
void printLCDview(uint8_t view){
23
void printLCDview(uint8_t view){
9
    uint8_t line;
24
    uint8_t line;
10
    uint8_t buffer[ MAX_LENGTH ];
25
    uint8_t buffer[ MAX_LENGTH ];
11
    lcd_clrscs();
26
    lcd_clrscr();
12
 
27
 
13
    view = view*5;
28
    view = view*5;
14
 
29
 
15
    /* Print first 3 lines */
30
    /* Print first 3 lines */
16
    for(line = 0; line < LINES-1; line++ ){
31
    for(line = 0; line < LINES-1; line++ ){
17
        lcd_gotoxy(0,line);
32
        lcd_gotoxy(0,line);
18
        lcd_puts( viewStrings[ view+line ] );
33
        lcd_puts( viewStrings[ view+line ] );
19
    }
34
    }
20
 
35
 
21
    /* Print bottom line */
36
    /* Print bottom line */
22
    lcd_gotoxy(0,3);
37
    lcd_gotoxy(0,3);
23
    snprintf( buffer, MAX_LENGTH, "<<%s", viewStrings[ view+3 ] );
38
    snprintf( buffer, MAX_LENGTH, "<<%s", viewStrings[ view+3 ] );
24
    lcd_puts( buffer );
39
    lcd_puts( buffer );
25
 
40
 
26
    lcd_gotoxy(9,3);
41
    lcd_gotoxy(9,3);
27
    lcd_puts( EDIT_MODE_SYMBOL );
42
    lcd_puts( EDIT_MODE_SYMBOL );
28
 
43
 
29
    lcd_gotoxy(18,3);
44
    lcd_gotoxy(18,3);
30
    lcd_puts( ">>" );
45
    lcd_puts( ">>" );
31
 
46
 
32
    lcd_gotoxy(12,3);
47
    lcd_gotoxy(12,3);
33
    lcd_puts( viewStrings[ view+4 ] );
48
    lcd_puts( viewStrings[ view+4 ] );
34
 
49
 
35
}
50
}
36
 
51
 
-
 
52
/*
37
void printLCDviewData(){
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
 
38
 
78
 
-
 
79
        snprintf( buffer, MAX_LENGTH, data[ m ] );
-
 
80
        lcd_puts(buffer);
-
 
81
        //TODO fixa rätt enheter för olika views
-
 
82
    }
39
}
83
}