From fa64e93313ab311e186568fa31739a4dd878617b Mon Sep 17 00:00:00 2001 From: Koen Zandberg <koen@bergzand.net> Date: Wed, 30 Aug 2017 20:57:04 +0200 Subject: [PATCH] netdev: Represent RSSI as int16_t --- drivers/include/net/netdev.h | 2 +- sys/include/net/gnrc/netif/hdr.h | 2 +- sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/include/net/netdev.h b/drivers/include/net/netdev.h index d69e238674..70f44c2b4d 100644 --- a/drivers/include/net/netdev.h +++ b/drivers/include/net/netdev.h @@ -245,7 +245,7 @@ typedef enum { * May be different for certain radios. */ struct netdev_radio_rx_info { - uint8_t rssi; /**< RSSI of a received packet */ + int16_t rssi; /**< RSSI of a received packet in dBm */ uint8_t lqi; /**< LQI of a received packet */ }; diff --git a/sys/include/net/gnrc/netif/hdr.h b/sys/include/net/gnrc/netif/hdr.h index b1e101efd6..b4ab577f97 100644 --- a/sys/include/net/gnrc/netif/hdr.h +++ b/sys/include/net/gnrc/netif/hdr.h @@ -85,7 +85,7 @@ typedef struct { uint8_t dst_l2addr_len; /**< length of l2 destination address in byte */ kernel_pid_t if_pid; /**< PID of network interface */ uint8_t flags; /**< flags as defined above */ - uint8_t rssi; /**< rssi of received packet (optional) */ + int16_t rssi; /**< rssi of received packet in dBm (optional) */ uint8_t lqi; /**< lqi of received packet (optional) */ } gnrc_netif_hdr_t; diff --git a/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c b/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c index bec00cef9e..403941daa1 100644 --- a/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c +++ b/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c @@ -23,7 +23,7 @@ void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr) char addr_str[GNRC_NETIF_HDR_L2ADDR_PRINT_LEN]; printf("if_pid: %u ", (unsigned) hdr->if_pid); - printf("rssi: %u ", (unsigned) hdr->rssi); + printf("rssi: %d ", (signed) hdr->rssi); printf("lqi: %u\n", (unsigned) hdr->lqi); printf("flags: "); -- GitLab