From 736cbdc276f2c03a547ce8d9f58f0117bb732789 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 13 Dec 2013 12:41:29 +0700 Subject: [PATCH] using PINSEL_ConfigPin for setting pinsel --- tinyusb/hal/hal_lpc175x_6x.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tinyusb/hal/hal_lpc175x_6x.c b/tinyusb/hal/hal_lpc175x_6x.c index 5398e930..d36d5837 100644 --- a/tinyusb/hal/hal_lpc175x_6x.c +++ b/tinyusb/hal/hal_lpc175x_6x.c @@ -59,14 +59,12 @@ tusb_error_t hal_init(void) LPC_SC->PCONP |= CLKPWR_PCONP_PCUSB; // enable USB Peripherals //------------- user manual 11.13 usb device controller initialization -------------// - LPC_PINCON->PINSEL1 = bit_set_range(LPC_PINCON->PINSEL1, 26, 27, BIN8(01)); // P0.29 as D+ - LPC_PINCON->PINSEL1 = bit_set_range(LPC_PINCON->PINSEL1, 28, 29, BIN8(01)); // P0.30 as D- + PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 0, .Pinnum = 29, .Funcnum = 1} ); // P0.29 as D+ + PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 0, .Pinnum = 30, .Funcnum = 1} ); // P0.30 as D- #if MODE_HOST_SUPPORTED - LPC_PINCON->PINSEL3 = bit_set_range(LPC_PINCON->PINSEL3, 12, 23, BIN8(10)); // P1.22 as USB_PWRD -// PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 22, -// .Funcnum = 2, .Pinmode = PINSEL_PINMODE_PULLUP} ); - LPC_PINCON->PINSEL3 = bit_set_range(LPC_PINCON->PINSEL3, 6, 7, BIN8(10)); // P1.19 as USB_PPWR + 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 LPC_USB->USBClkCtrl = USBCLK_HOST; while ((LPC_USB->USBClkSt & USBCLK_HOST) != USBCLK_HOST);