spi_slave: auto deselect chip
This commit is contained in:
parent
8547610661
commit
6e6e500f8a
|
@ -49,7 +49,9 @@ where
|
||||||
fn transfer<'w>(&mut self, words: &'w mut[u8]) -> Result<&'w [u8], Self::Error> {
|
fn transfer<'w>(&mut self, words: &'w mut[u8]) -> Result<&'w [u8], Self::Error> {
|
||||||
self.0.do_on_get_ref_mut_data(move |mut dev| {
|
self.0.do_on_get_ref_mut_data(move |mut dev| {
|
||||||
dev.select_chip(self.1);
|
dev.select_chip(self.1);
|
||||||
dev.spi.transfer(words).map_err(Error::SPI)
|
let result = dev.spi.transfer(words).map_err(Error::SPI);
|
||||||
|
dev.select_chip(0);
|
||||||
|
result
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue