From eb376cf47b4ad485394f433dd2452e2b93db11ee Mon Sep 17 00:00:00 2001 From: Nic0w Date: Thu, 29 Apr 2021 20:02:36 +0200 Subject: [PATCH] Using modify() to clear specific bits instead of a blanket 0 on all bits. --- rp2040-hal/src/pll.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/rp2040-hal/src/pll.rs b/rp2040-hal/src/pll.rs index 5626868..cccfb6e 100644 --- a/rp2040-hal/src/pll.rs +++ b/rp2040-hal/src/pll.rs @@ -199,10 +199,9 @@ impl PhaseLockedLoop { }); // Turn on self.device - self.device.pwr.write(|w| unsafe { - //w.pd().clear_bit(); - //w.vcopd().clear_bit(); - w.bits(0); + self.device.pwr.modify(|_,w| { + w.pd().clear_bit(); + w.vcopd().clear_bit(); w }); @@ -245,9 +244,8 @@ impl PhaseLockedLoop { }); // Turn on post divider - self.device.pwr.write(|w| unsafe { - //w.postdivpd().clear_bit(); - w.bits(0); + self.device.pwr.modify(|_,w| { + w.postdivpd().clear_bit(); w });