Merge pull request #3502 from embassy-rs/fix-pwm

nrf/pwm: fix bad pin assignment, disconnect input.
This commit is contained in:
Dario Nieuwenhuis 2024-11-04 17:47:42 +00:00 committed by GitHub
commit f55ebef380
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,6 +132,7 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
pin.set_low();
pin.conf().write(|w| {
w.set_dir(gpiovals::Dir::OUTPUT);
w.set_input(gpiovals::Input::DISCONNECT);
w.set_drive(convert_drive(config.ch0_drive));
});
}
@ -139,6 +140,7 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
pin.set_low();
pin.conf().write(|w| {
w.set_dir(gpiovals::Dir::OUTPUT);
w.set_input(gpiovals::Input::DISCONNECT);
w.set_drive(convert_drive(config.ch1_drive));
});
}
@ -146,6 +148,7 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
pin.set_low();
pin.conf().write(|w| {
w.set_dir(gpiovals::Dir::OUTPUT);
w.set_input(gpiovals::Input::DISCONNECT);
w.set_drive(convert_drive(config.ch2_drive));
});
}
@ -153,6 +156,7 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
pin.set_low();
pin.conf().write(|w| {
w.set_dir(gpiovals::Dir::OUTPUT);
w.set_input(gpiovals::Input::DISCONNECT);
w.set_drive(convert_drive(config.ch3_drive));
});
}
@ -679,9 +683,14 @@ impl<'d, T: Instance> SimplePwm<'d, T> {
for (i, ch) in [&ch0, &ch1, &ch2, &ch3].into_iter().enumerate() {
if let Some(pin) = ch {
pin.set_low();
pin.conf().write(|w| w.set_dir(gpiovals::Dir::OUTPUT));
pin.conf().write(|w| {
w.set_dir(gpiovals::Dir::OUTPUT);
w.set_input(gpiovals::Input::DISCONNECT);
w.set_drive(gpiovals::Drive::S0S1);
});
}
r.psel().out(i).write_value(ch0.psel_bits());
r.psel().out(i).write_value(ch.psel_bits());
}
let pwm = Self {