Revision 688c8ab5
-Display, setDisplay (untested)
tpf/display.c | ||
---|---|---|
1 | 1 |
#include "display.h" |
2 |
#include "tempo.h" |
|
2 | 3 |
#include <stdlib.h> |
3 | 4 |
#include <stdio.h> |
5 |
#include <lcd.h> |
|
6 |
#include "config.h" |
|
4 | 7 |
|
5 |
uint8_t setDisplay(char toDisplay)
|
|
8 |
uint8_t setDisplay(pse_time_t clock, int uint8_t power ,char[] Message)
|
|
6 | 9 |
{ |
7 |
return 0; |
|
10 |
int lcdHandler; |
|
11 |
uint8_t result; |
|
12 |
if(getLCDHandler(&lcdHandler)!=0) |
|
13 |
{ |
|
14 |
result=1; |
|
15 |
}else{ |
|
16 |
|
|
17 |
char horas[15]; |
|
18 |
char minutos[15]; |
|
19 |
char segundos[15]; |
|
20 |
char Power[15]; |
|
21 |
sprintf(horas, "%d", tempo.horas); |
|
22 |
sprintf(minutos, "%d", tempo.minutos); |
|
23 |
sprintf(segundos, "%d", tempo.segundos); |
|
24 |
sprintf(Power, "%d", power); |
|
25 |
result=0; |
|
26 |
if(Message) |
|
27 |
{ |
|
28 |
|
|
29 |
lcdPosition (lcdHandler, 0, 0) ; lcdPuts (lcdHandler,horas+":"+minutos+":"+segundos+" "+Power+" W") ; |
|
30 |
lcdPosition (lcdHandler, 0, 1) ; lcdPuts (lcdHandler,Message) ; |
|
31 |
|
|
32 |
|
|
33 |
}else{ |
|
34 |
|
|
35 |
lcdPosition (lcdHandler, 0, 0) ; lcdPuts (lcdHandler,horas+":"+minutos+":"+segundos+" "+Power+" W") ; |
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
}} |
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
//power |
|
44 |
|
|
45 |
|
|
46 |
//Message |
|
47 |
|
|
48 |
|
|
49 |
return result; |
|
8 | 50 |
} |
9 | 51 |
|
10 | 52 |
uint8_t clearDisplay() |
tpf/display.h | ||
---|---|---|
6 | 6 |
#include <stdio.h> |
7 | 7 |
|
8 | 8 |
/** |
9 |
* \brief Mostra no display a string recebida como argumento
|
|
9 |
* \brief Displays the values received, in this case, the time,power and if needed a message
|
|
10 | 10 |
* |
11 |
* \param toDisplay String a ser mostrada no display
|
|
11 |
* \param send a time as a pse_time_t, a uint8_t power and a message. If there is no need for a message, send a null char[]. The fuction returns 0 if success or !=0 if something failed
|
|
12 | 12 |
*/ |
13 |
uint8_t setDisplay(char toDisplay);
|
|
13 |
uint8_t setDisplay(pse_time_t clock, int uint8_t power,char[] Message);
|
|
14 | 14 |
|
15 | 15 |
|
16 | 16 |
/** |
17 | 17 |
* \brief Limpa o display |
18 | 18 |
* |
19 |
* \param returns 0 if sucess and !=0 if something failed |
|
19 | 20 |
*/ |
20 | 21 |
uint8_t clearDisplay(); |
21 | 22 |
|
Also available in: Unified diff