partial alternate function configuration on STM32f1
This commit is contained in:
@ -105,6 +105,7 @@ macro_rules! impl_pin {
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(rcc_f1))]
|
||||
crate::pac::peripheral_pins!(
|
||||
($inst:ident, spi, SPI, $pin:ident, SCK, $af:expr) => {
|
||||
impl_pin!($inst, $pin, SckPin, $af);
|
||||
@ -119,6 +120,21 @@ crate::pac::peripheral_pins!(
|
||||
};
|
||||
);
|
||||
|
||||
#[cfg(rcc_f1)]
|
||||
crate::pac::peripheral_pins!(
|
||||
($inst:ident, spi, SPI, $pin:ident, SCK) => {
|
||||
impl_pin!($inst, $pin, SckPin, 0);
|
||||
};
|
||||
|
||||
($inst:ident, spi, SPI, $pin:ident, MOSI) => {
|
||||
impl_pin!($inst, $pin, MosiPin, 0);
|
||||
};
|
||||
|
||||
($inst:ident, spi, SPI, $pin:ident, MISO) => {
|
||||
impl_pin!($inst, $pin, MisoPin, 0);
|
||||
};
|
||||
);
|
||||
|
||||
macro_rules! impl_dma {
|
||||
($inst:ident, {dmamux: $dmamux:ident}, $signal:ident, $request:expr) => {
|
||||
impl<T> sealed::$signal<peripherals::$inst> for T
|
||||
|
@ -3,7 +3,7 @@
|
||||
use crate::dma::NoDma;
|
||||
use crate::gpio::{
|
||||
sealed::{
|
||||
OutputType::{OpenDrain, PushPull},
|
||||
AFType::{OutputOpenDrain, OutputPushPull},
|
||||
Pin,
|
||||
},
|
||||
AnyPin,
|
||||
@ -59,9 +59,9 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
|
||||
unborrow!(sck, mosi, miso, txdma, rxdma);
|
||||
|
||||
unsafe {
|
||||
sck.set_as_af(sck.af_num(), PushPull);
|
||||
mosi.set_as_af(mosi.af_num(), PushPull);
|
||||
miso.set_as_af(miso.af_num(), OpenDrain);
|
||||
sck.set_as_af(sck.af_num(), OutputPushPull);
|
||||
mosi.set_as_af(mosi.af_num(), OutputPushPull);
|
||||
miso.set_as_af(miso.af_num(), OutputOpenDrain);
|
||||
}
|
||||
|
||||
let sck = sck.degrade();
|
||||
|
Reference in New Issue
Block a user