diff --git a/embassy-stm32/src/subghz/pa_config.rs b/embassy-stm32/src/subghz/pa_config.rs index eccd065d..875827bd 100644 --- a/embassy-stm32/src/subghz/pa_config.rs +++ b/embassy-stm32/src/subghz/pa_config.rs @@ -13,58 +13,37 @@ impl PaConfig { /// Optimal settings for +15dBm output power with the low-power PA. /// /// This must be used with [`TxParams::LP_15`](super::TxParams::LP_15). - pub const LP_15: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x6) - .set_hp_max(0x0) - .set_pa(PaSel::Lp); + pub const LP_15: PaConfig = PaConfig::new().set_pa_duty_cycle(0x6).set_hp_max(0x0).set_pa(PaSel::Lp); /// Optimal settings for +14dBm output power with the low-power PA. /// /// This must be used with [`TxParams::LP_14`](super::TxParams::LP_14). - pub const LP_14: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x4) - .set_hp_max(0x0) - .set_pa(PaSel::Lp); + pub const LP_14: PaConfig = PaConfig::new().set_pa_duty_cycle(0x4).set_hp_max(0x0).set_pa(PaSel::Lp); /// Optimal settings for +10dBm output power with the low-power PA. /// /// This must be used with [`TxParams::LP_10`](super::TxParams::LP_10). - pub const LP_10: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x1) - .set_hp_max(0x0) - .set_pa(PaSel::Lp); + pub const LP_10: PaConfig = PaConfig::new().set_pa_duty_cycle(0x1).set_hp_max(0x0).set_pa(PaSel::Lp); /// Optimal settings for +22dBm output power with the high-power PA. /// /// This must be used with [`TxParams::HP`](super::TxParams::HP). - pub const HP_22: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x4) - .set_hp_max(0x7) - .set_pa(PaSel::Hp); + pub const HP_22: PaConfig = PaConfig::new().set_pa_duty_cycle(0x4).set_hp_max(0x7).set_pa(PaSel::Hp); /// Optimal settings for +20dBm output power with the high-power PA. /// /// This must be used with [`TxParams::HP`](super::TxParams::HP). - pub const HP_20: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x3) - .set_hp_max(0x5) - .set_pa(PaSel::Hp); + pub const HP_20: PaConfig = PaConfig::new().set_pa_duty_cycle(0x3).set_hp_max(0x5).set_pa(PaSel::Hp); /// Optimal settings for +17dBm output power with the high-power PA. /// /// This must be used with [`TxParams::HP`](super::TxParams::HP). - pub const HP_17: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x2) - .set_hp_max(0x3) - .set_pa(PaSel::Hp); + pub const HP_17: PaConfig = PaConfig::new().set_pa_duty_cycle(0x2).set_hp_max(0x3).set_pa(PaSel::Hp); /// Optimal settings for +14dBm output power with the high-power PA. /// /// This must be used with [`TxParams::HP`](super::TxParams::HP). - pub const HP_14: PaConfig = PaConfig::new() - .set_pa_duty_cycle(0x2) - .set_hp_max(0x2) - .set_pa(PaSel::Hp); + pub const HP_14: PaConfig = PaConfig::new().set_pa_duty_cycle(0x2).set_hp_max(0x2).set_pa(PaSel::Hp); /// Create a new `PaConfig` struct. /// diff --git a/embassy-stm32/src/subghz/packet_params.rs b/embassy-stm32/src/subghz/packet_params.rs index eef2f3db..d63641c4 100644 --- a/embassy-stm32/src/subghz/packet_params.rs +++ b/embassy-stm32/src/subghz/packet_params.rs @@ -147,10 +147,7 @@ impl GenericPacketParams { /// # assert_eq!(PKT_PARAMS.as_slice()[3], 0x4); /// ``` #[must_use = "set_preamble_detection returns a modified GenericPacketParams"] - pub const fn set_preamble_detection( - mut self, - pb_det: PreambleDetection, - ) -> GenericPacketParams { + pub const fn set_preamble_detection(mut self, pb_det: PreambleDetection) -> GenericPacketParams { self.buf[3] = pb_det as u8; self } diff --git a/embassy-stm32/src/subghz/rf_frequency.rs b/embassy-stm32/src/subghz/rf_frequency.rs index 97633c6b..3de2f50c 100644 --- a/embassy-stm32/src/subghz/rf_frequency.rs +++ b/embassy-stm32/src/subghz/rf_frequency.rs @@ -89,10 +89,7 @@ impl RfFreq { // Get the frequency bit value. const fn as_bits(&self) -> u32 { - ((self.buf[1] as u32) << 24) - | ((self.buf[2] as u32) << 16) - | ((self.buf[3] as u32) << 8) - | (self.buf[4] as u32) + ((self.buf[1] as u32) << 24) | ((self.buf[2] as u32) << 16) | ((self.buf[3] as u32) << 8) | (self.buf[4] as u32) } /// Get the actual frequency. diff --git a/embassy-stm32/src/subghz/sleep_cfg.rs b/embassy-stm32/src/subghz/sleep_cfg.rs index 0b67304b..0a50e970 100644 --- a/embassy-stm32/src/subghz/sleep_cfg.rs +++ b/embassy-stm32/src/subghz/sleep_cfg.rs @@ -49,9 +49,7 @@ impl SleepCfg { /// # assert_eq!(u8::from(SLEEP_CFG), 0b101); /// ``` pub const fn new() -> SleepCfg { - SleepCfg(0) - .set_startup(Startup::Warm) - .set_rtc_wakeup_en(true) + SleepCfg(0).set_startup(Startup::Warm).set_rtc_wakeup_en(true) } /// Set the startup mode. diff --git a/embassy-stm32/src/subghz/status.rs b/embassy-stm32/src/subghz/status.rs index f352d6fb..b84034f6 100644 --- a/embassy-stm32/src/subghz/status.rs +++ b/embassy-stm32/src/subghz/status.rs @@ -192,11 +192,6 @@ impl core::fmt::Debug for Status { #[cfg(feature = "defmt")] impl defmt::Format for Status { fn format(&self, fmt: defmt::Formatter) { - defmt::write!( - fmt, - "Status {{ mode: {}, cmd: {} }}", - self.mode(), - self.cmd() - ) + defmt::write!(fmt, "Status {{ mode: {}, cmd: {} }}", self.mode(), self.cmd()) } } diff --git a/embassy-stm32/src/subghz/timeout.rs b/embassy-stm32/src/subghz/timeout.rs index ccec3bbf..9dbdc637 100644 --- a/embassy-stm32/src/subghz/timeout.rs +++ b/embassy-stm32/src/subghz/timeout.rs @@ -145,8 +145,7 @@ impl Timeout { // `core::Duration` were not `const fn`, which leads to the hacks // you see here. let nanos: u128 = duration.as_nanos(); - const UPPER_LIMIT: u128 = - Timeout::MAX.as_nanos() as u128 + (Timeout::RESOLUTION_NANOS as u128) / 2; + const UPPER_LIMIT: u128 = Timeout::MAX.as_nanos() as u128 + (Timeout::RESOLUTION_NANOS as u128) / 2; const LOWER_LIMIT: u128 = (((Timeout::RESOLUTION_NANOS as u128) + 1) / 2) as u128; if nanos > UPPER_LIMIT {