From a67bd74e3e8aad87dcee8cf0c0eaaccbe7d00552 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 4 Jun 2009 02:55:30 +0000 Subject: Minor documentation page updates. Redocumented all device demos, now that they have changed over to the new USB class drivers. Added C linkage to class drivers for C++ support. Added prefixes to most of the class driver constants to prevent name clashes. --- Demos/Device/MIDI/Descriptors.c | 8 ++++---- Demos/Device/MIDI/MIDI.c | 30 ++++++++++++++++++++++++------ Demos/Device/MIDI/MIDI.h | 7 +++++++ 3 files changed, 35 insertions(+), 10 deletions(-) (limited to 'Demos/Device/MIDI') diff --git a/Demos/Device/MIDI/Descriptors.c b/Demos/Device/MIDI/Descriptors.c index 2007858dd..6973a4caa 100644 --- a/Demos/Device/MIDI/Descriptors.c +++ b/Demos/Device/MIDI/Descriptors.c @@ -145,7 +145,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface}, .Subtype = DSUBTYPE_InputJack, - .JackType = JACKTYPE_EMBEDDED, + .JackType = MIDI_JACKTYPE_EMBEDDED, .JackID = 0x01, .JackStrIndex = NO_DESCRIPTOR @@ -156,7 +156,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface}, .Subtype = DSUBTYPE_InputJack, - .JackType = JACKTYPE_EXTERNAL, + .JackType = MIDI_JACKTYPE_EXTERNAL, .JackID = 0x02, .JackStrIndex = NO_DESCRIPTOR @@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface}, .Subtype = DSUBTYPE_OutputJack, - .JackType = JACKTYPE_EMBEDDED, + .JackType = MIDI_JACKTYPE_EMBEDDED, .JackID = 0x03, .NumberOfPins = 1, @@ -182,7 +182,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface}, .Subtype = DSUBTYPE_OutputJack, - .JackType = JACKTYPE_EXTERNAL, + .JackType = MIDI_JACKTYPE_EXTERNAL, .JackID = 0x04, .NumberOfPins = 1, diff --git a/Demos/Device/MIDI/MIDI.c b/Demos/Device/MIDI/MIDI.c index 1fee34705..4fef04754 100644 --- a/Demos/Device/MIDI/MIDI.c +++ b/Demos/Device/MIDI/MIDI.c @@ -28,19 +28,32 @@ this software. */ +/** \file + * + * Main source file for the MIDI demo. This file contains the main tasks of + * the demo and is responsible for the initial application hardware configuration. + */ + #include "MIDI.h" +/** LUFA MIDI Class driver interface configuration and state information. This structure is + * passed to all MIDI Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. + */ USB_ClassInfo_MIDI_t Keyboard_MIDI_Interface = { - .InterfaceNumber = 0, + .StreamingInterfaceNumber = 1, - .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM, - .DataINEndpointSize = MIDI_STREAM_EPSIZE, + .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM, + .DataINEndpointSize = MIDI_STREAM_EPSIZE, - .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM, - .DataOUTEndpointSize = MIDI_STREAM_EPSIZE, + .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM, + .DataOUTEndpointSize = MIDI_STREAM_EPSIZE, }; - + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ int main(void) { SetupHardware(); @@ -55,6 +68,7 @@ int main(void) } } +/** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void) { /* Disable watchdog if enabled by bootloader/fuses */ @@ -71,6 +85,7 @@ void SetupHardware(void) USB_Init(); } +/** Checks for changes in the position of the board joystick, sending MIDI events to the host upon each change. */ void CheckJoystickMovement(void) { static uint8_t PrevJoystickStatus; @@ -133,16 +148,19 @@ void CheckJoystickMovement(void) PrevJoystickStatus = JoystickStatus; } +/** Event handler for the library USB Connection event. */ void EVENT_USB_Connect(void) { LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); } +/** Event handler for the library USB Disconnection event. */ void EVENT_USB_Disconnect(void) { LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); } +/** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_ConfigurationChanged(void) { LEDs_SetAllLEDs(LEDMASK_USB_READY); diff --git a/Demos/Device/MIDI/MIDI.h b/Demos/Device/MIDI/MIDI.h index 10d8d3366..913b318f7 100644 --- a/Demos/Device/MIDI/MIDI.h +++ b/Demos/Device/MIDI/MIDI.h @@ -53,9 +53,16 @@ #include /* Macros: */ + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ #define LEDMASK_USB_NOTREADY LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) /* Function Prototypes: */ -- cgit v1.2.3