Project

General

Profile

Revision 6d70682c

ID6d70682cdefdadb756586af26674f343126c9bed
Parent 6c30c8f9
Child d07266e1

Added by RicardoSilva91 almost 7 years ago

setdisplay tested, working

View differences:

tpf/display.c
8 8

  
9 9
#ifdef LCD_NOT_SEG
10 10

  
11
uint8_t setDisplayLCD(pse_time_t clock, uint16_t power, char* message)
11
static int lcdHandler;
12
static pse_time_t LCDClock;
13
static uint16_t LCDppower;
14

  
15
uint8_t setDisplay(pse_time_t clock, uint16_t power, char* message)
12 16
{
13
    int lcdHandler;
14 17
    uint8_t result;
15 18
    
16 19
    if(getLCDHandler(&lcdHandler)!=0)
......
84 87
    return result;
85 88
}
86 89

  
87
uint8_t clearDisplayLCD()
90
uint8_t clearDisplay()
91
{
92
    return 0;
93
}
94

  
95

  
96
uint8_t setDisplayTime(pse_time_t clock)
88 97
{
98
    LCDClock.horas = clock.horas;
99
    LCDClock.minutos = clock.minutos;
100
    LCDClock.segundos = clock.segundos;
101
    
89 102
    return 0;
90 103
}
91 104

  
105
uint8_t setDisplayPower(uint16_t power)
106
{
107
    uint8_t result=0;
108
    
109
    LCDppower = power;
110
    
111
    return result;
112
}
113

  
114
uint8_t showDisplay()
115
{
116
    //returned variable
117
    uint8_t result = 0;
118
    
119
    //clear previous displayed values
120
    lcdPosition (lcdHandler, 0, 0) ; lcdPuts (lcdHandler,"                ");
121
    lcdPosition (lcdHandler, 0, 1) ; lcdPuts (lcdHandler,"                ");
122
    
123
    //char arrays to contain values
124
    char horas[2];
125
    char minutos[2];
126
    char segundos[2];
127
    char powerChar[3];
128

  
129
    //read the values from static variables
130
    sprintf(horas, "%02d", LCDClock.horas);
131
    sprintf(minutos, "%02d", LCDClock.minutos);
132
    sprintf(segundos, "%02d", LCDClock.segundos);
133
    sprintf(powerChar, "%03d", LCDppower);
134
    
135
    //show time values on the left
136
    lcdPosition(lcdHandler, 0, 0);
137
    lcdPuts(lcdHandler, horas);
138
    //lcdPosition (lcdHandler, 2, 0) ; 
139
    lcdPutchar(lcdHandler, ':');
140
    //lcdPosition (lcdHandler, 3, 0) ; 
141
    lcdPuts(lcdHandler, minutos);
142
    //lcdPosition (lcdHandler, 5, 0) ; 
143
    lcdPutchar(lcdHandler, ':');
144
    //lcdPosition (lcdHandler, 6, 0) ; 
145
    lcdPuts(lcdHandler, segundos);
146

  
147
    //show power values on the right
148
    lcdPosition(lcdHandler, 12, 0);
149
    lcdPuts(lcdHandler, powerChar);
150
    lcdPosition(lcdHandler, 15, 0);
151
    lcdPutchar(lcdHandler, 'W');
152
  
153
    
154
    return result;
155
}
156

  
157
uint8_t initDisplay()
158
{
159
    uint8_t result = 0;
160
    
161
    if(getLCDHandler(&lcdHandler)!=0)
162
    {
163
        result=1;
164
    }
165
    
166
    return result;
167
}
168

  
169

  
170

  
171

  
172

  
92 173

  
93 174
#endif

Also available in: Unified diff