impl SetConfig for stm32 i2c and SPI

This commit is contained in:
Henrik Alsér
2022-07-09 02:28:05 +02:00
parent 85e67d94ad
commit 880b71a1e8
4 changed files with 47 additions and 0 deletions

View File

@ -3,6 +3,7 @@
use core::marker::PhantomData;
use core::ptr;
use embassy_embedded_hal::SetConfig;
use embassy_hal_common::unborrow;
pub use embedded_hal_02::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3};
use futures::future::join;
@ -1022,3 +1023,10 @@ foreach_peripheral!(
impl Instance for peripherals::$inst {}
};
);
impl<'d, T: Instance, Tx, Rx> SetConfig for Spi<'d, T, Tx, Rx> {
type Config = Config;
fn set_config(&mut self, config: &Self::Config) {
self.reconfigure(*config);
}
}