Commit a6772540 authored by Dean Camera's avatar Dean Camera
Browse files

Added INVERTED_VBUS_ENABLE_LINE and NO_AUTO_VBUS_MANAGEMENT compile time...

Added INVERTED_VBUS_ENABLE_LINE and NO_AUTO_VBUS_MANAGEMENT compile time options (thanks to Opendous Inc.).
parent 252bd7bb
......@@ -18,6 +18,7 @@
* - Added new CALLBACK_Audio_Device_GetSetInterfaceProperty() callback to the Audio Device Class driver
* - Added new LEDs_Disable(), Buttons_Disable() and Joystick_Disable() functions to the board hardware drivers
* - Added support for the Micropendous family of boards
* - Added INVERTED_VBUS_ENABLE_LINE and NO_AUTO_VBUS_MANAGEMENT compile time options (thanks to Opendous Inc.)
* - Library Applications:
* - Added User Application APIs to the CDC and DFU class bootloaders
* - Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs)
......
......@@ -78,6 +78,7 @@
* the compile time token may be defined in the application's makefile to disable automatic flushing during calls to the class driver USB
* management tasks.
*
*
* \section Sec_SummaryUSBTokens General USB Driver Related Tokens
* This section describes compile tokens which affect USB driver stack as a whole in the LUFA library.
*
......@@ -123,6 +124,7 @@
* the ability to receive USB Start of Frame events via the \ref EVENT_USB_Device_StartOfFrame() or \ref EVENT_USB_Host_StartOfFrame() events is removed,
* reducing the compiled program's binary size.
*
*
* \section Sec_SummaryUSBDeviceTokens USB Device Mode Driver Related Tokens
* This section describes compile tokens which affect USB driver stack of the LUFA library when used in Device mode.
*
......@@ -204,5 +206,15 @@
* they will fail to enumerate correctly. By placing a delay before the enumeration process, it can be ensured that the bus has settled
* back to a known idle state before communications occur with the device. This token may be defined to a 16-bit value to set the device
* settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.
*
* <b>INVERTED_VBUS_ENABLE_LINE</b> - (\ref Group_Host) - <i>All Architectures</i>
* If enabled, this will indicate that the USB target VBUS line polarity is inverted; i.e. it should be pulled low to enable VBUS to the
* target, and pulled high to stop the target VBUS generation.
*
* \note On AVR8 architecture devices, this compile time option requires \c NO_AUTO_VBUS_MANAGEMENT to be set.
*
* <b>NO_AUTO_VBUS_MANAGEMENT</b> - (\ref Group_Host) - <i>All Architectures</i>
* Disables the automatic management of VBUS to the target, i.e. automatic shut down in the even of an overcurrent situation. When enabled, VBUS
* is enabled while the USB controller is initialized in USB Host mode.
*/
......@@ -68,6 +68,7 @@
* - MakeTV Episode Dispenser: http://www.youtube.com/watch?v=BkWUi18hl3g
* - MidiMonster, a USB-to-MIDI gateway board: http://www.dorkbotpdx.org/wiki/midimonster
* - MIDI Theremin: http://baldwisdom.com/usb-midi-controller-theremin-style-on-arduino-uno/
* - MIDI interface hack of a toy Guitar: http://blog.x37v.info/2011/06/26/toy-guitar-hacked-midi-conroller
* - MiniBloq, a graphical Ardunio programming environment : http://minibloq.org/
* - MiXley, a port of the Teacup 3D printer firmware for the USB AVRs: http://codaset.com/michielh/mixley
* - Mobo 4.3, a USB controlled all band (160-10m) HF SDR transceiver: http://sites.google.com/site/lofturj/mobo4_3
......@@ -149,4 +150,5 @@
* - Adafruit "Ask an Engineer", 7th November 2010
* - Arduino 2010 Keynote speech
* - The Amp Hour podcast blog #11
* - Blackhat 2011 conference, "Exploiting USB Devices with Arduino"
*/
......@@ -79,6 +79,11 @@ void USB_Host_ProcessNextHostState(void)
USB_OTGPAD_On();
USB_Host_VBUS_Auto_Enable();
USB_Host_VBUS_Auto_On();
#if defined(NO_AUTO_VBUS_MANAGEMENT)
USB_Host_VBUS_Manual_Enable();
USB_Host_VBUS_Manual_On();
#endif
USB_HostState = HOST_STATE_Powered_WaitForConnect;
}
......
......@@ -64,6 +64,10 @@
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
#if defined(INVERTED_VBUS_ENABLE_LINE) && !defined(NO_AUTO_VBUS_MANAGEMENT)
#error The INVERTED_VBUS_ENABLE_LINE compile option requires NO_AUTO_VBUS_MANAGEMENT for the AVR8 architecture.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates the fixed USB device address which any attached device is enumerated to when in
......@@ -310,7 +314,11 @@
static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_On(void)
{
#if defined(INVERTED_VBUS_ENABLE_LINE)
PORTE &= ~(1 << 7);
#else
PORTE |= (1 << 7);
#endif
}
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
......@@ -322,7 +330,11 @@
static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_Off(void)
{
#if defined(INVERTED_VBUS_ENABLE_LINE)
PORTE |= (1 << 7);
#else
PORTE &= ~(1 << 7);
#endif
}
static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
......
......@@ -80,6 +80,11 @@ void USB_Host_ProcessNextHostState(void)
USB_Host_VBUS_Auto_Enable();
USB_Host_VBUS_Auto_On();
#if defined(NO_AUTO_VBUS_MANAGEMENT)
USB_Host_VBUS_Manual_Enable();
USB_Host_VBUS_Manual_On();
#endif
USB_HostState = HOST_STATE_Powered_WaitForConnect;
}
......
......@@ -134,6 +134,10 @@ void USB_ResetInterface(void)
}
else if (USB_CurrentMode == USB_MODE_Host)
{
#if defined(INVERTED_VBUS_ENABLE_LINE)
AVR32_USBB.USBCON.vbuspol = true;
#endif
#if defined(USB_CAN_BE_HOST)
AVR32_USBB.USBCON.uimod = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment