nrf: Specify connected bit in psel_bits

This commit is contained in:
Dario Nieuwenhuis 2021-03-21 20:52:20 +01:00
parent f36cbe5e0c
commit 16bb6fd6ac

View File

@ -55,9 +55,9 @@ impl<'d, T: Instance> Spim<'d, T> {
let r = spim.regs(); let r = spim.regs();
// Configure pins // Configure pins
sck.conf().write(|w| w.dir().output()); sck.conf().write(|w| w.dir().output().drive().h0h1());
mosi.conf().write(|w| w.dir().output()); mosi.conf().write(|w| w.dir().output().drive().h0h1());
miso.conf().write(|w| w.input().connect()); miso.conf().write(|w| w.input().connect().drive().h0h1());
match config.mode.polarity { match config.mode.polarity {
Polarity::IdleHigh => { Polarity::IdleHigh => {
@ -71,18 +71,9 @@ impl<'d, T: Instance> Spim<'d, T> {
} }
// Select pins. // Select pins.
r.psel.sck.write(|w| { r.psel.sck.write(|w| unsafe { w.bits(sck.psel_bits()) });
unsafe { w.bits(sck.psel_bits()) }; r.psel.mosi.write(|w| unsafe { w.bits(mosi.psel_bits()) });
w.connect().connected() r.psel.miso.write(|w| unsafe { w.bits(miso.psel_bits()) });
});
r.psel.mosi.write(|w| {
unsafe { w.bits(mosi.psel_bits()) };
w.connect().connected()
});
r.psel.miso.write(|w| {
unsafe { w.bits(miso.psel_bits()) };
w.connect().connected()
});
// Enable SPIM instance. // Enable SPIM instance.
r.enable.write(|w| w.enable().enabled()); r.enable.write(|w| w.enable().enabled());