Build two versions of TM, one for SiRF, one for SkyTraq
authorKeith Packard <keithp@keithp.com>
Sat, 10 Oct 2009 05:48:29 +0000 (22:48 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 10 Oct 2009 05:48:29 +0000 (22:48 -0700)
This creates two separate images, depending on which GPS unit is
connected.

Signed-off-by: Keith Packard <keithp@keithp.com>
.gitignore
src/Makefile
src/ao_teleterra.c
src/skytraq-cksum [new file with mode: 0644]

index 0ca4bed47f8dd406942e314167f798b8bb30d0b1..a6f94439108a0dbe2a3e8208a0b4ba45642abd7a 100644 (file)
@@ -16,6 +16,7 @@ TAGS
 aclocal.m4
 src/ao_flight_test
 src/ao_gps_test
+src/ao_gps_test_skytraq
 ao-teledongle.h
 ao-telemetrum.h
 ao-teleterra.h
@@ -47,6 +48,7 @@ missing
 stamp-h1
 tags
 teledongle
-telemetrum
+telemetrum-sirf
+telemetrum-sky
 teleterra
 tidongle
index 892635cb3c2143d9a8cd56517be2186849766ca2..9891cdadf708947bf838bd43b2cabe83e9908aa0 100644 (file)
@@ -59,7 +59,6 @@ TELE_RECEIVER_SRC =\
 
 TELE_DRIVER_SRC = \
        ao_convert.c \
-       ao_gps_skytraq.c \
        ao_serial.c
 
 #
@@ -84,6 +83,17 @@ TM_DRIVER_SRC = \
        ao_gps_report.c \
        ao_ignite.c
 
+#
+# Drivers only on TeleMetrum
+#
+TM_SIRF_DRIVER_SRC = \
+       ao_gps_sirf.c
+#
+# Drivers only on TeleMetrum
+#
+TM_SKY_DRIVER_SRC = \
+       ao_gps_skytraq.c
+
 #
 # Tasks run on TeleMetrum
 #
@@ -108,6 +118,14 @@ TM_SRC = \
        $(TM_TASK_SRC) \
        $(TM_MAIN_SRC)
 
+TM_SIRF_SRC = \
+       $(TM_SRC) \
+       $(TM_SIRF_DRIVER_SRC)
+
+TM_SKY_SRC = \
+       $(TM_SRC) \
+       $(TM_SKY_DRIVER_SRC)
+
 TI_MAIN_SRC = \
        ao_tidongle.c
 
@@ -161,13 +179,16 @@ SRC = \
        $(TELE_COMMON_SRC) \
        $(TELE_FAKE_SRC) \
        $(TM_DRIVER_SRC) \
+       $(TM_SIRF_DRIVER_SRC) \
+       $(TM_SKY_DRIVER_SRC) \
        $(TM_TASK_SRC) \
        $(TM_MAIN_SRC) \
        $(TI_MAIN_SRC) \
        $(TD_MAIN_SRC) \
        $(TT_MAIN_SRC)
 
-TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum.rel
+TM_SIRF_REL=$(TM_SIRF_SRC:.c=.rel) ao_product-telemetrum.rel
+TM_SKY_REL=$(TM_SKY_SRC:.c=.rel) ao_product-telemetrum.rel
 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
@@ -186,7 +207,7 @@ LST=$(REL:.rel=.lst)
 RST=$(REL:.rel=.rst)
 SYM=$(REL:.rel=.sym)
 
-PROGS= telemetrum.ihx tidongle.ihx \
+PROGS= telemetrum-sirf.ihx telemetrum-sky.ihx tidongle.ihx \
        teleterra.ihx teledongle.ihx
 
 HOST_PROGS=ao_flight_test ao_gps_test ao_gps_test_skytraq
@@ -202,15 +223,21 @@ PAOM=$(PROGS:.ihx=)
 
 all: $(PROGS) $(HOST_PROGS)
 
-telemetrum.ihx: $(TM_REL) Makefile
-       $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
-       sh check-stack ao.h telemetrum.mem
+telemetrum-sirf.ihx: $(TM_SIRF_REL) Makefile
+       $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SIRF_REL)
+       sh check-stack ao.h telemetrum-sirf.mem
+
+telemetrum-sky.ihx: $(TM_SKY_REL) Makefile
+       $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_SKY_REL)
+       sh check-stack ao.h telemetrum-sky.mem
+
+telemetrum-sky.ihx: telemetrum-sirf.ihx
 
 tidongle.ihx: $(TI_REL) Makefile
        $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
        sh check-stack ao.h tidongle.mem
 
-tidongle.ihx: telemetrum.ihx
+tidongle.ihx: telemetrum-sky.ihx
 
 teleterra.ihx: $(TT_REL) Makefile
        $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
index deb63597f91845dec91a69a2158c0f80df9b2ba8..d696b914e88c845a70d1789424b7e2ec21553281 100644 (file)
@@ -31,7 +31,6 @@ main(void)
        ao_cmd_init();
        ao_usb_init();
        ao_serial_init();
-       ao_gps_init();
        ao_monitor_init(AO_LED_GREEN, TRUE);
        ao_radio_init();
        ao_config_init();
diff --git a/src/skytraq-cksum b/src/skytraq-cksum
new file mode 100644 (file)
index 0000000..e4960bf
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/env nickle
+
+int checksum(int[] msg)
+{
+       int sum = 0;
+       for (int i = 0; i < dim(msg); i++) {
+               sum ^= msg[i];
+               sum &= 0xff;
+       }
+       return sum;
+}
+
+void main()
+{
+       string[...]     input;
+       int[...]        msg;
+
+       setdim(input, 0);
+       while (!File::end(stdin)) {
+               input[dim(input)] = gets();
+       }
+
+       setdim(msg, 0);
+       for (int i = 0; i < dim(input); i++) {
+               string[*] words = String::wordsplit(input[i], " ,\t");
+               for (int j = 0; j < dim(words); j++) {
+                       if (words[j] == "/" + "*")
+                               break;
+                       if (String::length(words[j]) > 0 &&
+                           Ctype::isdigit(words[j][0])) {
+                               msg[dim(msg)] = string_to_integer(words[j]);
+                       }
+                }
+       }
+       printf("\t0xa0, 0xa1, 0x02x, 0x%02x,\t\t/* length: %d bytes */\n",
+              dim(msg) >> 8, dim(msg) & 0xff, dim(msg));
+       for (int i = 0; i < dim(input); i++)
+               printf("%s\n", input[i]);
+       int csum = checksum(msg);
+       printf ("\t0x%02x, 0x0d, 0x0a,\n",
+               csum);
+}
+
+main();