altos: Add TeleNano support
authorKeith Packard <keithp@keithp.com>
Sat, 19 Mar 2011 03:07:25 +0000 (20:07 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 19 Mar 2011 03:07:25 +0000 (20:07 -0700)
This just uses the TeleMini bits, which should work fine for now.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/Makefile
src/Makefile.proto
src/ao_adc.c
src/ao_pins.h
src/telenano-v0.1/.gitignore [new file with mode: 0644]
src/telenano-v0.1/.sdcdbrc [new file with mode: 0644]
src/telenano-v0.1/Makefile [new file with mode: 0644]
src/telenano-v0.1/Makefile.defs [new file with mode: 0644]

index 42383f88d9d7e5e46c32172a612f92adfad58f7f..a5dec57b2144efc8d5fd7074444095daa13a02f9 100644 (file)
@@ -9,7 +9,7 @@ include Version
 SUBDIRS=\
        telemetrum-v1.1 telemetrum-v1.0 \
        teledongle-v0.2 teledongle-v0.1 \
 SUBDIRS=\
        telemetrum-v1.1 telemetrum-v1.0 \
        teledongle-v0.2 teledongle-v0.1 \
-       telemini-v0.1 \
+       telemini-v0.1 telenano-v0.1 \
        telemetrum-v0.1-sky telemetrum-v0.1-sirf \
        tidongle test
 
        telemetrum-v0.1-sky telemetrum-v0.1-sirf \
        tidongle test
 
index 30e626ad0079b9881606787ea2becd5b1915fe2e..df514cfe5950d06724c688e6cf0a8ae04cd60aa7 100644 (file)
@@ -190,6 +190,37 @@ TMINI_BASE_SRC = \
        $(TMINI_TASK_SRC) \
        $(TMINI_MAIN_SRC)
 
        $(TMINI_TASK_SRC) \
        $(TMINI_MAIN_SRC)
 
+#
+# Sources for TeleNano
+TNANO_DRIVER_SRC = \
+       ao_adc.c \
+       ao_ignite.c \
+       ao_config.c \
+       ao_storage.c \
+       ao_intflash.c
+
+TNANO_TASK_SRC = \
+       ao_flight.c \
+       ao_log.c \
+       ao_log_tiny.c \
+       ao_report.c \
+       ao_telemetry.c
+
+TNANO_MAIN_SRC = \
+       ao_telemini.c
+
+TNANO_BASE_SRC = \
+       $(ALTOS_SRC) \
+       $(ALTOS_DRIVER_SRC) \
+       $(TELE_DRIVER_SRC) \
+       $(TELE_COMMON_SRC) \
+       $(TNANO_DRIVER_SRC) \
+       $(TNANO_TASK_SRC) \
+       $(TNANO_MAIN_SRC)
+
+#
+# TI Dongle sources
+#
 TI_MAIN_SRC = \
        ao_tidongle.c
 
 TI_MAIN_SRC = \
        ao_tidongle.c
 
index ce935716a1142b2d3be4a7bc1106ccca5f0e63e8..d77e775331141b7bbdc38ce37aadd78dcf174476 100644 (file)
@@ -30,7 +30,11 @@ ao_adc_poll(void)
 #if HAS_ACCEL_REF
        ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 2;
 #else
 #if HAS_ACCEL_REF
        ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 2;
 #else
+# ifdef TELENANO_V_0_1
+       ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 1;
+# else
        ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 0;
        ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 0;
+# endif
 #endif
 }
 
 #endif
 }
 
@@ -62,6 +66,7 @@ ao_adc_isr(void) __interrupt 1
                a = (uint8_t __xdata *) (&ao_adc_ring[ao_adc_head].accel + sequence);
                sequence++;
        }
                a = (uint8_t __xdata *) (&ao_adc_ring[ao_adc_head].accel + sequence);
                sequence++;
        }
