Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
sx127x: Separate code path for continuous mode operation for sx1276+
Browse files Browse the repository at this point in the history
As set_tx_continuous_wave_mode touches some of the chip-specific
parameters, split the code to chip-specific implementations.
  • Loading branch information
plaes committed Nov 8, 2023
1 parent da7ed97 commit d6d50f8
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/sx1276_7_8_9/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,20 @@ where
}
/// Set the LoRa chip into the TxContinuousWave mode
async fn set_tx_continuous_wave_mode(&mut self) -> Result<(), RadioError> {
self.intf.iv.enable_rf_switch_rx().await?;
let pa_config = self.read_register(Register::RegPaConfig).await?;
let new_pa_config = pa_config | 0b1000_0000;
self.write_register(Register::RegPaConfig, new_pa_config, false).await?;
self.write_register(Register::RegOpMode, 0b1100_0011, false).await?;
let modem_config = self.read_register(Register::RegModemConfig2).await?;
let new_modem_config = modem_config | 0b0000_1000;
self.write_register(Register::RegModemConfig2, new_modem_config, false)
.await
match self.config.chip {
Sx127xVariant::Sx1272 => todo!(),
Sx127xVariant::Sx1276 => {
self.intf.iv.enable_rf_switch_rx().await?;
let pa_config = self.read_register(Register::RegPaConfig).await?;
let new_pa_config = pa_config | 0b1000_0000;
self.write_register(Register::RegPaConfig, new_pa_config, false).await?;
self.write_register(Register::RegOpMode, 0b1100_0011, false).await?;
let modem_config = self.read_register(Register::RegModemConfig2).await?;
let new_modem_config = modem_config | 0b0000_1000;
self.write_register(Register::RegModemConfig2, new_modem_config, false)
.await?;
}
}
Ok(())
}
}

0 comments on commit d6d50f8

Please sign in to comment.