diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-04-28 07:48:26 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-04-28 07:48:26 +0000 |
commit | 59c4871f8011247a056f6ca2ca8aca89000e3841 (patch) | |
tree | b26bb76882e9cca644ba0083bcc1c9ea50511463 /Bootloaders | |
parent | 85aaaf84ce14568580a35c31e22062ba529b49fe (diff) | |
download | lufa-59c4871f8011247a056f6ca2ca8aca89000e3841.tar.gz lufa-59c4871f8011247a056f6ca2ca8aca89000e3841.tar.bz2 lufa-59c4871f8011247a056f6ca2ca8aca89000e3841.zip |
USB_Init() no longer calls sei() to enable global interrupts - this must now be done in the user application once all init code has run.
Diffstat (limited to 'Bootloaders')
-rw-r--r-- | Bootloaders/CDC/BootloaderCDC.c | 3 | ||||
-rw-r--r-- | Bootloaders/CDC/BootloaderCDC.h | 1 | ||||
-rw-r--r-- | Bootloaders/DFU/BootloaderDFU.c | 3 | ||||
-rw-r--r-- | Bootloaders/DFU/BootloaderDFU.h | 1 | ||||
-rw-r--r-- | Bootloaders/Incomplete/MIDI/BootloaderMIDI.c | 44 | ||||
-rw-r--r-- | Bootloaders/Incomplete/MIDI/BootloaderMIDI.h | 2 | ||||
-rw-r--r-- | Bootloaders/TeensyHID/TeensyHID.c | 3 | ||||
-rw-r--r-- | Bootloaders/TeensyHID/TeensyHID.h | 1 |
8 files changed, 20 insertions, 38 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 482859bda..83fd0ee92 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -69,6 +69,9 @@ int main(void) /* Setup hardware required for the bootloader */
SetupHardware();
+ /* Enable global interrupts so that the USB stack can function */
+ sei();
+
while (RunBootloader)
{
CDC_Task();
diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h index 836700279..22b57438d 100644 --- a/Bootloaders/CDC/BootloaderCDC.h +++ b/Bootloaders/CDC/BootloaderCDC.h @@ -42,6 +42,7 @@ #include <avr/boot.h>
#include <avr/eeprom.h>
#include <avr/power.h>
+ #include <avr/interrupt.h>
#include <stdbool.h>
#include "Descriptors.h"
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index 157b78ffb..d90accb6c 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -101,6 +101,9 @@ int main(void) {
/* Configure hardware required by the bootloader */
SetupHardware();
+
+ /* Enable global interrupts so that the USB stack can function */
+ sei();
/* Run the USB management task while the bootloader is supposed to be running */
while (RunBootloader || WaitForExit)
diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index ca53266bf..4583d6ce1 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -43,6 +43,7 @@ #include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/power.h>
+ #include <avr/interrupt.h>
#include <stdbool.h>
#include "Descriptors.h"
diff --git a/Bootloaders/Incomplete/MIDI/BootloaderMIDI.c b/Bootloaders/Incomplete/MIDI/BootloaderMIDI.c index 8d26d56a0..863820157 100644 --- a/Bootloaders/Incomplete/MIDI/BootloaderMIDI.c +++ b/Bootloaders/Incomplete/MIDI/BootloaderMIDI.c @@ -42,8 +42,6 @@ int main(void)
{
SetupHardware();
-
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
for (;;)
{
@@ -63,48 +61,22 @@ void SetupHardware(void) clock_prescale_set(clock_div_1);
/* Hardware Initialization */
- LEDs_Init();
USB_Init();
}
-/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
-void EVENT_USB_Device_Connect(void)
-{
- /* Indicate USB enumerating */
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-}
-
-/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
- * the status LEDs, disables the sample update and PWM output timers and stops the USB and MIDI management tasks.
- */
-void EVENT_USB_Device_Disconnect(void)
-{
- /* Indicate USB not ready */
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-}
-
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured and the MIDI management task started.
*/
void EVENT_USB_Device_ConfigurationChanged(void)
{
- /* Indicate USB connected and ready */
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
/* Setup MIDI stream endpoints */
- if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,
- ENDPOINT_BANK_SINGLE)))
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- }
+ Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,
+ ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,
+ ENDPOINT_BANK_SINGLE);
- if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,
- ENDPOINT_BANK_SINGLE)))
- {
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- }
+ Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,
+ ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,
+ ENDPOINT_BANK_SINGLE);
}
/** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them
@@ -122,9 +94,7 @@ void MIDI_Task(void) if (Endpoint_IsOUTReceived())
{
USB_MIDI_EventPacket_t InPacket;
- Endpoint_Read_Stream_LE(&InPacket, sizeof(InPacket));
-
- LEDs_SetAllLEDs(InPacket.Data2 > 64 ? LEDS_LED1 : LEDS_LED2);
+ Endpoint_Read_Stream_LE(&InPacket, sizeof(InPacket));
Endpoint_ClearOUT();
uint8_t Channel = InPacket.Data1;
diff --git a/Bootloaders/Incomplete/MIDI/BootloaderMIDI.h b/Bootloaders/Incomplete/MIDI/BootloaderMIDI.h index 5af684da4..b5688195b 100644 --- a/Bootloaders/Incomplete/MIDI/BootloaderMIDI.h +++ b/Bootloaders/Incomplete/MIDI/BootloaderMIDI.h @@ -41,12 +41,12 @@ #include <avr/wdt.h>
#include <avr/boot.h>
#include <avr/power.h>
+ #include <avr/interrupt.h>
#include <stdbool.h>
#include "Descriptors.h"
#include <LUFA/Version.h>
- #include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c index 2317ea4e5..5431a5700 100644 --- a/Bootloaders/TeensyHID/TeensyHID.c +++ b/Bootloaders/TeensyHID/TeensyHID.c @@ -49,6 +49,9 @@ int main(void) /* Setup hardware required for the bootloader */
SetupHardware();
+ /* Enable global interrupts so that the USB stack can function */
+ sei();
+
while (RunBootloader)
USB_USBTask();
diff --git a/Bootloaders/TeensyHID/TeensyHID.h b/Bootloaders/TeensyHID/TeensyHID.h index 639389870..7e3d72dcf 100644 --- a/Bootloaders/TeensyHID/TeensyHID.h +++ b/Bootloaders/TeensyHID/TeensyHID.h @@ -41,6 +41,7 @@ #include <avr/wdt.h>
#include <avr/boot.h>
#include <avr/power.h>
+ #include <avr/interrupt.h>
#include <stdbool.h>
#include "Descriptors.h"
|