Minor code cleanups for clarity.
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 11 Nov 2009 09:09:39 +0000 (09:09 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 11 Nov 2009 09:09:39 +0000 (09:09 +0000)
Bootloaders/DFU/Descriptors.c
Bootloaders/TeensyHID/TeensyHID.c
Demos/Device/ClassDriver/CDC/CDC.c
Demos/Device/Incomplete/Sideshow/Sideshow.c
LUFA/Drivers/Peripheral/SerialStream.c
LUFA/Drivers/Peripheral/SerialStream.h
LUFA/Drivers/USB/LowLevel/DevChapter9.c
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/DeviceSupport.txt
LUFA/ManPages/FutureChanges.txt
LUFA/ManPages/LUFAPoweredProjects.txt

index 6fcdc4b..eb5c580 100644 (file)
@@ -108,7 +108,7 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
                        \r
                        .Attributes             = (ATTR_CAN_UPLOAD | ATTR_CAN_DOWNLOAD),\r
 \r
-                       .DetachTimeout         = 0x0000,\r
+                       .DetachTimeout          = 0x0000,\r
                        .TransferSize           = 0x0c00,\r
                \r
                        .DFUSpecification       = VERSION_BCD(01.01)\r
index f3d86a6..4b9224a 100644 (file)
@@ -41,7 +41,6 @@
  */\r
 bool RunBootloader = true;\r
 \r
-\r
 /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously \r
  *  runs the bootloader processing routine until instructed to soft-exit.\r
  */\r
@@ -105,7 +104,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                        {\r
                                Endpoint_ClearSETUP();\r
                                \r
-                               /* Wait until the command (report) has been sent by the host */\r
+                               /* Wait until the command has been sent by the host */\r
                                while (!(Endpoint_IsOUTReceived()));\r
                        \r
                                /* Read in the write destination address */\r
@@ -123,7 +122,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                                        boot_spm_busy_wait();\r
                                        \r
                                        /* Write each of the FLASH page's bytes in sequence */\r
-                                       for (uint8_t PageByte = 0; PageByte < 128; PageByte += 2)\r
+                                       for (uint8_t PageByte = 0; PageByte < SPM_PAGESIZE; PageByte += 2)\r
                                        {\r
                                                /* Check if endpoint is empty - if so clear it and wait until ready for next packet */\r
                                                if (!(Endpoint_BytesInEndpoint()))\r
index 5d74cb1..8940ae0 100644 (file)
@@ -130,10 +130,10 @@ void CheckJoystickMovement(void)
        {\r
                ActionSent = true;\r
 \r
-               // Write the string to the virtual COM port via the created character stream\r
+               /* Write the string to the virtual COM port via the created character stream */\r
                fputs(ReportString, &USBSerialStream);\r
 \r
-               // Alternatively, without the stream:\r
+               /* Alternatively, without the stream: */\r
                // CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString, strlen(ReportString));\r
        }\r
 }\r
index 151d282..45dfb74 100644 (file)
@@ -32,8 +32,8 @@
        SideShow Class demonstration application. This give a reference\r
        for implementing Microsoft SideShow compatible devices in an\r
        embedded environment. SideShow allows for gadget data displayed\r
-       on a Vista machine to also be displayed on an externally connected\r
-       interactive display. Upon enumeration on a Vista system, this will\r
+       on a Windows Vista or later machine to also be displayed on an\r
+       externally connected interactive display. Upon enumeration, this will\r
        appear as a new SideShow device which can have gadgets loaded onto\r
        it.\r
        \r
index fec5f73..f8839c9 100644 (file)
   this software.\r
 */\r
 \r
+#define  INCLUDE_FROM_SERIALSTREAM_C\r
 #include "SerialStream.h"\r
 \r
 FILE USARTStream = FDEV_SETUP_STREAM(SerialStream_TxByte, SerialStream_RxByte, _FDEV_SETUP_RW);\r
 \r
-int SerialStream_TxByte(char DataByte, FILE *Stream)\r
+static int SerialStream_TxByte(char DataByte, FILE *Stream)\r
 {\r
        Serial_TxByte(DataByte);\r
 \r
        return 0;\r
 }\r
 \r
-int SerialStream_RxByte(FILE *Stream)\r
+static int SerialStream_RxByte(FILE *Stream)\r
 {\r
        return Serial_RxByte();\r
 }\r
index 293fda0..d93ea52 100644 (file)
                        extern FILE USARTStream;\r
 \r
                /* Function Prototypes: */\r
-                       int SerialStream_TxByte(char DataByte, FILE *Stream) ATTR_NON_NULL_PTR_ARG(2);\r
-                       int SerialStream_RxByte(FILE *Stream) ATTR_NON_NULL_PTR_ARG(1);\r
+               #if defined(INCLUDE_FROM_SERIALSTREAM_C)\r
+                       static int SerialStream_TxByte(char DataByte, FILE *Stream) ATTR_NON_NULL_PTR_ARG(2);\r
+                       static int SerialStream_RxByte(FILE *Stream) ATTR_NON_NULL_PTR_ARG(1);\r
+               #endif\r
        #endif\r
 \r
        /* Public Interface - May be used in end-application: */\r
index bb6104f..6e7b2c7 100644 (file)
@@ -129,11 +129,11 @@ static void USB_Device_SetAddress(void)
                  return;\r
        }\r
 \r
-       UDADDR = ((1 << ADDEN) | DeviceAddress);\r
-\r
        if (DeviceAddress)\r
          USB_DeviceState = DEVICE_STATE_Addressed;\r
 \r
+       UDADDR = ((1 << ADDEN) | DeviceAddress);\r
+\r
        return;\r
 }\r
 \r
