[riot-notifications] [RIOT-OS/RIOT] nrf802154: Add rssi/lqi to received frames (#11133)

Koen Zandberg notifications at github.com
Thu Mar 7 21:28:09 CET 2019


bergzand commented on this pull request.



> @@ -317,6 +320,17 @@ static int _recv(netdev_t *dev, void *buf, size_t len, void *info)
     else {
         DEBUG("[nrf802154] recv: reading packet of length %i\n", pktlen);
         memcpy(buf, &rxbuf[1], pktlen);
+        if (info != NULL) {
+            netdev_ieee802154_rx_info_t *radio_info = info;
+            /* Hardware link quality indicator */
+            uint8_t hwlqi = rxbuf[pktlen + 1];
+            /* Convert to 802.15.4 LQI (page 319 of the datasheet) */
+            radio_info->lqi = (uint8_t)(hwlqi > UINT8_MAX/ED_RSSISCALE
+                                       ? UINT8_MAX
+                                       : hwlqi * ED_RSSISCALE);
+            /* Calculate RSSI by substracting the offset from the datasheet */
+            radio_info->rssi = (int16_t)hwlqi - ED_RSSIOFFS;

Clarified this a bit with a comment in the code

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11133#discussion_r263553938
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/e77719ea/attachment-0001.html>


More information about the notifications mailing list