diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index c9ed196e..9e10a8b0 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs @@ -5,7 +5,7 @@ use embassy::util::Unborrow; use embassy_hal_common::unborrow; use crate::gpio::{ - OutputType::{OpenDrain, PushPull}, + sealed::OutputType::{OpenDrain, PushPull}, Pin, }; use crate::{peripherals, rcc::RccPeripheral}; diff --git a/embassy-stm32/src/eth/v2/mod.rs b/embassy-stm32/src/eth/v2/mod.rs index 5d4151ec..8eb7c339 100644 --- a/embassy-stm32/src/eth/v2/mod.rs +++ b/embassy-stm32/src/eth/v2/mod.rs @@ -10,7 +10,7 @@ use embassy_net::{Device, DeviceCapabilities, LinkState, PacketBuf, MTU}; use crate::gpio::sealed::Pin as __GpioPin; use crate::gpio::Pin as GpioPin; -use crate::gpio::{AnyPin, OutputType::PushPull}; +use crate::gpio::{sealed::OutputType::PushPull, AnyPin}; use crate::pac::gpio::vals::Ospeedr; use crate::pac::{ETH, RCC, SYSCFG}; use crate::peripherals; diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index d5792d6f..14f2559e 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs @@ -55,14 +55,6 @@ impl From for vals::Ospeedr { } } -/// Type settings -#[derive(Debug)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub enum OutputType { - PushPull, - OpenDrain, -} - /// GPIO input driver. pub struct Input<'d, T: Pin> { pub(crate) pin: T, @@ -272,6 +264,14 @@ impl<'d, T: Pin> InputPin for OutputOpenDrain<'d, T> { pub(crate) mod sealed { use super::*; + /// Output type settings + #[derive(Debug)] + #[cfg_attr(feature = "defmt", derive(defmt::Format))] + pub enum OutputType { + PushPull, + OpenDrain, + } + pub trait Pin { fn pin_port(&self) -> u8; diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index c7b7c81f..c5d5dee0 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs @@ -9,7 +9,7 @@ use embedded_hal::blocking::i2c::WriteRead; use crate::pac::i2c; -use crate::gpio::OutputType::OpenDrain; +use crate::gpio::sealed::OutputType::OpenDrain; pub struct I2c<'d, T: Instance> { phantom: PhantomData<&'d mut T>, diff --git a/embassy-stm32/src/spi/v1.rs b/embassy-stm32/src/spi/v1.rs index 297d232b..53d8252e 100644 --- a/embassy-stm32/src/spi/v1.rs +++ b/embassy-stm32/src/spi/v1.rs @@ -2,9 +2,11 @@ use crate::dma::NoDma; use crate::gpio::{ - sealed::Pin, + sealed::{ + OutputType::{OpenDrain, PushPull}, + Pin, + }, AnyPin, - OutputType::{OpenDrain, PushPull}, }; use crate::pac::spi; use crate::spi::{ diff --git a/embassy-stm32/src/usart/v1.rs b/embassy-stm32/src/usart/v1.rs index 16c1af38..d1dd6830 100644 --- a/embassy-stm32/src/usart/v1.rs +++ b/embassy-stm32/src/usart/v1.rs @@ -1,4 +1,4 @@ -use crate::gpio::OutputType::{OpenDrain, PushPull}; +use crate::gpio::sealed::OutputType::{OpenDrain, PushPull}; use core::future::Future; use core::marker::PhantomData; use embassy::util::Unborrow; diff --git a/embassy-stm32/src/usart/v2.rs b/embassy-stm32/src/usart/v2.rs index e3f88c0a..5e669635 100644 --- a/embassy-stm32/src/usart/v2.rs +++ b/embassy-stm32/src/usart/v2.rs @@ -13,7 +13,7 @@ use futures::TryFutureExt; use super::*; use crate::dma::NoDma; -use crate::gpio::OutputType::{OpenDrain, PushPull}; +use crate::gpio::sealed::OutputType::{OpenDrain, PushPull}; use crate::pac::usart::{regs, vals}; pub struct Uart<'d, T: Instance, TxDma = NoDma, RxDma = NoDma> {