From cbb968f5cf03625d453d84dc535758072a2c04c7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 18 Mar 2011 20:07:25 -0700 Subject: [PATCH] altos: Add TeleNano support This just uses the TeleMini bits, which should work fine for now. Signed-off-by: Keith Packard --- src/Makefile | 2 +- src/Makefile.proto | 31 +++++++++++++++++++++++++++++++ src/ao_adc.c | 30 ++++++++++++++++++++++++++++++ src/ao_pins.h | 22 ++++++++++++++++++++++ src/telenano-v0.1/.gitignore | 2 ++ src/telenano-v0.1/.sdcdbrc | 1 + src/telenano-v0.1/Makefile | 1 + src/telenano-v0.1/Makefile.defs | 9 +++++++++ 8 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 src/telenano-v0.1/.gitignore create mode 100644 src/telenano-v0.1/.sdcdbrc create mode 100644 src/telenano-v0.1/Makefile create mode 100644 src/telenano-v0.1/Makefile.defs diff --git a/src/Makefile b/src/Makefile index 42383f88..a5dec57b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ include Version 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 diff --git a/src/Makefile.proto b/src/Makefile.proto index 30e626ad..df514cfe 100644 --- a/src/Makefile.proto +++ b/src/Makefile.proto @@ -190,6 +190,37 @@ TMINI_BASE_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 diff --git a/src/ao_adc.c b/src/ao_adc.c index ce935716..d77e7753 100644 --- a/src/ao_adc.c +++ b/src/ao_adc.c @@ -30,7 +30,11 @@ ao_adc_poll(void) #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; +# 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++; } +#define GOT_ADC 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); +#ifdef TELEMINI_V_0_1 switch (sequence) { case 0: /* pressure */ @@ -105,12 +111,36 @@ ao_adc_isr(void) __interrupt 1 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; } +#endif +#ifndef GOT_ADC +#error No known ADC configuration set #endif else { diff --git a/src/ao_pins.h b/src/ao_pins.h index 353b5fd5..b4f177bf 100644 --- a/src/ao_pins.h +++ b/src/ao_pins.h @@ -113,6 +113,28 @@ #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 diff --git a/src/telenano-v0.1/.gitignore b/src/telenano-v0.1/.gitignore new file mode 100644 index 00000000..0412f7df --- /dev/null +++ b/src/telenano-v0.1/.gitignore @@ -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 index 00000000..710b4a2f --- /dev/null +++ b/src/telenano-v0.1/.sdcdbrc @@ -0,0 +1 @@ +--directory=.. diff --git a/src/telenano-v0.1/Makefile b/src/telenano-v0.1/Makefile new file mode 100644 index 00000000..d8867b19 --- /dev/null +++ b/src/telenano-v0.1/Makefile @@ -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 index 00000000..34cf69d1 --- /dev/null +++ b/src/telenano-v0.1/Makefile.defs @@ -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 -- 2.30.2