cc110x: Add RSSI dBm conversion

This commit is contained in:
Koen Zandberg 2017-08-30 21:10:10 +02:00
parent 047b8172ae
commit 7dce20afb6
2 changed files with 11 additions and 1 deletions

View File

@ -27,6 +27,7 @@
#include "cc110x-netdev.h"
#include "cc110x-internal.h"
#include "cc110x-interface.h"
#include "cc110x-defines.h"
#include "net/eui64.h"
#include "periph/gpio.h"
@ -61,7 +62,7 @@ static int _recv(netdev_t *dev, void *buf, size_t len, void *info)
if (info != NULL) {
netdev_cc110x_rx_info_t *cc110x_info = info;
cc110x_info->rssi = cc110x->pkt_buf.rssi;
cc110x_info->rssi = (int16_t)cc110x->pkt_buf.rssi/2 - CC110X_RSSI_OFFSET;
cc110x_info->lqi = cc110x->pkt_buf.lqi;
}
return cc110x_pkt->length;

View File

@ -34,6 +34,15 @@ extern "C" {
*/
#define VARIABLE_PKTLEN (0x01)
/**
* @brief RSSI calculation offset.
*
* The cc1101 has 74 as a RSSI offset. The CC1100E has a
* slightly larger offset of 75 to 79 (not implemented here).
* With those devices we thus get a slightly optimistic result.
*/
#define CC110X_RSSI_OFFSET (74)
/**
* @name Bitmasks for reading out status register values
* @{