Initial code for USB cable detection

- Currently actual detection commented out due to issues
This commit is contained in:
Jacob Alexander 2015-02-09 13:21:23 -08:00
parent 762e75d875
commit 9e3d3aaca4
11 changed files with 62 additions and 28 deletions

View file

@ -1098,12 +1098,17 @@ restart:
void usb_init()
uint8_t usb_init()
{
#ifdef UART_DEBUG
print("USB INIT"NL);
#endif
// If no USB cable is attached, do not initialize usb
// XXX Test -HaaTa
//if ( USB0_OTGISTAT & USB_OTGSTAT_ID )
// return 0;
// Clear out endpoints table
for ( int i = 0; i <= NUM_ENDPOINTS * 4; i++ )
{
@ -1147,6 +1152,8 @@ void usb_init()
// enable d+ pullup
USB0_CONTROL = USB_CONTROL_DPPULLUPNONOTG;
return 1;
}
// return 0 if the USB is not configured, or the configuration

View file

@ -61,8 +61,8 @@ extern volatile uint8_t usb_cdc_transmit_flush_timer;
// ----- Functions -----
uint8_t usb_configured(); // is the USB port configured
uint8_t usb_init(); // Returns 1 on success, 0 if no cable is attached
void usb_init();
void usb_isr();
void usb_tx( uint32_t endpoint, usb_packet_t *packet );
void usb_tx_isr( uint32_t endpoint, usb_packet_t *packet );