summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-03 17:47:37 +0700
committerhathach <[email protected]>2018-12-03 17:47:37 +0700
commit9e33f19378da1e19568714797698b6b62296924f (patch)
treeb1336184acabb34fc740e6e8f1d2293ab6428e80 /src
parent72db014f2c63ec2677ad95e737e16f5e7118fc9e (diff)
clean up
Diffstat (limited to 'src')
-rw-r--r--src/portable/nxp/lpc17xx/hal_lpc175x_6x.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/portable/nxp/lpc17xx/hal_lpc175x_6x.c b/src/portable/nxp/lpc17xx/hal_lpc175x_6x.c
index d01c9e29d..bc61178d8 100644
--- a/src/portable/nxp/lpc17xx/hal_lpc175x_6x.c
+++ b/src/portable/nxp/lpc17xx/hal_lpc175x_6x.c
@@ -44,13 +44,13 @@
void tusb_hal_int_enable(uint8_t rhport)
{
- (void) rhport; // discard compiler's warning
+ (void) rhport;
NVIC_EnableIRQ(USB_IRQn);
}
void tusb_hal_int_disable(uint8_t rhport)
{
- (void) rhport; // discard compiler's warning
+ (void) rhport;
NVIC_DisableIRQ(USB_IRQn);
}
@@ -66,7 +66,6 @@ bool tusb_hal_init(void)
Chip_USB_Init();
- //------------- user manual 11.13 usb device controller initialization -------------//
/* 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, 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 = 19, .Funcnum = 2} ); // P1.19 as USB_PPWR
+ // Enable host
LPC_USB->USBClkCtrl = USBCLK_HOST;
while ((LPC_USB->USBClkSt & USBCLK_HOST) != USBCLK_HOST);
LPC_USB->OTGStCtrl = 0x3;
#endif
#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);
-#if 0
- // 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
-
+ // Enable Device
LPC_USB->USBClkCtrl = USBCLK_DEVCIE;
while ((LPC_USB->USBClkSt & USBCLK_DEVCIE) != USBCLK_DEVCIE);
#endif