Make exti an optional feature
* Add embassy-stm32 build with exti * Add exti to examples
This commit is contained in:
@ -41,6 +41,7 @@ sdmmc-rs = ["embedded-sdmmc"]
|
||||
net = ["embassy-net", "vcell"]
|
||||
memory-x = ["stm32-metapac/memory-x"]
|
||||
subghz = []
|
||||
exti = []
|
||||
|
||||
# Features starting with `_` are for internal use only. They're not intended
|
||||
# to be enabled by other crates, and are not covered by semver guarantees.
|
||||
|
@ -480,6 +480,7 @@ pub(crate) mod sealed {
|
||||
}
|
||||
|
||||
pub trait Pin: sealed::Pin + Sized {
|
||||
#[cfg(feature = "exti")]
|
||||
type ExtiChannel: crate::exti::Channel;
|
||||
|
||||
/// Number of the pin within the port (0..31)
|
||||
@ -527,6 +528,7 @@ impl AnyPin {
|
||||
|
||||
unsafe_impl_unborrow!(AnyPin);
|
||||
impl Pin for AnyPin {
|
||||
#[cfg(feature = "exti")]
|
||||
type ExtiChannel = crate::exti::AnyChannel;
|
||||
}
|
||||
impl sealed::Pin for AnyPin {
|
||||
@ -589,6 +591,7 @@ impl OptionalPin for NoPin {
|
||||
crate::pac::pins!(
|
||||
($pin_name:ident, $port_name:ident, $port_num:expr, $pin_num:expr, $exti_ch:ident) => {
|
||||
impl Pin for peripherals::$pin_name {
|
||||
#[cfg(feature = "exti")]
|
||||
type ExtiChannel = peripherals::$exti_ch;
|
||||
}
|
||||
impl sealed::Pin for peripherals::$pin_name {
|
||||
|
@ -33,7 +33,7 @@ pub mod dac;
|
||||
pub mod dcmi;
|
||||
#[cfg(all(eth, feature = "net"))]
|
||||
pub mod eth;
|
||||
#[cfg(exti)]
|
||||
#[cfg(feature = "exti")]
|
||||
pub mod exti;
|
||||
#[cfg(i2c)]
|
||||
pub mod i2c;
|
||||
@ -99,7 +99,7 @@ pub fn init(config: Config) -> Peripherals {
|
||||
|
||||
gpio::init();
|
||||
dma::init();
|
||||
#[cfg(exti)]
|
||||
#[cfg(feature = "exti")]
|
||||
exti::init();
|
||||
|
||||
rcc::init(config.rcc);
|
||||
|
Reference in New Issue
Block a user