OSDN Git Service

PDEBUG() disable.
[scilog/scilog.git] / thread_disp.c
1 #include <stdio.h>
2
3 #include "ad_ring.h"
4 #include "lcd.h"
5
6 static void scr_init(void)
7 {
8         int     iLeft = 0;
9         int     iY = 0;
10         
11         lcd_clear();
12
13         lcd_pos(iLeft, iY);
14         lcd_print("TIME:");
15         iY++;
16 //      lcd_pos(iLeft, iY);
17 //      lcd_print("STS:");
18 //      iY++;
19         lcd_pos(iLeft, iY);
20         lcd_print("HX:");
21         iY++;
22         lcd_pos(iLeft, iY);
23         lcd_print("HY:");
24         iY++;
25         lcd_pos(iLeft, iY);
26         lcd_print("HZ:");
27         iY++;
28 }
29
30 /*
31
32 */
33 static void scr_disp_time(AdData *d)
34 {
35         int     iLeft, iY;
36         char    buf[128];
37         struct tm *t;
38         
39         t = &(d->t);
40         iLeft = 0;
41         iY = 0;
42         /*      Time */
43         lcd_pos(iLeft, iY++);
44         sprintf(buf, "%02d/%02d/%02d %02d:%02d:%02d %02X",
45                 t->tm_year % 100, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,
46                 d->gps.valid);
47         lcd_print(buf);
48 }
49 /*
50
51 */
52 static void scr_disp_ad(AdData *d)
53 {
54         int     iLeft, iY;
55         char    buf[128];
56         int     ch = 0;
57         
58         iLeft = 0;
59         iY = 1;
60         for(ch = 0; ch < 3; ch++) {
61                 sprintf(buf, "%d% 8ld", ch+1, d->data1sec[ch]);
62                 lcd_pos(iLeft, iY++);
63                 lcd_print(buf);
64         }
65         iLeft = 10;
66         iY = 1;
67         for(ch = 3; ch < 6; ch++) {
68                 sprintf(buf, "%d% 8ld", ch+1, d->data1sec[ch]);
69                 lcd_pos(iLeft, iY++);
70                 lcd_print(buf);
71         }
72 }
73
74 void* thread_disp(void* pParam)
75 {
76         int     i;
77         AdData *d;
78
79         i = ad_ring_latest_get();
80 //      scr_init();
81         lcd_clear();
82         while(1) {
83                 // FG表示
84                 if (i != ad_ring_latest_get()) {
85                         i = ad_ring_latest_get();
86                         // データ取得
87                         d = ad_ring_get(i);
88                         // 時刻表示
89                         scr_disp_time(d);
90                         // AD表示
91                         scr_disp_ad(d);
92                 }
93         }
94 }