summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-05-23 11:31:34 -0700
committerKeith Packard <keithp@keithp.com>2011-05-23 16:13:55 -0600
commit29e59e4a1041e20fb10aac8715191bde4ab178d1 (patch)
treef9eaa3a381cf7bd1a2448e41c0785114a0ff07d9
parent252b7e63715f48e99d0eb26faf1690c909dd2bb2 (diff)
altos: Signal ascent using P1_2 (0 = ascent, 1 = other)
This can control an external recording device to log data only during ascent. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/ao_flight.c11
-rw-r--r--src/ao_pins.h5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ao_flight.c b/src/ao_flight.c
index c6cbbf7c..cfecc5af 100644
--- a/src/ao_flight.c
+++ b/src/ao_flight.c
@@ -168,6 +168,9 @@ ao_flight(void)
ao_wakeup(&ao_gps_data);
ao_wakeup(&ao_gps_tracking_data);
#endif
+#ifdef ASCENT_PIN
+ ASCENT_PIN = 0;
+#endif
ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
break;
@@ -237,6 +240,9 @@ ao_flight(void)
/* Turn the RDF beacon back on */
ao_rdf_set(1);
+#ifdef ASCENT_PIN
+ ASCENT_PIN = 1;
+#endif
/*
* Start recording min/max height
* to figure out when the rocket has landed
@@ -313,6 +319,11 @@ static __xdata struct ao_task flight_task;
void
ao_flight_init(void)
{
+#ifdef ASCENT_SIGNAL
+ ASCENT_SIGNAL = 1;
+ ASCENT_SIGNAL_DIR |= (1 << ASCENT_SIGNAL_PIN);
+ ASCENT_SIGNAL_SEL &= ~(1 << ASCENT_SIGNAL_PIN);
+#endif
ao_flight_state = ao_flight_startup;
ao_add_task(&flight_task, ao_flight, "flight");
}
diff --git a/src/ao_pins.h b/src/ao_pins.h
index 4a03ca50..86389c17 100644
--- a/src/ao_pins.h
+++ b/src/ao_pins.h
@@ -72,6 +72,11 @@
#define M25_MAX_CHIPS 1
#define HAS_ACCEL 1
#define HAS_IGNITE 1
+
+ #define ASCENT_SIGNAL P1_2 /* Use CS1 to signal ascent */
+ #define ASCENT_SIGNAL_DIR P1DIR
+ #define ASCENT_SIGNAL_SEL P1SEL
+ #define ASCENT_SIGNAL_PIN 2
#endif
#if defined(TELEDONGLE_V_0_2)