[riot-notifications] [RIOT-OS/RIOT] ieee802154: add helpers for RSSI and dBm conversion (#15629)
notifications at github.com
Wed Jan 13 13:59:14 CET 2021
@jia200x commented on this pull request.
> + * The RSSI calculation is based on the IEEE 802.15.4 2020 specification and
+ * it's represented as one octet of integer.
+ * RSSI equal to zero maps to -174 dBm and has the same scale as dBm (1 RSSI
+ * step == 1 dBm). Therefore an RSSI value of 254 maps to +80 dBm.
+ * @param[in] dbm RF power in dBm scale.
+ * @return RF power in RSSI scale.
+static inline uint8_t ieee802154_dbm_to_rssi(int16_t dbm)
+ const int min = IEEE802154_RADIO_RSSI_OFFSET;
+ const int max = min + (UINT8_MAX - 1);
+ int val = dbm <= min ? min : dbm >= max ? max : dbm;
ok! I do it :)
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications