Documentation improvements - put driver example code into its own section, fix incorr...
[pub/USBasp.git] / Projects / Incomplete / StandaloneProgrammer / DiskDevice.c
index 516917c..79e6821 100644 (file)
@@ -1,21 +1,21 @@
 /*
              LUFA Library
      Copyright (C) Dean Camera, 2010.
 /*
              LUFA Library
      Copyright (C) Dean Camera, 2010.
-              
+
   dean [at] fourwalledcubicle [dot] com
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
 */
 
 /*
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
-  Permission to use, copy, modify, distribute, and sell this 
+  Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
   software and its documentation for any purpose is hereby granted
-  without fee, provided that the above copyright notice appear in 
+  without fee, provided that the above copyright notice appear in
   all copies and that both that the copyright notice and this
   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 
+  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 disclaim all warranties with regard to this
   software without specific, written prior permission.
 
   The author disclaim all warranties with regard to this
@@ -73,14 +73,15 @@ void EVENT_USB_Device_Disconnect(void)
 /** Event handler for the library USB Configuration Changed event. */
 void EVENT_USB_Device_ConfigurationChanged(void)
 {
 /** Event handler for the library USB Configuration Changed event. */
 void EVENT_USB_Device_ConfigurationChanged(void)
 {
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);
+       bool ConfigSuccess = true;
+
+       ConfigSuccess &= MS_Device_ConfigureEndpoints(&DiskDevice_MS_Interface);
 
 
-       if (!(MS_Device_ConfigureEndpoints(&DiskDevice_MS_Interface)))
-         LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+       LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
 }
 
 }
 
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
+/** Event handler for the library USB Control Request reception event. */
+void EVENT_USB_Device_ControlRequest(void)
 {
        MS_Device_ProcessControlRequest(&DiskDevice_MS_Interface);
 }
 {
        MS_Device_ProcessControlRequest(&DiskDevice_MS_Interface);
 }
@@ -92,11 +93,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
 bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
 {
        bool CommandSuccess;
 bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
 {
        bool CommandSuccess;
-       
+
        LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
        CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
        LEDs_SetAllLEDs(LEDMASK_USB_READY);
        LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
        CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
        LEDs_SetAllLEDs(LEDMASK_USB_READY);
-       
+
        return CommandSuccess;
 }
 #endif
        return CommandSuccess;
 }
 #endif
+