Skip to content

Commit

Permalink
Get rid of unnecessary if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
playfulFence committed Aug 12, 2024
1 parent fbcd7c4 commit f111ae1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
15 changes: 3 additions & 12 deletions esp-hal/src/rtc_cntl/sleep/esp32c3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,10 @@ fn rtc_sleep_pu(val: bool) {
});
}

if val {
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().set_bit());
} else {
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().clear_bit());
}
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().bit(val));

if val {
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().set_bit());
} else {
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().clear_bit());
}
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().bit(val));

syscon.mem_power_up().modify(|_r, w| unsafe {
w.sram_power_up()
Expand Down
15 changes: 3 additions & 12 deletions esp-hal/src/rtc_cntl/sleep/esp32s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,10 @@ fn rtc_sleep_pu(val: bool) {
});
}

if val {
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().set_bit());
} else {
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().clear_bit());
}
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().bit(val));

if val {
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().set_bit());
} else {
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().clear_bit());
}
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().bit(val));

syscon.mem_power_up().modify(|_r, w| unsafe {
w.sram_power_up()
Expand Down
4 changes: 2 additions & 2 deletions examples/src/bin/wifi_dhcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ use smoltcp::{
wire::{IpAddress, Ipv4Address},
};

const SSID: &str = "EspressifSystems";
const PASSWORD: &str = "Espressif32";
const SSID: &str = env!("SSID");
const PASSWORD: &str = env!("PASSWORD");

#[entry]
fn main() -> ! {
Expand Down

0 comments on commit f111ae1

Please sign in to comment.