pub struct TxPower {
pub pa_config: u8,
pub pa_dac: u8,
pub ocp: u8,
pub output_dbm: i8,
}Expand description
The amplifier settings that produce an output power: RegPaConfig, RegPaDac, and RegOcp.
§Examples
use pamoja_radios::sx127x::config::{PaOutput, TxPower, PA_DAC_HIGH_POWER};
// +20 dBm on the PA_BOOST pin of an RFM95W.
let power = TxPower::for_output(PaOutput::PaBoost, 20);
assert_eq!(power.pa_config, 0xFF);
assert_eq!(power.pa_dac, PA_DAC_HIGH_POWER);
assert_eq!(power.output_dbm, 20);Fields§
§pa_config: u8RegPaConfig: PaSelect in bit 7, MaxPower in bits 6 to 4, OutputPower in bits 3 to 0.
pa_dac: u8RegPaDac: PA_DAC_HIGH_POWER above +17 dBm on PA_BOOST, else PA_DAC_DEFAULT.
ocp: u8RegOcp: a 140 mA limit with the high power setting, whose amplifier draws 120 mA at +20 dBm, and the 100 mA reset limit otherwise.
output_dbm: i8The output power these settings produce, in dBm.
Implementations§
Source§impl TxPower
impl TxPower
Sourcepub const fn for_output(output: PaOutput, output_dbm: i8) -> TxPower
pub const fn for_output(output: PaOutput, output_dbm: i8) -> TxPower
Chooses the settings for an output power.
The steps follow Semtech’s LoRaMac-node. On RFO, MaxPower 7 gives a +15 dBm maximum and OutputPower the power itself, and at 0 dBm and below MaxPower 0 and OutputPower the power plus 4, which lands 0.2 dB under. On PA_BOOST, OutputPower is the power less 2 up to +17 dBm, and with the high power setting the power less 5 above it.
§Arguments
output- the amplifier output the module uses.output_dbm- the output power wanted, clamped to what the output delivers.
§Returns
The settings.
Sourcepub fn under_ceiling(
output: PaOutput,
budget: &LinkBudget,
eirp_ceiling_dbm: Decibels,
) -> TxPower
pub fn under_ceiling( output: PaOutput, budget: &LinkBudget, eirp_ceiling_dbm: Decibels, ) -> TxPower
Chooses the settings that keep a link’s EIRP at or under a ceiling.
§Arguments
output- the amplifier output the module uses.budget- the link budget, whose transmitting antenna and cable apply.eirp_ceiling_dbm- the EIRP limit, such as a channel plan’s ceiling for the frequency in use.
§Returns
The settings, rounded down to whole decibels so the EIRP stays under the ceiling.
Sourcepub const fn output(&self) -> PaOutput
pub const fn output(&self) -> PaOutput
Returns the amplifier output these settings select.
§Returns
PaOutput::PaBoost when PaSelect is set, else PaOutput::Rfo.