OSDN Git Service

check sum calc add
[scilog/scilog.git] / thread_disp.c
diff --git a/thread_disp.c b/thread_disp.c
new file mode 100644 (file)
index 0000000..fcd49e4
--- /dev/null
@@ -0,0 +1,94 @@
+#include <stdio.h>
+
+#include "ad_ring.h"
+#include "lcd.h"
+
+static void scr_init(void)
+{
+       int     iLeft = 0;
+       int     iY = 0;
+       
+       lcd_clear();
+
+       lcd_pos(iLeft, iY);
+       lcd_print("TIME:");
+       iY++;
+//     lcd_pos(iLeft, iY);
+//     lcd_print("STS:");
+//     iY++;
+       lcd_pos(iLeft, iY);
+       lcd_print("HX:");
+       iY++;
+       lcd_pos(iLeft, iY);
+       lcd_print("HY:");
+       iY++;
+       lcd_pos(iLeft, iY);
+       lcd_print("HZ:");
+       iY++;
+}
+
+/*
+
+*/
+static void scr_disp_time(AdData *d)
+{
+       int     iLeft, iY;
+       char    buf[128];
+       struct tm *t;
+       
+       t = &(d->t);
+       iLeft = 0;
+       iY = 0;
+       /*      Time */
+       lcd_pos(iLeft, iY++);
+       sprintf(buf, "%02d/%02d/%02d %02d:%02d:%02d %02X",
+               t->tm_year % 100, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,
+               d->gps.valid);
+       lcd_print(buf);
+}
+/*
+
+*/
+static void scr_disp_ad(AdData *d)
+{
+       int     iLeft, iY;
+       char    buf[128];
+       int     ch = 0;
+       
+       iLeft = 0;
+       iY = 1;
+       for(ch = 0; ch < 3; ch++) {
+               sprintf(buf, "%d% 8ld", ch+1, d->data1sec[ch]);
+               lcd_pos(iLeft, iY++);
+               lcd_print(buf);
+       }
+       iLeft = 10;
+       iY = 1;
+       for(ch = 3; ch < 6; ch++) {
+               sprintf(buf, "%d% 8ld", ch+1, d->data1sec[ch]);
+               lcd_pos(iLeft, iY++);
+               lcd_print(buf);
+       }
+}
+
+void* thread_disp(void* pParam)
+{
+       int     i;
+       AdData *d;
+
+       i = ad_ring_latest_get();
+//     scr_init();
+       lcd_clear();
+       while(1) {
+               // FG表示
+               if (i != ad_ring_latest_get()) {
+                       i = ad_ring_latest_get();
+                       // データ取得
+                       d = ad_ring_get(i);
+                       // 時刻表示
+                       scr_disp_time(d);
+                       // AD表示
+                       scr_disp_ad(d);
+               }
+       }
+}