/* Setup hardware required for the bootloader */\r
SetupHardware();\r
\r
+ /* Enable global interrupts so that the USB stack can function */\r
+ sei();\r
+\r
while (RunBootloader)\r
{\r
CDC_Task();\r
#include <avr/boot.h>\r
#include <avr/eeprom.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
\r
#include "Descriptors.h"\r
{\r
/* Configure hardware required by the bootloader */\r
SetupHardware();\r
+ \r
+ /* Enable global interrupts so that the USB stack can function */\r
+ sei();\r
\r
/* Run the USB management task while the bootloader is supposed to be running */\r
while (RunBootloader || WaitForExit)\r
#include <avr/pgmspace.h>\r
#include <avr/eeprom.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
\r
#include "Descriptors.h"\r
int main(void)\r
{\r
SetupHardware();\r
- \r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
\r
for (;;)\r
{\r
clock_prescale_set(clock_div_1);\r
\r
/* Hardware Initialization */\r
- LEDs_Init();\r
USB_Init();\r
}\r
\r
-/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */\r
-void EVENT_USB_Device_Connect(void)\r
-{\r
- /* Indicate USB enumerating */\r
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
-}\r
-\r
-/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
- * the status LEDs, disables the sample update and PWM output timers and stops the USB and MIDI management tasks.\r
- */\r
-void EVENT_USB_Device_Disconnect(void)\r
-{\r
- /* Indicate USB not ready */\r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-}\r
-\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the MIDI management task started.\r
*/\r
void EVENT_USB_Device_ConfigurationChanged(void)\r
{\r
- /* Indicate USB connected and ready */\r
- LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
-\r
/* Setup MIDI stream endpoints */\r
- if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,\r
- ENDPOINT_BANK_SINGLE)))\r
- {\r
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
- } \r
+ Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,\r
+ ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,\r
+ ENDPOINT_BANK_SINGLE);\r
\r
- if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,\r
- ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,\r
- ENDPOINT_BANK_SINGLE)))\r
- {\r
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
- }\r
+ Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,\r
+ ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,\r
+ ENDPOINT_BANK_SINGLE);\r
}\r
\r
/** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them\r
if (Endpoint_IsOUTReceived())\r
{\r
USB_MIDI_EventPacket_t InPacket;\r
- Endpoint_Read_Stream_LE(&InPacket, sizeof(InPacket));\r
- \r
- LEDs_SetAllLEDs(InPacket.Data2 > 64 ? LEDS_LED1 : LEDS_LED2); \r
+ Endpoint_Read_Stream_LE(&InPacket, sizeof(InPacket)); \r
Endpoint_ClearOUT();\r
\r
uint8_t Channel = InPacket.Data1;\r
#include <avr/wdt.h>\r
#include <avr/boot.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
\r
#include "Descriptors.h"\r
\r
#include <LUFA/Version.h>\r
- #include <LUFA/Drivers/Board/LEDs.h>\r
#include <LUFA/Drivers/USB/USB.h>\r
\r
/* Macros: */\r
/* Setup hardware required for the bootloader */\r
SetupHardware();\r
\r
+ /* Enable global interrupts so that the USB stack can function */\r
+ sei();\r
+\r
while (RunBootloader)\r
USB_USBTask();\r
\r
#include <avr/wdt.h>\r
#include <avr/boot.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include <LUFA/Version.h>\r
#include <LUFA/Drivers/Board/LEDs.h>\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdlib.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
/* Includes: */\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
- #include <avr/interrupt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
+ #include <string.h>\r
\r
#include "Descriptors.h"\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
+ #include <string.h>\r
\r
#include "Descriptors.h"\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
#include <avr/interrupt.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/interrupt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
\r
/* Includes: */\r
#include <avr/io.h>\r
+ #include <avr/pgmspace.h>\r
+ #include <stdio.h>\r
\r
#include <LUFA/Drivers/USB/Class/RNDIS.h>\r
#include <LUFA/Drivers/Peripheral/SerialStream.h>\r
{\r
SetupHardware();\r
\r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
- \r
TCP_Init();\r
Webserver_Init();\r
\r
- printf_P(PSTR("\r\n\r\n****** RNDIS Demo running. ******\r\n"));\r
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
/* Includes: */\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
- #include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
- #include <stdio.h>\r
\r
#include "Descriptors.h"\r
\r
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
#include <stdio.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "Descriptors.h"\r
#include "Lib/SideshowCommands.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "Descriptors.h"\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
- #include <stdlib.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "Descriptors.h"\r
\r
int main(void)\r
{\r
SetupHardware();\r
+ \r
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-\r
+ sei();\r
+ \r
for (;;)\r
{\r
MIDI_Task();\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "Descriptors.h"\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
#include <string.h>\r
\r
\r
/* Includes: */\r
#include <avr/io.h>\r
+ #include <avr/pgmspace.h>\r
+ #include <stdio.h>\r
\r
#include <LUFA/Drivers/Peripheral/SerialStream.h>\r
\r
TCP_Init();\r
Webserver_Init();\r
\r
- printf_P(PSTR("\r\n\r\n****** RNDIS Demo running. ******\r\n"));\r
-\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
/* Includes: */\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
- #include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
- #include <stdio.h>\r
\r
#include "Descriptors.h"\r
\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
\r
#include "Descriptors.h"\r
puts_P(PSTR(ESC_FG_CYAN "Mouse Host/Device Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Joystick Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Keyboard Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-\r
+ sei();\r
+ \r
for (;;)\r
{\r
switch (USB_HostState)\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Keyboard Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "MIDI Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Mass Storage Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <ctype.h>\r
#include <stdio.h>\r
\r
puts_P(PSTR(ESC_FG_CYAN "Mouse Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
SetupHardware();\r
\r
puts_P(PSTR(ESC_FG_CYAN "Mouse Host Demo running.\r\n" ESC_FG_WHITE));\r
+ sei();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Printer Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "RNDIS Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Still Image Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Bluetooth Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include "Lib/ServiceDiscoveryProtocol.h"\r
puts_P(PSTR(ESC_FG_CYAN "Generic HID Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
puts_P(PSTR(ESC_FG_CYAN "Joystick HID Parser Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Keyboard HID Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
puts_P(PSTR(ESC_FG_CYAN "Keyboard HID Parser Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "MIDI Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Mass Storage Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
#include <ctype.h>\r
#include <string.h>\r
puts_P(PSTR(ESC_FG_CYAN "Mouse HID Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
puts_P(PSTR(ESC_FG_CYAN "Mouse HID Parser Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
\r
puts_P(PSTR(ESC_FG_CYAN "Printer Host Demo running.\r\n" ESC_FG_WHITE));\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
#include <string.h>\r
\r
puts_P(PSTR(ESC_FG_CYAN "RNDIS Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
puts_P(PSTR(ESC_FG_CYAN "Still Image Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include "ConfigDescriptor.h"\r
puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE));\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include <LUFA/Version.h>\r
#endif\r
\r
USB_IsInitialized = true;\r
-\r
- sei();\r
}\r
\r
void USB_ShutDown(void)\r
* allow for device connection to a host when in device mode, or for device enumeration while in\r
* host mode.\r
*\r
- * As the USB library relies on USB interrupts for some of its functionality, this routine will\r
- * enable global interrupts.\r
+ * As the USB library relies on interrupts for the device and host mode enumeration processes,\r
+ * the user must enable global interrupts before or shortly after this function is called. In\r
+ * device mode, interrupts must be enabled within 500ms of this function being called to ensure\r
+ * that the host does not time out whilst enumerating the device. In host mode, interrupts may be\r
+ * enabled at the application's leisure however enumeration will not begin of an attached device\r
+ * until after this has occurred.\r
*\r
* Calling this function when the USB interface is already initialized will cause a complete USB\r
* interface reset and re-enumeration.\r
* - Added LIBUSB_FILTERDRV_COMPAT compile time option to the AVRISP programmer project to make the code compatible with Windows\r
* builds of avrdude at the expense of AVRStudio compatibility\r
* - Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code\r
+ * - The USB_Init() function no longer calls sei() - the user is now responsible for enabling interrupts when they are ready\r
*\r
* <b>Fixed:</b>\r
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r
* - The \ref TWI_StartTransmission() function now takes in a timeout period, expressed in milliseconds, within which the addressed\r
* device must respond or the function will abort.\r
*\r
+ * <b>Device Mode</b>\r
+ * - The \ref USB_Init() function no longer calls sei() to enable global interrupts, as the user application may need\r
+ * to perform other initialization before it is ready to handle global interrupts. The user application is now responsible\r
+ * for enabling global interrupts before or shortly after calling \ref USB_Init() to ensure that the enumeration process\r
+ * functions correctly.\r
+ *\r
+ * <b>Host Mode</b>\r
+ * - The \ref USB_Init() function no longer calls sei() to enable global interrupts, as the user application may need\r
+ * to perform other initialization before it is ready to handle global interrupts. The user application is now responsible\r
+ * for enabling global interrupts before or shortly after calling \ref USB_Init() to ensure that the enumeration process\r
+ * functions correctly.\r
+ *\r
* \section Sec_Migration100219 Migrating from 091223 to 100219\r
*\r
* <b>Non-USB Library Components</b>\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
SetupHardware();\r
\r
Buffer_Initialize(&Tx_Buffer);\r
+ \r
+ sei();\r
\r
for (;;)\r
{\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
#include <avr/pgmspace.h>\r
+ #include <avr/interrupt.h>\r
#include <stdbool.h>\r
\r
#include "Descriptors.h"\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include "DiskDevice.h"\r
\r
/* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */\r
CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);\r
+ \r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <string.h>\r
#include <stdio.h>\r
\r
\r
for (uint8_t Buffer = 0; Buffer < TOTAL_TRACKS; Buffer++)\r
BitBuffer_Init(&TrackDataBuffers[Buffer]);\r
+ \r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "Descriptors.h"\r
#include "Lib/MagstripeHW.h"\r
{\r
SetupHardware();\r
\r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
- \r
CmdState = CMD_STOP;\r
\r
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
+\r
for (;;)\r
{\r
Read_Joystick_Status();\r
int main(void)\r
{\r
SetupHardware();\r
+ \r
+ sei();\r
\r
for (;;)\r
USB_USBTask();\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "Descriptors.h"\r
\r
*/\r
int main(void)\r
{\r
- /* Fetch logging interval from EEPROM */\r
- LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);\r
-\r
SetupHardware();\r
\r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ /* Fetch logging interval from EEPROM */\r
+ LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);\r
\r
/* Mount and open the log file on the dataflash FAT partition */\r
OpenLogFile();\r
\r
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
+\r
/* Discard the first sample from the temperature sensor, as it is generally incorrect */\r
volatile uint8_t Dummy = Temperature_GetTemperature();\r
(void)Dummy;\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
#include <stdio.h>\r
\r
#include "Descriptors.h"\r
Buffer_Initialize(&USARTtoUSB_Buffer);\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
SetupHardware();\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/wdt.h>\r
#include <avr/pgmspace.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include <LUFA/Version.h>\r
#include <LUFA/Drivers/Board/LEDs.h>\r
Buffer_Initialize(&UARTtoUSB_Buffer);\r
\r
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ sei();\r
\r
for (;;)\r
{\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/power.h>\r
+ #include <avr/interrupt.h>\r
\r
#include "AVRISPDescriptors.h"\r
#include "USARTDescriptors.h"\r