aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/MIDIToneGenerator
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-05-10 19:24:58 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-05-10 19:24:58 +0000
commit359fbfe14d00ab378f85a36664820ea9ba538c3f (patch)
tree0929d5663a3be4dc078dda0aba5ba798ebb627ab /Projects/MIDIToneGenerator
parente8570c4a37e41117e3fd1e989e0b41f1e9608f3c (diff)
downloadlufa-359fbfe14d00ab378f85a36664820ea9ba538c3f.tar.gz
lufa-359fbfe14d00ab378f85a36664820ea9ba538c3f.tar.bz2
lufa-359fbfe14d00ab378f85a36664820ea9ba538c3f.zip
Add branch for the conversion of demos to use standard C header files for configuration, rather than makefile defined macros.
Diffstat (limited to 'Projects/MIDIToneGenerator')
-rw-r--r--Projects/MIDIToneGenerator/Descriptors.c8
-rw-r--r--Projects/MIDIToneGenerator/Descriptors.h8
-rw-r--r--Projects/MIDIToneGenerator/MIDIToneGenerator.c24
3 files changed, 22 insertions, 18 deletions
diff --git a/Projects/MIDIToneGenerator/Descriptors.c b/Projects/MIDIToneGenerator/Descriptors.c
index 9ad0e86a5..44db1eee5 100644
--- a/Projects/MIDIToneGenerator/Descriptors.c
+++ b/Projects/MIDIToneGenerator/Descriptors.c
@@ -199,10 +199,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
- .EndpointAddress = (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
+ .EndpointAddress = MIDI_STREAM_OUT_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
- .PollingIntervalMS = 0x01
+ .PollingIntervalMS = 0x05
},
.Refresh = 0,
@@ -224,10 +224,10 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
- .EndpointAddress = (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM),
+ .EndpointAddress = MIDI_STREAM_IN_EPADDR,
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MIDI_STREAM_EPSIZE,
- .PollingIntervalMS = 0x01
+ .PollingIntervalMS = 0x05
},
.Refresh = 0,
diff --git a/Projects/MIDIToneGenerator/Descriptors.h b/Projects/MIDIToneGenerator/Descriptors.h
index c5dc2e217..83844449d 100644
--- a/Projects/MIDIToneGenerator/Descriptors.h
+++ b/Projects/MIDIToneGenerator/Descriptors.h
@@ -42,11 +42,11 @@
#include <avr/pgmspace.h>
/* Macros: */
- /** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
- #define MIDI_STREAM_IN_EPNUM 2
+ /** Endpoint address of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
+ #define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | 2)
- /** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
- #define MIDI_STREAM_OUT_EPNUM 1
+ /** Endpoint address of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
+ #define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | 1)
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64
diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c
index 4062bffab..5f17fdd1c 100644
--- a/Projects/MIDIToneGenerator/MIDIToneGenerator.c
+++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c
@@ -45,14 +45,18 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
.Config =
{
.StreamingInterfaceNumber = 1,
-
- .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
- .DataINEndpointSize = MIDI_STREAM_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
- .DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
+ .DataINEndpoint =
+ {
+ .Address = MIDI_STREAM_IN_EPADDR,
+ .Size = MIDI_STREAM_EPSIZE,
+ .Banks = 1,
+ },
+ .DataOUTEndpoint =
+ {
+ .Address = MIDI_STREAM_OUT_EPADDR,
+ .Size = MIDI_STREAM_EPSIZE,
+ .Banks = 1,
+ },
},
};
@@ -96,7 +100,7 @@ int main(void)
MIDI_EventPacket_t ReceivedMIDIEvent;
if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
{
- if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
+ if ((ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
{
DDSNoteData* LRUNoteStruct = &NoteData[0];
@@ -130,7 +134,7 @@ int main(void)
/* Turn on indicator LED to indicate note generation activity */
LEDs_SetAllLEDs(LEDS_LED1);
}
- else if ((ReceivedMIDIEvent.Command == (MIDI_COMMAND_NOTE_OFF >> 4)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
+ else if ((ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_OFF)) && ((ReceivedMIDIEvent.Data1 & 0x0F) == 0))
{
bool FoundActiveNote = false;