summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-24 10:57:00 -0800
committerKeith Packard <keithp@keithp.com>2010-11-24 10:57:00 -0800
commit6d0098e497ee2d9a1d1113bf3fb907dd48bdcf80 (patch)
tree5fc4a2eea6e372d5b948d5bd65b27e23e08dce94
parent7a50837ea0d92db3f469f197ec8210aee22aa143 (diff)
altos: Add telemetrum-v1.1 directory
Telemetrum v1.1 may have the 5V line sampled to improve the accelerometer readings. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/Makefile2
-rw-r--r--src/ao_adc.c35
-rw-r--r--src/ao_pins.h17
-rw-r--r--src/telemetrum-v1.1/.gitignore2
-rw-r--r--src/telemetrum-v1.1/.sdcdbrc1
-rw-r--r--src/telemetrum-v1.1/Makefile1
-rw-r--r--src/telemetrum-v1.1/Makefile.defs11
7 files changed, 67 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index 95d24425..a6615321 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -6,7 +6,7 @@ CC=sdcc
include Version
-SUBDIRS=telemetrum-v1.0 teledongle-v0.2 telemetrum-v0.1-sky telemetrum-v0.1-sirf teledongle-v0.1 tidongle test
+SUBDIRS=telemetrum-v1.1 telemetrum-v1.0 teledongle-v0.2 telemetrum-v0.1-sky telemetrum-v0.1-sirf teledongle-v0.1 tidongle test
all: all-recursive
diff --git a/src/ao_adc.c b/src/ao_adc.c
index 49d2519e..cd8550fd 100644
--- a/src/ao_adc.c
+++ b/src/ao_adc.c
@@ -40,6 +40,29 @@ ao_adc_get(__xdata struct ao_adc *packet)
memcpy(packet, &ao_adc_ring[i], sizeof (struct ao_adc));
}
+#ifdef HAS_ADC_5V
+static void
+ao_fix_accel(void)
+{
+ uint32_t total;
+ uint8_t adc_l, adc_h;
+ uint8_t ref_l, ref_h;
+ uint8_t __xdata *p = (uint8_t __xdata *) &ao_adc_ring[ao_adc_head].accel;
+
+ ref_l = ADCL;
+ adc_l = p[0];
+ total = (uint32_t) (uint16_t) (adc_l * ref_l);
+
+ adc_h = p[1];
+ total += (uint32_t) (uint16_t) (adc_h * ref_l) << 8;
+
+ ref_h = ADCH;
+ total += (uint32_t) (uint16_t) (adc_l * ref_h) << 8;
+ total += (uint32_t) (uint16_t) (adc_h * ref_h) << 16;
+ *(uint16_t __xdata *) p = total >> 16;
+}
+#endif
+
void
ao_adc_isr(void) __interrupt 1
{
@@ -47,13 +70,23 @@ ao_adc_isr(void) __interrupt 1
uint8_t __xdata *a;
sequence = (ADCCON2 & ADCCON2_SCH_MASK) >> ADCCON2_SCH_SHIFT;
+#if HAS_ADC_5V
+ if (sequence == 2) {
+ ao_fix_accel();
+ /* and launch the temp sensor next */
+ ADCCON3 = ADCCON3_EREF_1_25 | ADCCON3_EDIV_512 | ADCCON3_ECH_TEMP;
+ return;
+ }
+#endif
+#if HAS_EXTERNAL_TEMP
if (sequence == ADCCON3_ECH_TEMP)
sequence = 2;
+#endif
a = (uint8_t __xdata *) (&ao_adc_ring[ao_adc_head].accel + sequence);
a[0] = ADCL;
a[1] = ADCH;
if (sequence < 5) {
-#if HAS_EXTERNAL_TEMP == 0
+#if !HAS_EXTERNAL_TEMP && !HAS_ADC_5V
/* start next channel conversion */
/* v0.2 replaces external temp sensor with internal one */
if (sequence == 1)
diff --git a/src/ao_pins.h b/src/ao_pins.h
index e9a265b0..374b4bf2 100644
--- a/src/ao_pins.h
+++ b/src/ao_pins.h
@@ -27,6 +27,23 @@
#define DBG_ON_P0 0
#define PACKET_HAS_MASTER 0
#define PACKET_HAS_SLAVE 1
+ #define HAS_ADC_5V 0
+
+ #define AO_LED_RED 1
+ #define LEDS_AVAILABLE (AO_LED_RED)
+ #define HAS_EXTERNAL_TEMP 0
+#endif
+
+#if defined(TELEMETRUM_V_1_1)
+ #define HAS_SERIAL_1 1
+ #define HAS_ADC 1
+ #define HAS_EEPROM 1
+ #define HAS_DBG 1
+ #define DBG_ON_P1 1
+ #define DBG_ON_P0 0
+ #define PACKET_HAS_MASTER 0
+ #define PACKET_HAS_SLAVE 1
+ #define HAS_ADC_5V 1
#define AO_LED_RED 1
#define LEDS_AVAILABLE (AO_LED_RED)
diff --git a/src/telemetrum-v1.1/.gitignore b/src/telemetrum-v1.1/.gitignore
new file mode 100644
index 00000000..c2212151
--- /dev/null
+++ b/src/telemetrum-v1.1/.gitignore
@@ -0,0 +1,2 @@
+telemetrum-*
+ao_product.h
diff --git a/src/telemetrum-v1.1/.sdcdbrc b/src/telemetrum-v1.1/.sdcdbrc
new file mode 100644
index 00000000..710b4a2f
--- /dev/null
+++ b/src/telemetrum-v1.1/.sdcdbrc
@@ -0,0 +1 @@
+--directory=..
diff --git a/src/telemetrum-v1.1/Makefile b/src/telemetrum-v1.1/Makefile
new file mode 100644
index 00000000..d8867b19
--- /dev/null
+++ b/src/telemetrum-v1.1/Makefile
@@ -0,0 +1 @@
+include ../Makefile.proto
diff --git a/src/telemetrum-v1.1/Makefile.defs b/src/telemetrum-v1.1/Makefile.defs
new file mode 100644
index 00000000..ada4424e
--- /dev/null
+++ b/src/telemetrum-v1.1/Makefile.defs
@@ -0,0 +1,11 @@
+PROG = telemetrum-v1.1-$(VERSION).ihx
+
+SRC = \
+ $(TM_BASE_SRC) \
+ $(FLASH_DRIVER_SRC) \
+ $(SKY_DRIVER_SRC) \
+ $(DBG_SRC)
+
+PRODUCT=TeleMetrum-v1.1
+PRODUCT_DEF=-DTELEMETRUM_V_1_1
+IDPRODUCT=0x000b