Skip to content

Commit 0192b2a

Browse files
committed
dcd_pic: implement dcd_deinit()
1 parent f409472 commit 0192b2a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/portable/microchip/pic/dcd_pic.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,19 @@ bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
508508
return true;
509509
}
510510

511+
bool dcd_deinit(uint8_t rhport)
512+
{
513+
U1CON = 0;
514+
U1IE = 0;
515+
U1OTGIE = 0;
516+
#if TU_PIC_INT_SIZE == 4
517+
U1PWRCCLR = _U1PWRC_USUSPEND_MASK | _U1PWRC_USBPWR_MASK;
518+
#else
519+
U1PWRC &= ~(_U1PWRC_USUSPEND_MASK | _U1PWRC_USBPWR_MASK);
520+
#endif
521+
return true;
522+
}
523+
511524
void dcd_int_enable(uint8_t rhport)
512525
{
513526
intr_enable(rhport);

0 commit comments

Comments
 (0)