fix: check if sck is some before setting high or low

This commit is contained in:
swanandx 2024-01-03 19:35:30 +05:30
parent 046af81a10
commit bdaf722cb8

View File

@ -165,13 +165,17 @@ impl<'d, T: Instance> Spim<'d, T> {
match config.mode.polarity { match config.mode.polarity {
Polarity::IdleHigh => { Polarity::IdleHigh => {
if let Some(sck) = &sck {
sck.set_high(); sck.set_high();
}
if let Some(mosi) = &mosi { if let Some(mosi) = &mosi {
mosi.set_high(); mosi.set_high();
} }
} }
Polarity::IdleLow => { Polarity::IdleLow => {
if let Some(sck) = &sck {
sck.set_low(); sck.set_low();
}
if let Some(mosi) = &mosi { if let Some(mosi) = &mosi {
mosi.set_low(); mosi.set_low();
} }