summaryrefslogtreecommitdiff
path: root/src/cc1111
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-07-21 20:04:05 -0700
committerKeith Packard <keithp@keithp.com>2011-08-27 12:45:33 -0700
commit4299b5a36a2f6f9f7bbbc3a1b935dd2357c1fb0f (patch)
tree3b8adeaa02d4f54009aefa9bceafc92a88a64d65 /src/cc1111
parent776df9ce2e7b4fa5cedda326988e66c614299af4 (diff)
altos: Implement remote launch protocol
Uses the radio_cmac module to provide secure communication. Keeps igniter closed for 500ms. Provides remote status for arming and ignition. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/cc1111')
-rw-r--r--src/cc1111/ao_ignite.c6
-rw-r--r--src/cc1111/ao_packet_master.c6
-rw-r--r--src/cc1111/ao_timer.c1
3 files changed, 6 insertions, 7 deletions
diff --git a/src/cc1111/ao_ignite.c b/src/cc1111/ao_ignite.c
index 5238beb4..0fd2b4bf 100644
--- a/src/cc1111/ao_ignite.c
+++ b/src/cc1111/ao_ignite.c
@@ -39,12 +39,6 @@
#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50)
#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000)
-struct ao_ignition {
- uint8_t request;
- uint8_t fired;
- uint8_t firing;
-};
-
__xdata struct ao_ignition ao_ignition[2];
void
diff --git a/src/cc1111/ao_packet_master.c b/src/cc1111/ao_packet_master.c
index b0fdf5a8..0d0be30e 100644
--- a/src/cc1111/ao_packet_master.c
+++ b/src/cc1111/ao_packet_master.c
@@ -80,13 +80,16 @@ ao_packet_master(void)
ao_packet_master_time = ao_time();
ao_packet_master_delay = AO_PACKET_MASTER_DELAY_SHORT;
while (ao_packet_enable) {
+ uint8_t r;
memcpy(ao_tx_packet.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
ao_packet_send();
if (ao_tx_packet.len)
ao_packet_master_busy();
ao_packet_master_check_busy();
ao_alarm(ao_packet_master_delay);
- if (ao_packet_recv()) {
+ r = ao_packet_recv();
+ ao_clear_alarm();
+ if (r) {
/* if we can transmit data, do so */
if (ao_packet_tx_used && ao_tx_packet.len == 0)
continue;
@@ -95,6 +98,7 @@ ao_packet_master(void)
ao_packet_master_sleeping = 1;
ao_alarm(ao_packet_master_delay);
ao_sleep(&ao_packet_master_sleeping);
+ ao_clear_alarm();
ao_packet_master_sleeping = 0;
}
}
diff --git a/src/cc1111/ao_timer.c b/src/cc1111/ao_timer.c
index c977fbc8..aadee71e 100644
--- a/src/cc1111/ao_timer.c
+++ b/src/cc1111/ao_timer.c
@@ -31,6 +31,7 @@ ao_delay(uint16_t ticks)
{
ao_alarm(ticks);
ao_sleep(&ao_forever);
+ ao_clear_alarm();
}
#define T1_CLOCK_DIVISOR 8 /* 24e6/8 = 3e6 */