mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-27 20:30:29 +00:00
Merge pull request #3964 from elagil/sof_out_usb
Add optional USB driver SOF output
This commit is contained in:
commit
86572bf009
@ -876,6 +876,7 @@ fn main() {
|
||||
(("ltdc", "B7"), quote!(crate::ltdc::B7Pin)),
|
||||
(("usb", "DP"), quote!(crate::usb::DpPin)),
|
||||
(("usb", "DM"), quote!(crate::usb::DmPin)),
|
||||
(("usb", "SOF"), quote!(crate::usb::SofPin)),
|
||||
(("otg", "DP"), quote!(crate::usb::DpPin)),
|
||||
(("otg", "DM"), quote!(crate::usb::DmPin)),
|
||||
(("otg", "ULPI_CK"), quote!(crate::usb::UlpiClkPin)),
|
||||
|
@ -287,6 +287,24 @@ pub struct Driver<'d, T: Instance> {
|
||||
}
|
||||
|
||||
impl<'d, T: Instance> Driver<'d, T> {
|
||||
/// Create a new USB driver with start-of-frame (SOF) output.
|
||||
#[cfg(not(stm32l1))]
|
||||
pub fn new_with_sof(
|
||||
_usb: impl Peripheral<P = T> + 'd,
|
||||
_irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
|
||||
dp: impl Peripheral<P = impl DpPin<T>> + 'd,
|
||||
dm: impl Peripheral<P = impl DmPin<T>> + 'd,
|
||||
sof: impl Peripheral<P = impl SofPin<T>> + 'd,
|
||||
) -> Self {
|
||||
into_ref!(sof);
|
||||
{
|
||||
use crate::gpio::{AfType, OutputType, Speed};
|
||||
sof.set_as_af(sof.af_num(), AfType::output(OutputType::PushPull, Speed::VeryHigh));
|
||||
}
|
||||
|
||||
Self::new(_usb, _irq, dp, dm)
|
||||
}
|
||||
|
||||
/// Create a new USB driver.
|
||||
pub fn new(
|
||||
_usb: impl Peripheral<P = T> + 'd,
|
||||
@ -1216,6 +1234,7 @@ pub trait Instance: SealedInstance + RccPeripheral + 'static {
|
||||
// Internal PHY pins
|
||||
pin_trait!(DpPin, Instance);
|
||||
pin_trait!(DmPin, Instance);
|
||||
pin_trait!(SofPin, Instance);
|
||||
|
||||
foreach_interrupt!(
|
||||
($inst:ident, usb, $block:ident, LP, $irq:ident) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user