diff options
author | Keith Packard <keithp@keithp.com> | 2013-04-29 23:20:25 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-07 20:07:54 -0700 |
commit | eb0e1720be2aa4fb6729ceada09c18947bfee2bc (patch) | |
tree | 77bfbad77fa2d2f653c9bf6814b7d63607672a77 /src/core/ao_radio_cmac.c | |
parent | 949700f276b80b4eb28f15b5559714f430f227f1 (diff) |
altos: Compute "real" RSSI value in radio code as needed
Instead of dragging around the weird CC1111 RSSI values, just compute
a dBm value in a signed 8-bit integer, ao_radio_rssi. Use that
everywhere we need RSSI internally. We leave the weird CC1111 value in
the packet reply as that's what the host expects.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core/ao_radio_cmac.c')
-rw-r--r-- | src/core/ao_radio_cmac.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/ao_radio_cmac.c b/src/core/ao_radio_cmac.c index 4920b50c..3ca3c313 100644 --- a/src/core/ao_radio_cmac.c +++ b/src/core/ao_radio_cmac.c @@ -92,7 +92,7 @@ radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant return AO_RADIO_CMAC_TIMEOUT; } - ao_radio_cmac_rssi = (int8_t) (((int8_t) cmac_data[len + AO_CMAC_KEY_LEN]) >> 1) - 74; + ao_radio_cmac_rssi = ao_radio_rssi; if (!(cmac_data[len + AO_CMAC_KEY_LEN +1] & AO_RADIO_STATUS_CRC_OK)) return AO_RADIO_CMAC_CRC_ERROR; @@ -146,7 +146,7 @@ ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant int8_t ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant { - uint8_t i; + int8_t i; if (len > AO_CMAC_MAX_LEN) return AO_RADIO_CMAC_LEN_ERROR; ao_mutex_get(&ao_radio_cmac_mutex); |