Project

General

Profile

Revision 65489db4

ID65489db409f7333c821402ce224de0db244a2010
Parent ca430a12
Child 6c30c8f9

Added by RicardoSilva91 almost 7 years ago

setdisplay tested, working

View differences:

tpf/display.c
1
#include "display.h"
2
#include "tempo.h"
3 1
#include <stdlib.h>
2
#include <stdint.h>
4 3
#include <stdio.h>
5 4
#include <lcd.h>
5
#include "display.h"
6
#include "tempo.h"
6 7
#include "config.h"
7 8

  
8
uint8_t setDisplay(pse_time_t clock, int uint8_t power ,char[] Message)
9
uint8_t setDisplay(pse_time_t clock, uint16_t power, char* message)
9 10
{
10 11
    int lcdHandler;
11 12
    uint8_t result;
13
    
12 14
    if(getLCDHandler(&lcdHandler)!=0)
13 15
    {
14
         result=1;
15
    }else{
16
    
17
    char horas[3];
18
    char minutos[3];
19
    char segundos[3];
20
    char Power[5];
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)
16
        result=1;
17
    }
18
    else
27 19
    {
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 20
        
21
        lcdPosition (lcdHandler, 0, 0) ; lcdPuts (lcdHandler,"                ");
22
        lcdPosition (lcdHandler, 0, 1) ; lcdPuts (lcdHandler,"                ");
23
    
24
        char horas[2];
25
        char minutos[2];
26
        char segundos[2];
27
        char powerChar[3];
28
                
29
        sprintf(horas, "%02d", clock.horas);
30
        sprintf(minutos, "%02d", clock.minutos);
31
        sprintf(segundos, "%02d", clock.segundos);
37 32
        
33
        //printf("%02hho", clock.minutos);
34
        //printf("%02d", clock.segundos);
35
        //printf(minutos);
36
        //printf(segundos);
38 37
        
39
    }}
38
        sprintf(powerChar, "%03d", power);
39
        result=0;    
40
        if(message)
41
        {
42

  
43
            lcdPosition (lcdHandler, 0, 0); 
44
            lcdPuts (lcdHandler, horas);
45
            //lcdPosition (lcdHandler, 2, 0) ; 
46
            lcdPutchar (lcdHandler, ':');
47
            //lcdPosition (lcdHandler, 3, 0) ; 
48
            lcdPuts (lcdHandler, minutos);
49
            //lcdPosition (lcdHandler, 5, 0) ; 
50
            lcdPutchar (lcdHandler, ':');
51
            //lcdPosition (lcdHandler, 6, 0) ; 
52
            lcdPuts (lcdHandler, segundos);
53
            
54
            lcdPosition (lcdHandler, 12, 0) ; 
55
            lcdPuts (lcdHandler, powerChar);
56
            lcdPosition (lcdHandler, 15, 0) ; 
57
            lcdPutchar (lcdHandler, 'W');
58
            
59
            
60
            lcdPosition (lcdHandler, 0, 1) ; lcdPuts (lcdHandler,message) ;
61

  
62

  
63
        }
64
        else
65
        {
66

  
67
            lcdPosition (lcdHandler, 0, 0) ; lcdPuts (lcdHandler, horas);// + ':' + minutos + ':' + segundos + ' ' + Power +  'W') ;
68

  
69

  
70

  
71
        }
72
    }
40 73
    
41 74
    
42 75
    

Also available in: Unified diff