summaryrefslogtreecommitdiff
path: root/src/drivers/ao_pyro_slave.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-07-16 15:32:26 -0700
committerKeith Packard <keithp@keithp.com>2012-07-16 15:32:26 -0700
commit5860f75677ee20fcf35ab89a6b62f3e14a1c32f5 (patch)
treebfe09041a823c8f759c210d292a0f56335edb89e /src/drivers/ao_pyro_slave.c
parent3ce645a79b54e22d7835c6e390a22a5ad501a339 (diff)
altos: Enable pyro channel control in telepyro
This should make the board actually work now. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_pyro_slave.c')
-rw-r--r--src/drivers/ao_pyro_slave.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/drivers/ao_pyro_slave.c b/src/drivers/ao_pyro_slave.c
index 70206a00..f07c2cba 100644
--- a/src/drivers/ao_pyro_slave.c
+++ b/src/drivers/ao_pyro_slave.c
@@ -18,6 +18,8 @@
#include <ao.h>
#include <ao_product.h>
#include <ao_companion.h>
+#include <ao_flight.h>
+#include <ao_pyro.h>
struct ao_companion_command ao_companion_command;
@@ -28,6 +30,11 @@ static const struct ao_companion_setup ao_telepyro_setup = {
.channels = AO_TELEPYRO_NUM_ADC,
};
+struct ao_config ao_config;
+
+extern volatile __data uint16_t ao_tick_count;
+uint16_t ao_boost_tick;
+
void ao_spi_slave(void)
{
if (!ao_spi_slave_recv((uint8_t *) &ao_companion_command,
@@ -45,6 +52,10 @@ void ao_spi_slave(void)
AO_TELEPYRO_NUM_ADC * sizeof (uint16_t));
break;
case AO_COMPANION_NOTIFY:
+ /* Can't use ao_time because we have interrupts suspended */
+ if (ao_companion_command.flight_state < ao_flight_boost && ao_companion_command.flight_state >= ao_flight_boost)
+ ao_boost_tick = ao_tick_count;
+ ao_wakeup(&ao_pyro_wakeup);
break;
default:
return;