3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
33 * Header file for AudioOutput.c.
36 #ifndef _AUDIO_OUTPUT_H_
37 #define _AUDIO_OUTPUT_H_
42 #include <avr/power.h>
45 #include "Descriptors.h"
47 #include <LUFA/Version.h> // Library Version Information
48 #include <LUFA/Drivers/USB/USB.h> // USB Functionality
49 #include <LUFA/Drivers/Board/Joystick.h> // Joystick driver
50 #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
51 #include <LUFA/Drivers/Board/HWB.h> // Hardware Button driver
52 #include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
55 /** MIDI command for a note on (activation) event */
56 #define MIDI_COMMAND_NOTE_ON 0x90
58 /** MIDI command for a note off (deactivation) event */
59 #define MIDI_COMMAND_NOTE_OFF 0x80
61 /** Standard key press velocity value used for all note events, as no pressure sensor is mounted */
62 #define MIDI_STANDARD_VELOCITY 64
64 /** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
65 * addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
67 * \param channel MIDI channel number to address
69 #define MIDI_CHANNEL(channel) (channel - 1)
72 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
73 enum MIDI_StatusCodes_t
75 Status_USBNotReady
= 0, /**< USB is not ready (disconnected from a USB host) */
76 Status_USBEnumerating
= 1, /**< USB interface is enumerating */
77 Status_USBReady
= 2, /**< USB interface is connected and ready */
80 /* Task Definitions: */
84 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */
85 HANDLES_EVENT(USB_Connect
);
87 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
88 HANDLES_EVENT(USB_Disconnect
);
90 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
91 HANDLES_EVENT(USB_ConfigurationChanged
);
93 /* Function Prototypes: */
94 void SendMIDINoteChange(const uint8_t Pitch
, const bool OnOff
,
95 const uint8_t CableID
, const uint8_t Channel
);
96 void UpdateStatus(uint8_t CurrentStatus
);