#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 INCLUDE_FROM_USBTASK_C |
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):
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.
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).