move psel back out of if
This commit is contained in:
parent
ef95441442
commit
6d8198a46a
1 changed files with 9 additions and 4 deletions
|
@ -167,24 +167,28 @@ impl<'d, T: Instance> Pwm<'d, T> {
|
||||||
if let Some(pin) = ch0.pin_mut() {
|
if let Some(pin) = ch0.pin_mut() {
|
||||||
pin.set_low();
|
pin.set_low();
|
||||||
pin.conf().write(|w| w.dir().output());
|
pin.conf().write(|w| w.dir().output());
|
||||||
r.psel.out[0].write(|w| unsafe { w.bits(ch0.psel_bits()) });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(pin) = ch1.pin_mut() {
|
if let Some(pin) = ch1.pin_mut() {
|
||||||
pin.set_low();
|
pin.set_low();
|
||||||
pin.conf().write(|w| w.dir().output());
|
pin.conf().write(|w| w.dir().output());
|
||||||
r.psel.out[1].write(|w| unsafe { w.bits(ch1.psel_bits()) });
|
|
||||||
}
|
}
|
||||||
if let Some(pin) = ch2.pin_mut() {
|
if let Some(pin) = ch2.pin_mut() {
|
||||||
pin.set_low();
|
pin.set_low();
|
||||||
pin.conf().write(|w| w.dir().output());
|
pin.conf().write(|w| w.dir().output());
|
||||||
r.psel.out[2].write(|w| unsafe { w.bits(ch2.psel_bits()) });
|
|
||||||
}
|
}
|
||||||
if let Some(pin) = ch3.pin_mut() {
|
if let Some(pin) = ch3.pin_mut() {
|
||||||
pin.set_low();
|
pin.set_low();
|
||||||
pin.conf().write(|w| w.dir().output());
|
pin.conf().write(|w| w.dir().output());
|
||||||
r.psel.out[3].write(|w| unsafe { w.bits(ch3.psel_bits()) });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if NoPin provided writes disconnected (top bit 1) 0x80000000 else
|
||||||
|
// writes pin number ex 13 (0x0D) which is connected (top bit 0)
|
||||||
|
r.psel.out[0].write(|w| unsafe { w.bits(ch0.psel_bits()) });
|
||||||
|
r.psel.out[1].write(|w| unsafe { w.bits(ch1.psel_bits()) });
|
||||||
|
r.psel.out[2].write(|w| unsafe { w.bits(ch2.psel_bits()) });
|
||||||
|
r.psel.out[3].write(|w| unsafe { w.bits(ch3.psel_bits()) });
|
||||||
|
|
||||||
r.enable.write(|w| w.enable().enabled());
|
r.enable.write(|w| w.enable().enabled());
|
||||||
|
|
||||||
r.mode
|
r.mode
|
||||||
|
@ -323,6 +327,7 @@ impl<'d, T: Instance> Pwm<'d, T> {
|
||||||
impl<'a, T: Instance> Drop for Pwm<'a, T> {
|
impl<'a, T: Instance> Drop for Pwm<'a, T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
|
|
||||||
r.enable.write(|w| w.enable().disabled());
|
r.enable.write(|w| w.enable().disabled());
|
||||||
|
|
||||||
info!("pwm drop: done");
|
info!("pwm drop: done");
|
||||||
|
|
Loading…
Reference in a new issue