summaryrefslogtreecommitdiff
path: root/ao.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-04-23 22:17:44 -0700
committerKeith Packard <keithp@keithp.com>2009-04-24 08:39:00 -0700
commitb32f2f0090ff967edac07ae4d7a9895ed0b96d31 (patch)
tree562b7c1ab3127686995dc19cc986fefa672f5c56 /ao.h
parentf155333ae18a25068644792e8940269d9fb28033 (diff)
Add igniters and update flight control algorithm
Diffstat (limited to 'ao.h')
-rw-r--r--ao.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/ao.h b/ao.h
index b10f1b34..137a0143 100644
--- a/ao.h
+++ b/ao.h
@@ -29,7 +29,7 @@
/* Stack runs from above the allocated __data space to 0xfe, which avoids
* writing to 0xff as that triggers the stack overflow indicator
*/
-#define AO_STACK_START 0x68
+#define AO_STACK_START 0x70
#define AO_STACK_END 0xfe
#define AO_STACK_SIZE (AO_STACK_END - AO_STACK_START + 1)
@@ -123,6 +123,8 @@ ao_timer_init(void);
*/
#define AO_ADC_RING 64
+#define ao_adc_ring_next(n) (((n) + 1) & (AO_ADC_RING - 1))
+#define ao_adc_ring_prev(n) (((n) - 1) & (AO_ADC_RING - 1))
/*
* One set of samples read from the A/D converter
@@ -544,7 +546,7 @@ enum ao_flight_state {
};
extern __xdata struct ao_adc ao_flight_data;
-extern __pdata enum flight_state ao_flight_state;
+extern __pdata enum ao_flight_state ao_flight_state;
extern __pdata uint16_t ao_flight_tick;
extern __pdata int16_t ao_flight_accel;
extern __pdata int16_t ao_flight_pres;
@@ -734,5 +736,30 @@ ao_monitor_init(void);
void
flush(void);
+/*
+ * ao_ignite.c
+ */
+
+enum ao_igniter {
+ ao_igniter_drogue = 0,
+ ao_igniter_main = 1
+};
+
+void
+ao_ignite(enum ao_igniter igniter);
+
+enum ao_igniter_status {
+ ao_igniter_unknown, /* unknown status (ambiguous voltage) */
+ ao_igniter_ready, /* continuity detected */
+ ao_igniter_active, /* igniter firing */
+ ao_igniter_open, /* open circuit detected */
+};
+
+enum ao_igniter_status
+ao_igniter_status(enum ao_igniter igniter);
+
+void
+ao_igniter_init(void);
+
#endif /* _AO_H_ */