diff options
Diffstat (limited to 'lib/lufa/Demos/Device/LowLevel/MIDI')
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h | 126 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.c | 314 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.h | 108 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.c | 224 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.h | 76 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.txt | 78 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/asf.xml | 62 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/doxyfile | 2395 | ||||
-rw-r--r-- | lib/lufa/Demos/Device/LowLevel/MIDI/makefile | 43 |
9 files changed, 0 insertions, 3426 deletions
diff --git a/lib/lufa/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h b/lib/lufa/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h deleted file mode 100644 index 00eefc7bf7..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Library Configuration Header File - * - * This header file is used to configure LUFA's compile time options, - * as an alternative to the compile time constants supplied through - * a makefile. - * - * For information on what each token does, refer to the LUFA - * manual section "Summary of Compile Tokens". - */ - -#ifndef _LUFA_CONFIG_H_ -#define _LUFA_CONFIG_H_ - - #if (ARCH == ARCH_AVR8) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ -// #define ORDERED_EP_CONFIG - #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) - #define USB_DEVICE_ONLY -// #define USB_HOST_ONLY -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define USE_RAM_DESCRIPTORS - #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS -// #define NO_INTERNAL_SERIAL - #define FIXED_CONTROL_ENDPOINT_SIZE 8 -// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} - #define FIXED_NUM_CONFIGURATIONS 1 -// #define CONTROL_ONLY_DEVICE -// #define INTERRUPT_CONTROL_ENDPOINT -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - /* USB Host Mode Driver Related Tokens: */ -// #define HOST_STATE_AS_GPIOR {Insert Value Here} -// #define USB_HOST_TIMEOUT_MS {Insert Value Here} -// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} -// #define NO_AUTO_VBUS_MANAGEMENT -// #define INVERTED_VBUS_ENABLE_LINE - - #elif (ARCH == ARCH_XMEGA) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ - #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH) -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define USE_RAM_DESCRIPTORS - #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS -// #define NO_INTERNAL_SERIAL - #define FIXED_CONTROL_ENDPOINT_SIZE 8 -// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} - #define FIXED_NUM_CONFIGURATIONS 1 -// #define CONTROL_ONLY_DEVICE - #define MAX_ENDPOINT_INDEX 2 -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - #else - - #error Unsupported architecture for this LUFA configuration file. - - #endif -#endif diff --git a/lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.c b/lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.c deleted file mode 100644 index b4bcea1ee7..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special - * computer-readable structures which the host requests upon device enumeration, to determine - * the device's capabilities and functions. - */ - -#include "Descriptors.h" - -/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall - * device characteristics, including the supported USB version, control endpoint size and the - * number of device configurations. The descriptor is read out by the USB host when the enumeration - * process begins. - */ -const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = -{ - .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, - - .USBSpecification = VERSION_BCD(1,1,0), - .Class = USB_CSCP_NoDeviceClass, - .SubClass = USB_CSCP_NoDeviceSubclass, - .Protocol = USB_CSCP_NoDeviceProtocol, - - .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - - .VendorID = 0x03EB, - .ProductID = 0x2048, - .ReleaseNumber = VERSION_BCD(0,0,1), - - .ManufacturerStrIndex = STRING_ID_Manufacturer, - .ProductStrIndex = STRING_ID_Product, - .SerialNumStrIndex = NO_DESCRIPTOR, - - .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS -}; - -/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage - * of the device in one of its supported configurations, including information about any device interfaces - * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting - * a configuration so that the host may correctly communicate with the USB device. - */ -const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = -{ - .Config = - { - .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), - .TotalInterfaces = 2, - - .ConfigurationNumber = 1, - .ConfigurationStrIndex = NO_DESCRIPTOR, - - .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), - - .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) - }, - - .Audio_ControlInterface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = INTERFACE_ID_AudioControl, - .AlternateSetting = 0, - - .TotalEndpoints = 0, - - .Class = AUDIO_CSCP_AudioClass, - .SubClass = AUDIO_CSCP_ControlSubclass, - .Protocol = AUDIO_CSCP_ControlProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Audio_ControlInterface_SPC = - { - .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface}, - .Subtype = AUDIO_DSUBTYPE_CSInterface_Header, - - .ACSpecification = VERSION_BCD(1,0,0), - .TotalLength = sizeof(USB_Audio_Descriptor_Interface_AC_t), - - .InCollection = 1, - .InterfaceNumber = INTERFACE_ID_AudioStream, - }, - - .Audio_StreamInterface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = INTERFACE_ID_AudioStream, - .AlternateSetting = 0, - - .TotalEndpoints = 2, - - .Class = AUDIO_CSCP_AudioClass, - .SubClass = AUDIO_CSCP_MIDIStreamingSubclass, - .Protocol = AUDIO_CSCP_StreamingProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Audio_StreamInterface_SPC = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_AudioInterface_AS_t), .Type = DTYPE_CSInterface}, - .Subtype = AUDIO_DSUBTYPE_CSInterface_General, - - .AudioSpecification = VERSION_BCD(1,0,0), - - .TotalLength = (sizeof(USB_Descriptor_Configuration_t) - - offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC)) - }, - - .MIDI_In_Jack_Emb = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface}, - .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal, - - .JackType = MIDI_JACKTYPE_Embedded, - .JackID = 0x01, - - .JackStrIndex = NO_DESCRIPTOR - }, - - .MIDI_In_Jack_Ext = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface}, - .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal, - - .JackType = MIDI_JACKTYPE_External, - .JackID = 0x02, - - .JackStrIndex = NO_DESCRIPTOR - }, - - .MIDI_Out_Jack_Emb = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface}, - .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal, - - .JackType = MIDI_JACKTYPE_Embedded, - .JackID = 0x03, - - .NumberOfPins = 1, - .SourceJackID = {0x02}, - .SourcePinID = {0x01}, - - .JackStrIndex = NO_DESCRIPTOR - }, - - .MIDI_Out_Jack_Ext = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface}, - .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal, - - .JackType = MIDI_JACKTYPE_External, - .JackID = 0x04, - - .NumberOfPins = 1, - .SourceJackID = {0x01}, - .SourcePinID = {0x01}, - - .JackStrIndex = NO_DESCRIPTOR - }, - - .MIDI_In_Jack_Endpoint = - { - .Endpoint = - { - .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = MIDI_STREAM_OUT_EPADDR, - .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MIDI_STREAM_EPSIZE, - .PollingIntervalMS = 0x05 - }, - - .Refresh = 0, - .SyncEndpointNumber = 0 - }, - - .MIDI_In_Jack_Endpoint_SPC = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint}, - .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General, - - .TotalEmbeddedJacks = 0x01, - .AssociatedJackID = {0x01} - }, - - .MIDI_Out_Jack_Endpoint = - { - .Endpoint = - { - .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = MIDI_STREAM_IN_EPADDR, - .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MIDI_STREAM_EPSIZE, - .PollingIntervalMS = 0x05 - }, - - .Refresh = 0, - .SyncEndpointNumber = 0 - }, - - .MIDI_Out_Jack_Endpoint_SPC = - { - .Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint}, - .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General, - - .TotalEmbeddedJacks = 0x01, - .AssociatedJackID = {0x03} - } -}; - -/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests - * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate - * via the language ID table available at USB.org what languages the device supports for its string descriptors. - */ -const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); - -/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable - * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device - * Descriptor. - */ -const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); - -/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, - * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device - * Descriptor. - */ -const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LUFA MIDI Demo"); - -/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" - * documentation) by the application code so that the address and size of a requested descriptor can be given - * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function - * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the - * USB host. - */ -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint16_t wIndex, - const void** const DescriptorAddress) -{ - const uint8_t DescriptorType = (wValue >> 8); - const uint8_t DescriptorNumber = (wValue & 0xFF); - - const void* Address = NULL; - uint16_t Size = NO_DESCRIPTOR; - - switch (DescriptorType) - { - case DTYPE_Device: - Address = &DeviceDescriptor; - Size = sizeof(USB_Descriptor_Device_t); - break; - case DTYPE_Configuration: - Address = &ConfigurationDescriptor; - Size = sizeof(USB_Descriptor_Configuration_t); - break; - case DTYPE_String: - switch (DescriptorNumber) - { - case STRING_ID_Language: - Address = &LanguageString; - Size = pgm_read_byte(&LanguageString.Header.Size); - break; - case STRING_ID_Manufacturer: - Address = &ManufacturerString; - Size = pgm_read_byte(&ManufacturerString.Header.Size); - break; - case STRING_ID_Product: - Address = &ProductString; - Size = pgm_read_byte(&ProductString.Header.Size); - break; - } - - break; - } - - *DescriptorAddress = Address; - return Size; -} - diff --git a/lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.h b/lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.h deleted file mode 100644 index a477d9dc82..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/MIDI/Descriptors.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for Descriptors.c. - */ - -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ - - /* Includes: */ - #include <LUFA/Drivers/USB/USB.h> - - #include <avr/pgmspace.h> - - /* Macros: */ - /** Endpoint address of the MIDI streaming data IN endpoint, for device-to-host data transfers. */ - #define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | 1) - - /** Endpoint address of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */ - #define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | 2) - - /** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */ - #define MIDI_STREAM_EPSIZE 64 - - /* Type Defines: */ - /** Type define for the device configuration descriptor structure. This must be defined in the - * application code, as the configuration descriptor contains several sub-descriptors which - * vary between devices, and which describe the device's usage to the host. - */ - typedef struct - { - USB_Descriptor_Configuration_Header_t Config; - - // MIDI Audio Control Interface - USB_Descriptor_Interface_t Audio_ControlInterface; - USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC; - - // MIDI Audio Streaming Interface - USB_Descriptor_Interface_t Audio_StreamInterface; - USB_MIDI_Descriptor_AudioInterface_AS_t Audio_StreamInterface_SPC; - USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Emb; - USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Ext; - USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Emb; - USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Ext; - USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint; - USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC; - USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint; - USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; - } USB_Descriptor_Configuration_t; - - /** Enum for the device interface descriptor IDs within the device. Each interface descriptor - * should have a unique ID index associated with it, which can be used to refer to the - * interface from other descriptors. - */ - enum InterfaceDescriptors_t - { - INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */ - INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */ - }; - - /** Enum for the device string descriptor IDs within the device. Each string descriptor should - * have a unique ID index associated with it, which can be used to refer to the string from - * other descriptors. - */ - enum StringDescriptors_t - { - STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ - STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ - STRING_ID_Product = 2, /**< Product string ID */ - }; - - /* Function Prototypes: */ - uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint16_t wIndex, - const void** const DescriptorAddress) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.c b/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.c deleted file mode 100644 index 0fdb04597c..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Main source file for the MIDI input demo. This file contains the main tasks of the demo and - * is responsible for the initial application hardware configuration. - */ - -#include "MIDI.h" - -/** Main program entry point. This routine configures the hardware required by the application, then - * enters a loop to run the application tasks in sequence. - */ -int main(void) -{ - SetupHardware(); - - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - GlobalInterruptEnable(); - - for (;;) - { - MIDI_Task(); - USB_USBTask(); - } -} - -/** Configures the board hardware and chip peripherals for the demo's functionality. */ -void SetupHardware(void) -{ -#if (ARCH == ARCH_AVR8) - /* Disable watchdog if enabled by bootloader/fuses */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - /* Disable clock division */ - clock_prescale_set(clock_div_1); -#elif (ARCH == ARCH_XMEGA) - /* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */ - XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU); - XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL); - - /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */ - XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); - XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB); - - PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm; -#endif - - /* Hardware Initialization */ - Joystick_Init(); - LEDs_Init(); - Buttons_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) -{ - bool ConfigSuccess = true; - - /* Setup MIDI Data Endpoints */ - ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1); - ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1); - - /* Indicate endpoint configuration success or failure */ - LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); -} - -/** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them - * to the host. - */ -void MIDI_Task(void) -{ - static uint8_t PrevJoystickStatus; - - /* Device must be connected and configured for the task to run */ - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPADDR); - - if (Endpoint_IsINReady()) - { - uint8_t MIDICommand = 0; - uint8_t MIDIPitch; - - uint8_t JoystickStatus = Joystick_GetStatus(); - uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus); - - /* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */ - uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1)); - - if (JoystickChanges & JOY_LEFT) - { - MIDICommand = ((JoystickStatus & JOY_LEFT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); - MIDIPitch = 0x3C; - } - - if (JoystickChanges & JOY_UP) - { - MIDICommand = ((JoystickStatus & JOY_UP)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); - MIDIPitch = 0x3D; - } - - if (JoystickChanges & JOY_RIGHT) - { - MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); - MIDIPitch = 0x3E; - } - - if (JoystickChanges & JOY_DOWN) - { - MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); - MIDIPitch = 0x3F; - } - - if (JoystickChanges & JOY_PRESS) - { - MIDICommand = ((JoystickStatus & JOY_PRESS)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF); - MIDIPitch = 0x3B; - } - - /* Check if a MIDI command is to be sent */ - if (MIDICommand) - { - MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t) - { - .Event = MIDI_EVENT(0, MIDICommand), - - .Data1 = MIDICommand | Channel, - .Data2 = MIDIPitch, - .Data3 = MIDI_STANDARD_VELOCITY, - }; - - /* Write the MIDI event packet to the endpoint */ - Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL); - - /* Send the data in the endpoint to the host */ - Endpoint_ClearIN(); - } - - /* Save previous joystick value for next joystick change detection */ - PrevJoystickStatus = JoystickStatus; - } - - /* Select the MIDI OUT stream */ - Endpoint_SelectEndpoint(MIDI_STREAM_OUT_EPADDR); - - /* Check if a MIDI command has been received */ - if (Endpoint_IsOUTReceived()) - { - MIDI_EventPacket_t MIDIEvent; - - /* Read the MIDI event packet from the endpoint */ - Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL); - - /* Check to see if the sent command is a note on message with a non-zero velocity */ - if ((MIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON)) && (MIDIEvent.Data3 > 0)) - { - /* Change LEDs depending on the pitch of the sent note */ - LEDs_SetAllLEDs(MIDIEvent.Data2 > 64 ? LEDS_LED1 : LEDS_LED2); - } - else - { - /* Turn off all LEDs in response to non Note On messages */ - LEDs_SetAllLEDs(LEDS_NO_LEDS); - } - - /* If the endpoint is now empty, clear the bank */ - if (!(Endpoint_BytesInEndpoint())) - { - /* Clear the endpoint ready for new packet */ - Endpoint_ClearOUT(); - } - } -} - diff --git a/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.h b/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.h deleted file mode 100644 index 55ba499b50..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaims all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for AudioOutput.c. - */ - -#ifndef _AUDIO_OUTPUT_H_ -#define _AUDIO_OUTPUT_H_ - - /* Includes: */ - #include <avr/io.h> - #include <avr/wdt.h> - #include <avr/power.h> - #include <avr/interrupt.h> - #include <stdbool.h> - - #include "Descriptors.h" - - #include <LUFA/Drivers/USB/USB.h> - #include <LUFA/Drivers/Board/Joystick.h> - #include <LUFA/Drivers/Board/LEDs.h> - #include <LUFA/Drivers/Board/Buttons.h> - #include <LUFA/Platform/Platform.h> - - /* 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: */ - void SetupHardware(void); - void MIDI_Task(void); - - void EVENT_USB_Device_Connect(void); - void EVENT_USB_Device_Disconnect(void); - void EVENT_USB_Device_ConfigurationChanged(void); - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.txt b/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.txt deleted file mode 100644 index 97a92a1907..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/MIDI/MIDI.txt +++ /dev/null @@ -1,78 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \mainpage MIDI Input Device Demo - * - * \section Sec_Compat Demo Compatibility: - * - * The following list indicates what microcontrollers are compatible with this demo. - * - * \li Series 7 USB AVRs (AT90USBxxx7) - * \li Series 6 USB AVRs (AT90USBxxx6) - * \li Series 4 USB AVRs (ATMEGAxxU4) - * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) - * \li Series AU XMEGA AVRs (ATXMEGAxxxAxU) - * \li Series B XMEGA AVRs (ATXMEGAxxxBx) - * \li Series C XMEGA AVRs (ATXMEGAxxxCx) - * - * \section Sec_Info USB Information: - * - * The following table gives a rundown of the USB utilization of this demo. - * - * <table> - * <tr> - * <td><b>USB Mode:</b></td> - * <td>Device</td> - * </tr> - * <tr> - * <td><b>USB Class:</b></td> - * <td>Audio Class</td> - * </tr> - * <tr> - * <td><b>USB Subclass:</b></td> - * <td>Standard Audio Device</td> - * </tr> - * <tr> - * <td><b>Relevant Standards:</b></td> - * <td>USBIF Audio Class Specification \n - * USB-MIDI Audio Class Extension Specification \n - * General MIDI Specification</td> - * </tr> - * <tr> - * <td><b>Supported USB Speeds:</b></td> - * <td>Full Speed Mode</td> - * </tr> - * </table> - * - * \section Sec_Description Project Description: - * - * MIDI demonstration application. This gives a simple reference - * application for implementing the USB-MIDI class in USB devices. - * |