USBTask.c File Reference

#include "../LowLevel/USBMode.h"
#include "USBTask.h"

Defines

#define INCLUDE_FROM_USBTASK_C

Functions

 TASK (USB_USBTask)

Variables

volatile bool USB_IsConnected
volatile bool USB_IsInitialized

Define Documentation

#define INCLUDE_FROM_USBTASK_C


Function Documentation

TASK ( USB_USBTask   ) 

This is the main USB management task. The USB driver requires that this task be executed continuously when the USB system is active (device attached in host mode, or attached to a host in device mode) in order to manage USB communications. This task may be executed inside an RTOS, scheduler (e.g. the simple LUFA Scheduler), fast timer ISR or the main user application loop.

The USB task must be serviced within 50mS in all modes, when needed. The task may be serviced at all times, or (for minimum CPU consumption):

  • In device mode, it may be disabled at startup, enabled on the firing of the USB_Connect event and disabled again on the firing of the USB_Disconnect event.

  • In host mode, it may be disabled at startup, enabled on the firing of the USB_DeviceAttached event and disabled again on the firing of the USB_DeviceUnattached event.

See also:
Events.h for more information on the USB events.


Variable Documentation

volatile bool USB_IsConnected

Indicates if the USB interface is currently connected to a host if in device mode, or to a device while running in host mode.

Note:
This variable should be treated as read-only in the user application, and never manually changed in value.

For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. this means that the current connection state is derived from the bus suspension and wake up events by default, which is not always accurate (host may suspend the bus while still connected). If the actual connection state needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection and disconnection events may be manually fired by RAISE_EVENT(), and the USB_IsConnected global changed manually.

volatile bool USB_IsInitialized

Indicates if the USB interface is currently initialized but not neccesarily connected to a host or device (i.e. if USB_Init() has been run).

Note:
This variable should be treated as read-only in the user application, and never manually changed in value.


Generated on Wed Dec 17 16:18:45 2008 for LUFA Library by  doxygen 1.5.7.1