@@ -192,10 +192,7 @@ static void USB_Device_SetConfiguration(void)
 \r
        Endpoint_ClearStatusStage();\r
 \r
-       if (USB_ConfigurationNumber)\r
-         USB_DeviceState = DEVICE_STATE_Configured;\r
-       else\r
-         USB_DeviceState = DEVICE_STATE_Addressed;\r
+       USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed;\r
 \r
        EVENT_USB_Device_ConfigurationChanged();\r
 }\r
@@ -225,10 +222,10 @@ static void USB_Device_GetInternalSerialDescriptor(void)
                int16_t                 UnicodeString[20];\r
        } SignatureDescriptor;\r
 \r
-       SignatureDescriptor.Header.Size  = sizeof(SignatureDescriptor);\r
-       SignatureDescriptor.Header.Type  = DTYPE_String;\r
+       SignatureDescriptor.Header.Type = DTYPE_String;\r
+       SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor);\r
        \r
-       uint8_t  SigReadAddress = 0x0E;\r
+       uint8_t SigReadAddress = 0x0E;\r
 \r
        for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)\r
        {\r
@@ -358,16 +355,16 @@ static void USB_Device_ClearSetFeature(void)
 \r
                                if (Endpoint_IsEnabled())\r
                                {                               \r
-                                       if (USB_ControlRequest.bRequest == REQ_ClearFeature)\r
+                                       if (USB_ControlRequest.bRequest == REQ_SetFeature)\r
                                        {\r
-                                               Endpoint_ClearStall();\r
-                                               Endpoint_ResetFIFO(EndpointIndex);\r
-                                               Endpoint_ResetDataToggle();\r
+                                               Endpoint_StallTransaction();\r
                                        }\r
                                        else\r
                                        {\r
-                                               Endpoint_StallTransaction();\r
-                                       }\r
+                                               Endpoint_ClearStall();\r
+                                               Endpoint_ResetFIFO(EndpointIndex);\r
+                                               Endpoint_ResetDataToggle();\r
+                                       }                                       \r
                                }\r
                        }\r
                        \r
index aaa811f..b3a3d92 100644 (file)
   *  - Added new Joystick Host ClassDriver and LowLevel demos\r
   *  - Added new Printer Host mode Class driver\r
   *  - Added new Printer Host mode ClassDriver demo\r
-  *  - Added optional support for double banked endpoints in the Device mode Class drivers\r
-  *  - Added new stream creation function to the CDC Class drivers, to easily make standard streams from CDC Class driver instances\r
+  *  - Added optional support for double banked endpoints and pipes in the Device and Host mode Class drivers\r
+  *  - Added new stream creation function to the CDC Class drivers, to easily make standard I/O streams from CDC Class driver instances\r
   *\r
   *  <b>Changed:</b>\r
   *  - Removed mostly useless "TestApp" demo, as it was mainly useful only for checking for sytax errors in the library\r
   *  - MIDI device demos now receive MIDI events from the host and display note ON messages via the board LEDs\r
-  *  - Cleanups to the Device mode Mass Storage demo applications' SCSI routines\r
+  *  - Cleanups to the Device mode Mass Storage demo application SCSI routines\r
   *  - Changed Audio Class driver sample read/write functions to be inline, to reduce the number of cycles needed to transfer\r
   *    samples to and from the device (allowing more time for sample processing and output)\r
   *  - Audio class Device mode demos now work at both 16MHz and 8MHz, rather than just at 8MHz\r
index b9793ff..832edc9 100644 (file)
@@ -29,7 +29,7 @@
  *   - ATAVRUSBRF01\r
  *   - XPLAIN (AT90USB1287 only)\r
  *\r
- *  Currently supported third-party boards:\r
+ *  Currently supported third-party board (via hardware drivers):\r
  *   - BUMBLEB (using officially recommended peripheral layout)\r
  *   - Any Other Custom User Boards (with Board Drivers, \see Page_WritingBoardDrivers)\r
  */\r
index 750fb15..93a9a51 100644 (file)
   *  or post your suggestion as an enhancement request to the project bug tracker.\r
   *\r
   *  <b>Targeted for the Next Release (SVN Development Only):</b>\r
-  *  - Add hub support to match Atmel's stack\r
-  *  - Add ability to get number of bytes not written with pipe/endpoint write routines after an error\r
   *\r
   *  <b>Targeted for Future Releases:</b>\r
+  *  - Add hub support to match Atmel's stack\r
+  *  - Add ability to get number of bytes not written with pipe/endpoint write routines after an error\r
   *  - Add standardized descriptor names to class driver structures\r
   *  - Remake AVRStudio project files\r
   *  - Add detailed overviews of how each demo works\r
index 4c5a694..a548b8f 100644 (file)
@@ -41,6 +41,7 @@
  *  - Opendous-JTAG, an open source JTAG device: http://code.google.com/p/opendous-jtag/\r
  *  - Openkubus, an open source hardware-based authentication dongle: http://code.google.com/p/openkubus/\r
  *  - Orbee, a USB connected RGB Orb for notifications: http://www.franksworkshop.com.au/Electronics/Orbee/Orbee.htm\r
+ *  - Programmable XBOX controller: http://richard-burke.dyndns.org/wordpress/pan-galactic-gargantuan-gargle-brain-aka-xbox-360-usb-controller/\r
  *  - Reprap with LUFA, a LUFA powered 3D printer: http://code.google.com/p/at90usb1287-code-for-arduino-and-eclipse/\r
  *  - SEGA Megadrive/Genesis Development Cartridge: http://www.makestuff.eu/wordpress/?page_id=398\r
  *  - SEGA Megadrive/Super Nintendo Cartridge Reader: http://www.snega2usb.com\r