tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
hal_lpc13uxx.c
Go to the documentation of this file.
1 /**************************************************************************/
37 /**************************************************************************/
38 
39 #include "common/common.h"
40 #include "hal.h"
41 
42 #if TUSB_CFG_MCU == MCU_LPC13UXX
43 
45 {
46  // TODO remove magic number
47  LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27)); /* Enable AHB clock to the USB block and USB RAM. */
48  LPC_SYSCON->PDRUNCFG &= ~( BIT_(8) | BIT_(10) ); // enable USB PLL & USB transceiver
49 
50  /* Pull-down is needed, or internally, VBUS will be floating. This is to
51  address the wrong status in VBUSDebouncing bit in CmdStatus register. */
52  // set PIO0_3 as USB_VBUS
53  LPC_IOCON->PIO0_3 &= ~0x1F;
54  LPC_IOCON->PIO0_3 |= (0x01<<0) | (1 << 3); /* Secondary function VBUS */
55 
56  // set PIO0_6 as usb connect
57  LPC_IOCON->PIO0_6 &= ~0x07;
58  LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
59 
60  return TUSB_ERROR_NONE;
61 }
62 
63 void USB_IRQHandler(void)
64 {
65  tusb_isr(0);
66 }
67 
68 #endif
#define BIT_(n)
n-th Bit
Definition: binary.h:54
tusb_error_t
Error Code returned.
Definition: tusb_errors.h:100
void tusb_isr(uint8_t coreid)
USB interrupt handler.
Definition: tusb.c:71
tusb_error_t hal_init(void)
Initialize USB controller hardware.
Definition: hal_lpc13uxx.c:44