summaryrefslogtreecommitdiff
path: root/src/core/ao.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-09-21 11:39:24 -0700
committerKeith Packard <keithp@keithp.com>2011-09-21 11:45:05 -0700
commitc8a00bb9ccdf0d4257f037c2bf996ce5e6b0b0c0 (patch)
treecef91c9361b9455078ee4393281333c0ae6af784 /src/core/ao.h
parentabf17522c206b465375b73a004a6d67bfa714ba3 (diff)
altos: Pre-compute RDF packet len at compile time
Instead of computing the RDF packet len at run time, which takes a pile of code space. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core/ao.h')
-rw-r--r--src/core/ao.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/ao.h b/src/core/ao.h
index 1d5769cb..c28c4549 100644
--- a/src/core/ao.h
+++ b/src/core/ao.h
@@ -1341,8 +1341,18 @@ ao_radio_recv(__xdata void *data, uint8_t size) __reentrant;
void
ao_radio_recv_abort(void);
+/*
+ * Compute the packet length as follows:
+ *
+ * 2000 bps (for a 1kHz tone)
+ * so, for 'ms' milliseconds, we need
+ * 2 * ms bits, or ms / 4 bytes
+ */
+
+#define AO_MS_TO_RDF_LEN(ms) ((ms) > 255 * 4 ? 255 : ((ms) >> 2))
+
void
-ao_radio_rdf(int ms);
+ao_radio_rdf(uint8_t pkt_len);
void
ao_radio_rdf_abort(void);