summaryrefslogtreecommitdiff
path: root/src/drivers/ao_cc1120.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-07-11 13:50:56 -0700
committerKeith Packard <keithp@keithp.com>2012-07-11 13:50:56 -0700
commitfe70611c3c7d4b8cce3b5292f0ec549f3191bf86 (patch)
tree34c7b7c73fc3a2528757fece149e7a5d26edc4d6 /src/drivers/ao_cc1120.c
parent18431c88c8a6cb267922b97192e8b7ddb88d0e7e (diff)
altos: Create macros to convert from/to radio RSSI representation
AO_RSSI_FROM_RADIO and AO_RADIO_FROM_RSSI. Removes a bunch of open-coded versions of the same function. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_cc1120.c')
-rw-r--r--src/drivers/ao_cc1120.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c
index a36d922c..569df3b7 100644
--- a/src/drivers/ao_cc1120.c
+++ b/src/drivers/ao_cc1120.c
@@ -729,7 +729,7 @@ ao_radio_recv(__xdata void *d, uint8_t size)
/* Convert from 'real' rssi to cc1111-style values */
- rssi = (((int8_t) ao_radio_reg_read(CC1120_RSSI1)) + 74) * 2;
+ rssi = AO_RADIO_FROM_RSSI(ao_radio_reg_read(CC1120_RSSI1));
ao_radio_put();
@@ -998,7 +998,7 @@ ao_radio_test_recv()
printf ("CRC OK");
else
printf ("CRC BAD");
- printf (" RSSI %d", (int16_t) ((int8_t) bytes[32] >> 1) - 74);
+ printf (" RSSI %d", AO_RSSI_FROM_RADIO(bytes[32]));
for (b = 0; b < 32; b++)
printf (" %02x", bytes[b]);
printf ("\n");