Changed default value for the reset polarity parameter in the AVRISP-MKII project...
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 29 Sep 2010 13:56:52 +0000 (13:56 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 29 Sep 2010 13:56:52 +0000 (13:56 +0000)
Fixed incorrect USB_DeviceState value when unconfiguring the device without an address set.

LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
LUFA/Drivers/USB/LowLevel/Device.h
LUFA/Drivers/USB/LowLevel/USBInterrupt.c
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/LUFAPoweredProjects.txt
Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
Projects/AVRISP-MKII/Lib/V2ProtocolParams.c

index 83c85de..d13ac74 100644 (file)
@@ -191,7 +191,10 @@ static void USB_Device_SetConfiguration(void)
 
        Endpoint_ClearStatusStage();
 
 
        Endpoint_ClearStatusStage();
 
-       USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed;
+       if (USB_ConfigurationNumber)
+         USB_DeviceState = DEVICE_STATE_Configured;
+       else
+         USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
 
        EVENT_USB_Device_ConfigurationChanged();
 }
 
        EVENT_USB_Device_ConfigurationChanged();
 }
index a37e6d9..2f54d1d 100644 (file)
                        {
                                UDADDR  = ((UDADDR & (1 << ADDEN)) | (Address & 0x7F));
                                UDADDR |= (1 << ADDEN);
                        {
                                UDADDR  = ((UDADDR & (1 << ADDEN)) | (Address & 0x7F));
                                UDADDR |= (1 << ADDEN);
-                       }                       
+                       }
+
+                       static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE;
+                       static inline bool USB_Device_IsAddressSet(void)
+                       {
+                               return (UDADDR & (1 << ADDEN));
+                       }
        #endif
 
 #endif
        #endif
 
 #endif
index 7844a87..21b0a9b 100644 (file)
@@ -128,11 +128,14 @@ ISR(USB_GEN_vect, ISR_BLOCK)
                USB_INT_Disable(USB_INT_WAKEUPI);
                USB_INT_Enable(USB_INT_SUSPI);
                
                USB_INT_Disable(USB_INT_WAKEUPI);
                USB_INT_Enable(USB_INT_SUSPI);
                
+               if (USB_ConfigurationNumber)
+                 USB_DeviceState = DEVICE_STATE_Configured;
+               else
+                 USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
+               
                #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
                #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
-               USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
                EVENT_USB_Device_Connect();
                #else
                EVENT_USB_Device_Connect();
                #else
-               USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed;
                EVENT_USB_Device_WakeUp();              
                #endif
        }
                EVENT_USB_Device_WakeUp();              
                #endif
        }
index cbedf18..55cfae0 100644 (file)
@@ -44,6 +44,7 @@
   *  - All project makefiles now correctly clean intermediate build files from assembly and C++ sources (thanks to Daniel Czigany)
   *  - Removed the EVENT_USB_InitFailure() event, not specifying a USB mode now defaults to UID selection mode
   *  - Renamed and moved class driver common constant definitions to make the naming scheme more uniform
   *  - All project makefiles now correctly clean intermediate build files from assembly and C++ sources (thanks to Daniel Czigany)
   *  - Removed the EVENT_USB_InitFailure() event, not specifying a USB mode now defaults to UID selection mode
   *  - Renamed and moved class driver common constant definitions to make the naming scheme more uniform
+  *  - Changed default value for the reset polarity parameter in the AVRISP-MKII project so that it defaults to active low drive
   *
   *  <b>Fixed:</b>
   *  - Fixed USB_GetHIDReportItemInfo() function modifying the given report item's data when the report item does not exist
   *
   *  <b>Fixed:</b>
   *  - Fixed USB_GetHIDReportItemInfo() function modifying the given report item's data when the report item does not exist
@@ -64,6 +65,7 @@
   *  - Fixed incorrect command name for EEPROM memory programming in the makefile dfu-ee target
   *  - Fixed BootloaderCDC project failing on some operating systems due to removed Line Encoding options (thanks to Alexey Belyaev)
   *  - Fixed incorrect LEDs_ChangeLEDs() function in the Benito board LED driver
   *  - Fixed incorrect command name for EEPROM memory programming in the makefile dfu-ee target
   *  - Fixed BootloaderCDC project failing on some operating systems due to removed Line Encoding options (thanks to Alexey Belyaev)
   *  - Fixed incorrect LEDs_ChangeLEDs() function in the Benito board LED driver
+  *  - Fixed incorrect USB_DeviceState value when unconfiguring the device without an address set
   *
   *  \section Sec_ChangeLog100807 Version 100807
   *  <b>New:</b>
   *
   *  \section Sec_ChangeLog100807 Version 100807
   *  <b>New:</b>
index ba68f5e..f1cf031 100644 (file)
@@ -38,7 +38,7 @@
  *  - Arcade Controller: http://fletchtronics.net/arcade-controller-made-petunia
  *  - AVR USB Modem, a 3G Wireless Modem host: http://code.google.com/p/avrusbmodem/
  *  - Bicycle POV: http://www.code.google.com/p/bicycleledpov/
  *  - Arcade Controller: http://fletchtronics.net/arcade-controller-made-petunia
  *  - AVR USB Modem, a 3G Wireless Modem host: http://code.google.com/p/avrusbmodem/
  *  - Bicycle POV: http://www.code.google.com/p/bicycleledpov/
- *  - BusNinja, an AVR clone of the popular BusPirate project: http://blog.hodgepig.org/busninja/
+ *  - Bus Ninja, an AVR clone of the popular BusPirate project: http://blog.hodgepig.org/busninja/
  *  - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
  *  - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/
  *  - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/
  *  - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
  *  - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/
  *  - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/
index 55d6551..294edce 100644 (file)
@@ -216,7 +216,9 @@ void ISPTarget_ChangeTargetResetLine(const bool ResetTarget)
                AUX_LINE_DDR |= AUX_LINE_MASK;
                
                if (!(V2Params_GetParameterValue(PARAM_RESET_POLARITY)))
                AUX_LINE_DDR |= AUX_LINE_MASK;
                
                if (!(V2Params_GetParameterValue(PARAM_RESET_POLARITY)))
-                 AUX_LINE_PORT |= AUX_LINE_MASK;
+                 AUX_LINE_PORT |=  AUX_LINE_MASK;
+               else
+                 AUX_LINE_PORT &= ~AUX_LINE_MASK;
        }
        else
        {
        }
        else
        {
index f4ab2bd..31303c7 100644 (file)
@@ -72,7 +72,7 @@ static ParameterItem_t ParameterTable[] =
 
                { .ParamID          = PARAM_RESET_POLARITY,
                  .ParamPrivileges  = PARAM_PRIV_WRITE,
 
                { .ParamID          = PARAM_RESET_POLARITY,
                  .ParamPrivileges  = PARAM_PRIV_WRITE,
-                 .ParamValue       = 0x00                               },
+                 .ParamValue       = 0x01                               },
 
                { .ParamID          = PARAM_STATUS_TGT_CONN,
                  .ParamPrivileges  = PARAM_PRIV_READ,
 
                { .ParamID          = PARAM_STATUS_TGT_CONN,
                  .ParamPrivileges  = PARAM_PRIV_READ,