stm32/pwm: add output type control
This commit is contained in:
@ -4,6 +4,7 @@ use core::convert::Infallible;
|
||||
use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef};
|
||||
|
||||
use crate::pac::gpio::{self, vals};
|
||||
use crate::usb_otg::Out;
|
||||
use crate::{pac, peripherals, Peripheral};
|
||||
|
||||
/// GPIO flexible pin.
|
||||
@ -502,6 +503,20 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub enum OutputType {
|
||||
PushPull,
|
||||
OpenDrain,
|
||||
}
|
||||
|
||||
impl From<OutputType> for sealed::AFType {
|
||||
fn from(value: OutputType) -> Self {
|
||||
match value {
|
||||
OutputType::OpenDrain => sealed::AFType::OutputOpenDrain,
|
||||
OutputType::PushPull => sealed::AFType::OutputPushPull,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
use super::*;
|
||||
|
||||
|
Reference in New Issue
Block a user