Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / Demos / Device / AudioInput / AudioInput.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
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.
20
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
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for AudioOutput.c.
34 */
35
36 #ifndef _AUDIO_OUTPUT_H_
37 #define _AUDIO_OUTPUT_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/wdt.h>
42 #include <avr/power.h>
43
44 #include "Descriptors.h"
45
46 #include <LUFA/Version.h> // Library Version Information
47 #include <LUFA/Drivers/USB/USB.h> // USB Functionality
48 #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
49 #include <LUFA/Drivers/AT90USBXXX/ADC.h> // ADC driver
50 #include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
51
52 /* Macros: */
53 /** ADC channel number for the microphone input. */
54 #define MIC_IN_ADC_CHANNEL 2
55
56 /** Maximum ADC sample value for the microphone input. */
57 #define SAMPLE_MAX_RANGE 0xFFFF
58
59 /** Maximum ADC range for the microphone input. */
60 #define ADC_MAX_RANGE 0x3FF
61
62 /* Enums: */
63 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
64 enum AudioInput_StatusCodes_t
65 {
66 Status_USBNotReady = 0, /**< USB is not ready (disconnected from a USB host) */
67 Status_USBEnumerating = 1, /**< USB interface is enumerating */
68 Status_USBReady = 2, /**< USB interface is connected and ready */
69 };
70
71 /* Task Definitions: */
72 TASK(USB_Audio_Task);
73
74 /* Event Handlers: */
75 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */
76 HANDLES_EVENT(USB_Connect);
77
78 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
79 HANDLES_EVENT(USB_Disconnect);
80
81 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
82 HANDLES_EVENT(USB_ConfigurationChanged);
83
84 /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
85 HANDLES_EVENT(USB_UnhandledControlPacket);
86
87 /* Function Prototypes: */
88 void UpdateStatus(uint8_t CurrentStatus);
89
90 #endif