Skip to main content

threshold_byte

Function threshold_byte 

Source
pub const fn threshold_byte(dbm: i8) -> u8
Expand description

Writes a threshold the way the radio takes it.

The radio counts in half decibels below zero, so a threshold in dBm goes out doubled and with its sign dropped: -80 dBm becomes 160.

§Arguments

  • dbm - the threshold, which is negative for any real one.

§Returns

The byte the radio is programmed with.

§Examples

use pamoja_radios::sx1302::lbt::threshold_byte;

assert_eq!(threshold_byte(-80), 160);
assert_eq!(threshold_byte(-60), 120);