@@ -292,6 +292,26 @@ pub struct Driver<'d, T: Instance> {
292
292
}
293
293
294
294
impl < ' d , T : Instance > Driver < ' d , T > {
295
+ /// Create a new USB driver with start-of-frame (SOF) output.
296
+ pub fn new_with_sof (
297
+ _usb : impl Peripheral < P = T > + ' d ,
298
+ _irq : impl interrupt:: typelevel:: Binding < T :: Interrupt , InterruptHandler < T > > + ' d ,
299
+ dp : impl Peripheral < P = impl DpPin < T > > + ' d ,
300
+ dm : impl Peripheral < P = impl DmPin < T > > + ' d ,
301
+ sof : impl Peripheral < P = impl SofPin < T > > + ' d ,
302
+ ) -> Self {
303
+ into_ref ! ( sof) ;
304
+ #[ cfg( not( stm32l1) ) ]
305
+ {
306
+ use crate :: gpio:: { AfType , OutputType , Speed } ;
307
+ sof. set_as_af ( sof. af_num ( ) , AfType :: output ( OutputType :: PushPull , Speed :: VeryHigh ) ) ;
308
+ }
309
+ #[ cfg( stm32l1) ]
310
+ let _ = sof; // suppress "unused" warning.
311
+
312
+ Self :: new ( _usb, _irq, dp, dm)
313
+ }
314
+
295
315
/// Create a new USB driver.
296
316
pub fn new (
297
317
_usb : impl Peripheral < P = T > + ' d ,
@@ -1221,6 +1241,7 @@ pub trait Instance: SealedInstance + RccPeripheral + 'static {
1221
1241
// Internal PHY pins
1222
1242
pin_trait ! ( DpPin , Instance ) ;
1223
1243
pin_trait ! ( DmPin , Instance ) ;
1244
+ pin_trait ! ( SofPin , Instance ) ;
1224
1245
1225
1246
foreach_interrupt ! (
1226
1247
( $inst: ident, usb, $block: ident, LP , $irq: ident) => {
0 commit comments