+#define GOT_ADC
        a[0] = ADCL;
        a[1] = ADCH;
        if (sequence < 6) {
        a[0] = ADCL;
        a[1] = ADCH;
        if (sequence < 6) {
@@ -79,6 +84,7 @@ ao_adc_isr(void) __interrupt 1
 #if IGNITE_ON_P0
        /* TeleMini readings */
        a = (uint8_t __xdata *) (&ao_adc_ring[ao_adc_head].pres);
 #if IGNITE_ON_P0
        /* TeleMini readings */
        a = (uint8_t __xdata *) (&ao_adc_ring[ao_adc_head].pres);
+#ifdef TELEMINI_V_0_1
        switch (sequence) {
        case 0:
                /* pressure */
        switch (sequence) {
        case 0:
                /* pressure */
@@ -105,12 +111,36 @@ ao_adc_isr(void) __interrupt 1
                sequence = 0;
                break;
        }
                sequence = 0;
                break;
        }
+#define GOT_ADC
+#endif
+#ifdef TELENANO_V_0_1
+       switch (sequence) {
+       case 1:
+               /* pressure */
+               a += 0;
+               sequence = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 3;
+               break;
+       case 3:
+               /* battery */
+               a += 4;
+               sequence = ADCCON3_EREF_1_25 | ADCCON3_EDIV_512 | ADCCON3_ECH_TEMP;
+               break;
+       case ADCCON3_ECH_TEMP:
+               a += 2;
+               sequence = 0;
+               break;
+       }
+#define GOT_ADC
+#endif
        a[0] = ADCL;
        a[1] = ADCH;
        if (sequence) {
                /* Start next conversion */
                ADCCON3 = sequence;
        }
        a[0] = ADCL;
        a[1] = ADCH;
        if (sequence) {
                /* Start next conversion */
                ADCCON3 = sequence;
        }
+#endif
+#ifndef GOT_ADC
+#error No known ADC configuration set
 #endif
 
        else {
 #endif
 
        else {
index 353b5fd52559cb712923acfb1229973341c1cf68..b4f177bf20f33c8e474ea0955ff6cac42079f251 100644 (file)
        #define HAS_ACCEL               0
 #endif
 
        #define HAS_ACCEL               0
 #endif
 
+#if defined(TELENANO_V_0_1)
+       #define HAS_FLIGHT              1
+       #define HAS_USB                 0
+       #define HAS_BEEP                0
+       #define HAS_GPS                 0
+       #define HAS_SERIAL_1            0
+       #define HAS_ADC                 1
+       #define HAS_EEPROM              1
+       #define HAS_DBG                 0
+       #define USE_KALMAN              1
+       #define IGNITE_ON_P2            0
+       #define IGNITE_ON_P0            1
+       #define PACKET_HAS_MASTER       0
+       #define PACKET_HAS_SLAVE        1
+
+       #define AO_LED_GREEN            1
+       #define AO_LED_RED              2
+       #define LEDS_AVAILABLE          (AO_LED_RED|AO_LED_GREEN)
+       #define HAS_EXTERNAL_TEMP       0
+       #define HAS_ACCEL               0
+#endif
+
 #if defined(TELEMETRUM_V_0_1)
        #define HAS_FLIGHT              1
        #define HAS_USB                 1
 #if defined(TELEMETRUM_V_0_1)
        #define HAS_FLIGHT              1
        #define HAS_USB                 1
diff --git a/src/telenano-v0.1/.gitignore b/src/telenano-v0.1/.gitignore
new file mode 100644 (file)
index 0000000..0412f7d
--- /dev/null
@@ -0,0 +1,2 @@
+telenano-*
+ao_product.h
diff --git a/src/telenano-v0.1/.sdcdbrc b/src/telenano-v0.1/.sdcdbrc
new file mode 100644 (file)
index 0000000..710b4a2
--- /dev/null
@@ -0,0 +1 @@
+--directory=..
diff --git a/src/telenano-v0.1/Makefile b/src/telenano-v0.1/Makefile
new file mode 100644 (file)
index 0000000..d8867b1
--- /dev/null
@@ -0,0 +1 @@
+include ../Makefile.proto
diff --git a/src/telenano-v0.1/Makefile.defs b/src/telenano-v0.1/Makefile.defs
new file mode 100644 (file)
index 0000000..34cf69d
--- /dev/null
@@ -0,0 +1,9 @@
+PROG = telenano-v0.1-$(VERSION).ihx
+
+SRC = \
+       $(TNANO_BASE_SRC)
+
+PRODUCT=TeleNano-v0.1
+PRODUCT_DEF=-DTELENANO_V_0_1
+IDPRODUCT=0x000a
+CODESIZE=0x6700