Commit 04774208 authored by Dean Camera's avatar Dean Camera
Browse files

Minor code cleanups for clarity.

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