Make settings configurable
This commit is contained in:
parent
af845b7d44
commit
1f36da5ca6
1 changed files with 7 additions and 3 deletions
|
@ -41,6 +41,8 @@ pub struct SubGhzRadio<'d, RS> {
|
||||||
pub struct SubGhzRadioConfig {
|
pub struct SubGhzRadioConfig {
|
||||||
pub reg_mode: RegMode,
|
pub reg_mode: RegMode,
|
||||||
pub calibrate_image: CalibrateImage,
|
pub calibrate_image: CalibrateImage,
|
||||||
|
pub pa_config: PaConfig,
|
||||||
|
pub tx_params: TxParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, RS: RadioSwitch> SubGhzRadio<'d, RS> {
|
impl<'d, RS: RadioSwitch> SubGhzRadio<'d, RS> {
|
||||||
|
@ -155,8 +157,10 @@ impl<'d, RS: RadioSwitch> SubGhzRadio<'d, RS> {
|
||||||
|
|
||||||
self.radio.set_buffer_base_address(0, 0)?;
|
self.radio.set_buffer_base_address(0, 0)?;
|
||||||
|
|
||||||
|
// NOTE: Upper layer handles timeout by cancelling the future
|
||||||
self.radio
|
self.radio
|
||||||
.set_rx(Timeout::from_millis_sat(self.get_rx_window_duration_ms()))?;
|
.set_rx(Timeout::DISABLED)?;
|
||||||
|
|
||||||
trace!("RX started");
|
trace!("RX started");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -221,8 +225,8 @@ fn configure_radio(radio: &mut SubGhz<'_, NoDma, NoDma>, config: SubGhzRadioConf
|
||||||
radio.calibrate(0x7F)?;
|
radio.calibrate(0x7F)?;
|
||||||
radio.calibrate_image(config.calibrate_image)?;
|
radio.calibrate_image(config.calibrate_image)?;
|
||||||
|
|
||||||
radio.set_pa_config(&PaConfig::HP_14)?;
|
radio.set_pa_config(&config.pa_config)?;
|
||||||
radio.set_tx_params(&TxParams::HP.set_ramp_time(RampTime::Micros40))?;
|
radio.set_tx_params(&config.tx_params)?;
|
||||||
radio.set_pa_ocp(Ocp::Max140m)?;
|
radio.set_pa_ocp(Ocp::Max140m)?;
|
||||||
|
|
||||||
radio.set_packet_type(PacketType::LoRa)?;
|
radio.set_packet_type(PacketType::LoRa)?;
|
||||||
|
|
Loading…
Reference in a new issue