mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-20 18:40:57 +00:00
clean up
This commit is contained in:
parent
72db014f2c
commit
9e33f19378
@ -44,13 +44,13 @@
|
|||||||
|
|
||||||
void tusb_hal_int_enable(uint8_t rhport)
|
void tusb_hal_int_enable(uint8_t rhport)
|
||||||
{
|
{
|
||||||
(void) rhport; // discard compiler's warning
|
(void) rhport;
|
||||||
NVIC_EnableIRQ(USB_IRQn);
|
NVIC_EnableIRQ(USB_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tusb_hal_int_disable(uint8_t rhport)
|
void tusb_hal_int_disable(uint8_t rhport)
|
||||||
{
|
{
|
||||||
(void) rhport; // discard compiler's warning
|
(void) rhport;
|
||||||
NVIC_DisableIRQ(USB_IRQn);
|
NVIC_DisableIRQ(USB_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,6 @@ bool tusb_hal_init(void)
|
|||||||
|
|
||||||
Chip_USB_Init();
|
Chip_USB_Init();
|
||||||
|
|
||||||
//------------- user manual 11.13 usb device controller initialization -------------//
|
|
||||||
/* Configure P0.29 as D+, P0.30 as D- */
|
/* Configure P0.29 as D+, P0.30 as D- */
|
||||||
Chip_IOCON_PinMux(LPC_IOCON, 0, 29, IOCON_MODE_INACT, IOCON_FUNC1);
|
Chip_IOCON_PinMux(LPC_IOCON, 0, 29, IOCON_MODE_INACT, IOCON_FUNC1);
|
||||||
Chip_IOCON_PinMux(LPC_IOCON, 0, 30, IOCON_MODE_INACT, IOCON_FUNC1);
|
Chip_IOCON_PinMux(LPC_IOCON, 0, 30, IOCON_MODE_INACT, IOCON_FUNC1);
|
||||||
@ -75,27 +74,17 @@ bool tusb_hal_init(void)
|
|||||||
PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 22, .Funcnum = 2} ); // P1.22 as USB_PWRD
|
PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 22, .Funcnum = 2} ); // P1.22 as USB_PWRD
|
||||||
PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 19, .Funcnum = 2} ); // P1.19 as USB_PPWR
|
PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 19, .Funcnum = 2} ); // P1.19 as USB_PPWR
|
||||||
|
|
||||||
|
// Enable host
|
||||||
LPC_USB->USBClkCtrl = USBCLK_HOST;
|
LPC_USB->USBClkCtrl = USBCLK_HOST;
|
||||||
while ((LPC_USB->USBClkSt & USBCLK_HOST) != USBCLK_HOST);
|
while ((LPC_USB->USBClkSt & USBCLK_HOST) != USBCLK_HOST);
|
||||||
LPC_USB->OTGStCtrl = 0x3;
|
LPC_USB->OTGStCtrl = 0x3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TUSB_OPT_DEVICE_ENABLED
|
#if TUSB_OPT_DEVICE_ENABLED
|
||||||
// LPC_PINCON->PINSEL4 = bit_set_range(LPC_PINCON->PINSEL4, 18, 19, BIN8(01)); // P2_9 as USB Connect
|
// P2_9 as USB Connect
|
||||||
Chip_IOCON_PinMux(LPC_IOCON, 2, 9, IOCON_MODE_INACT, IOCON_FUNC1);
|
Chip_IOCON_PinMux(LPC_IOCON, 2, 9, IOCON_MODE_INACT, IOCON_FUNC1);
|
||||||
|
|
||||||
#if 0
|
// Enable Device
|
||||||
// P1_30 as VBUS, ignore if it is already in VBUS mode
|
|
||||||
if ( !(!BIT_TEST_(LPC_PINCON->PINSEL3, 28) && BIT_TEST_(LPC_PINCON->PINSEL3, 29)) )
|
|
||||||
{
|
|
||||||
// some board like lpcxpresso1769 does not connect VBUS signal to pin P1_30, this allow those board to overwrite
|
|
||||||
// by always pulling P1_30 to high
|
|
||||||
PINSEL_ConfigPin( &(PINSEL_CFG_Type) {
|
|
||||||
.Portnum = 1, .Pinnum = 30,
|
|
||||||
.Funcnum = 2, .Pinmode = PINSEL_PINMODE_PULLDOWN} );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LPC_USB->USBClkCtrl = USBCLK_DEVCIE;
|
LPC_USB->USBClkCtrl = USBCLK_DEVCIE;
|
||||||
while ((LPC_USB->USBClkSt & USBCLK_DEVCIE) != USBCLK_DEVCIE);
|
while ((LPC_USB->USBClkSt & USBCLK_DEVCIE) != USBCLK_DEVCIE);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user