Update Studio Integration DLL, to include package logging.
[pub/USBasp.git] / Demos / Host / LowLevel / AudioOutputHost / AudioOutputHost.c
index eddd38f..ab88d63 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2012.
+     Copyright (C) Dean Camera, 2015.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2015  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
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  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
@@ -46,7 +46,7 @@ int main(void)
        puts_P(PSTR(ESC_FG_CYAN "Audio Output Host Demo running.\r\n" ESC_FG_WHITE));
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-       sei();
+       GlobalInterruptEnable();
 
        for (;;)
        {
@@ -57,12 +57,14 @@ int main(void)
 /** 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);
+#endif
 
        /* Hardware Initialization */
        Serial_Init(9600, false);
@@ -76,7 +78,7 @@ void SetupHardware(void)
        Serial_CreateStream(NULL);
 
        /* Start the ADC conversion in free running mode */
-       ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL));   
+       ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL));
 }
 
 /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
@@ -158,6 +160,9 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
        /* Set the sample rate on the streaming interface endpoint */
        if ((ErrorCode = USB_Host_SendControlRequest(&SampleRate)) != HOST_SENDCONTROL_Successful)
        {
+               printf_P(PSTR(ESC_FG_RED "Could not set requested Audio sample rate.\r\n"
+                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
+
                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
                USB_Host_SetDeviceConfiguration(0);
                return;