pub struct Gain {
pub radiated_dbm: i8,
pub amplifier: u8,
pub power_index: u8,
pub digital_gain: u8,
pub offset_i: i8,
pub offset_q: i8,
}Expand description
One entry of the table that turns a wanted power into what the chain is set to.
A concentrator is not told a number of decibels. It is told an amplifier setting and an index into the front end’s own power steps, and which pair gives which radiated power is a property of the board: its amplifier, its filters, and its losses. So the table belongs to whoever built the gateway, and the one here is the reference design’s.
Fields§
§radiated_dbm: i8What this entry radiates, in dBm.
amplifier: u8The external amplifier setting. Anything above zero switches it on.
power_index: u8The index into the front end’s power steps.
digital_gain: u8The digital gain applied ahead of the front end.
offset_i: i8The calibrated offset of the in-phase channel.
offset_q: i8The calibrated offset of the quadrature channel.
Implementations§
Source§impl Gain
impl Gain
Sourcepub const fn power_value(&self) -> u8
pub const fn power_value(&self) -> u8
What the power register takes for this entry.
§Returns
The amplifier bit above the power index, which is how an SX1250 board is set.
§Examples
use pamoja_radios::sx1302::tx::DEFAULT_GAINS;
// The lowest entry runs the amplifier off, so only the index is carried.
assert_eq!(DEFAULT_GAINS[0].power_value(), 15);
// The highest runs it on, which is the bit above.
assert_eq!(DEFAULT_GAINS[15].power_value(), 0x40 | 14);