All comments in the library, bootloaders, demos and projects have now been spell-checked and spelling mistakes/typos corrected.

pull/1469/head
Dean Camera 16 years ago
parent fb3fcb968e
commit 6933f2e1a5

@ -510,7 +510,7 @@ TASK(CDC_Task)
} }
else if ((Command == 'B') || (Command == 'g')) else if ((Command == 'B') || (Command == 'g'))
{ {
/* Delegate the block write/read to a seperate function for clarity */ /* Delegate the block write/read to a separate function for clarity */
ReadWriteMemoryBlock(Command); ReadWriteMemoryBlock(Command);
} }
else if (Command == 'R') else if (Command == 'R')

@ -205,7 +205,7 @@ USB_Descriptor_String_t ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -539,7 +539,7 @@ static void LoadStartEndAddresses(void)
EndAddr = Address[1].Word; EndAddr = Address[1].Word;
} }
/** Handler for a Memory Program command issued by the host. This routine handles the preperations needed /** Handler for a Memory Program command issued by the host. This routine handles the preparations needed
* to write subsequent data from the host into the specified memory. * to write subsequent data from the host into the specified memory.
*/ */
static void ProcessMemProgCommand(void) static void ProcessMemProgCommand(void)
@ -569,7 +569,7 @@ static void ProcessMemProgCommand(void)
} }
} }
/** Handler for a Memory Read command issued by the host. This routine handles the preperations needed /** Handler for a Memory Read command issued by the host. This routine handles the preparations needed
* to read subsequent data from the specified memory out to the host, as well as implementing the memory * to read subsequent data from the specified memory out to the host, as well as implementing the memory
* blank check command. * blank check command.
*/ */

@ -63,7 +63,7 @@
/** Minor bootloader version number. */ /** Minor bootloader version number. */
#define BOOTLOADER_VERSION_REV 0 #define BOOTLOADER_VERSION_REV 0
/** Complete bootloder version number expressed as a packed byte, constructed from the /** Complete bootloader version number expressed as a packed byte, constructed from the
* two individual bootloader version macros. * two individual bootloader version macros.
*/ */
#define BOOTLOADER_VERSION ((BOOTLOADER_VERSION_MINOR << 4) | BOOTLOADER_VERSION_REV) #define BOOTLOADER_VERSION ((BOOTLOADER_VERSION_MINOR << 4) | BOOTLOADER_VERSION_REV)
@ -100,7 +100,7 @@
*/ */
#define DFU_FILLER_BYTES_SIZE 26 #define DFU_FILLER_BYTES_SIZE 26
/** DFU class command request to detatch from the host. */ /** DFU class command request to detach from the host. */
#define DFU_DETATCH 0x00 #define DFU_DETATCH 0x00
/** DFU class command request to send data from the host to the bootloader. */ /** DFU class command request to send data from the host to the bootloader. */
@ -141,7 +141,7 @@
/** Type define for a non-returning function pointer to the loaded application. */ /** Type define for a non-returning function pointer to the loaded application. */
typedef void (*AppPtr_t)(void) ATTR_NO_RETURN; typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;
/** Type define for a strucuture containing a complete DFU command issued by the host. */ /** Type define for a structure containing a complete DFU command issued by the host. */
typedef struct typedef struct
{ {
uint8_t Command; /**< Single byte command to perform, one of the COMMAND_* macro values */ uint8_t Command; /**< Single byte command to perform, one of the COMMAND_* macro values */

@ -139,7 +139,7 @@ USB_Descriptor_String_t ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -44,11 +44,11 @@
#define DTYPE_DFUFunctional 0x21 #define DTYPE_DFUFunctional 0x21
/** DFU attribute mask, indicating that the DFU device will detach and re-attach when a DFU_DETACH /** DFU attribute mask, indicating that the DFU device will detach and re-attach when a DFU_DETACH
* command is issued, rather than the host issing a USB Reset. * command is issued, rather than the host issuing a USB Reset.
*/ */
#define ATTR_WILL_DETATCH (1 << 3) #define ATTR_WILL_DETATCH (1 << 3)
/** DFU attribute mask, indicating that the DFU device can communicate during the manefestation phase /** DFU attribute mask, indicating that the DFU device can communicate during the manifestation phase
* (memory programming phase). * (memory programming phase).
*/ */
#define ATTR_MANEFESTATION_TOLLERANT (1 << 2) #define ATTR_MANEFESTATION_TOLLERANT (1 << 2)

@ -168,7 +168,7 @@ USB_Descriptor_String_t ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -267,7 +267,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -183,7 +183,7 @@
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */ uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */ uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each seperate audio channel */ uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioFeatureUnit_t; } USB_AudioFeatureUnit_t;
@ -202,7 +202,7 @@
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset * such as the speaker and microphone of a phone handset
*/ */
uint8_t TotalChannels; /**< Total number of seperate audio channels within this interface (right, left, etc.) */ uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */ uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */ uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */

@ -236,7 +236,7 @@ TASK(USB_Audio_Task)
/* Clear the sample reload timer */ /* Clear the sample reload timer */
TIFR0 |= (1 << OCF0A); TIFR0 |= (1 << OCF0A);
/* Retreive the signed 16-bit left and right audio samples */ /* Retrieve the signed 16-bit left and right audio samples */
int16_t LeftSample_16Bit = (int16_t)Endpoint_Read_Word_LE(); int16_t LeftSample_16Bit = (int16_t)Endpoint_Read_Word_LE();
int16_t RightSample_16Bit = (int16_t)Endpoint_Read_Word_LE(); int16_t RightSample_16Bit = (int16_t)Endpoint_Read_Word_LE();

@ -267,7 +267,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -183,7 +183,7 @@
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */ uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */ uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each seperate audio channel */ uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */ uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioFeatureUnit_t; } USB_AudioFeatureUnit_t;
@ -202,7 +202,7 @@
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset * such as the speaker and microphone of a phone handset
*/ */
uint8_t TotalChannels; /**< Total number of seperate audio channels within this interface (right, left, etc.) */ uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */ uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */ uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */

@ -56,7 +56,7 @@ TASK_LIST
* *
* These values are set by the host via a class-specific request, however they are not required to be used accurately. * These values are set by the host via a class-specific request, however they are not required to be used accurately.
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical * It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and recieves data in endpoint streams. * serial link characteristics and instead sends and receives data in endpoint streams.
*/ */
CDC_Line_Coding_t LineCoding = { BaudRateBPS: 9600, CDC_Line_Coding_t LineCoding = { BaudRateBPS: 9600,
CharFormat: OneStopBit, CharFormat: OneStopBit,
@ -66,7 +66,7 @@ CDC_Line_Coding_t LineCoding = { BaudRateBPS: 9600,
/** String to print through the virtual serial port when the joystick is pressed upwards. */ /** String to print through the virtual serial port when the joystick is pressed upwards. */
char JoystickUpString[] = "Joystick Up\r\n"; char JoystickUpString[] = "Joystick Up\r\n";
/** String to print through the virtual serial port when the joystick is pressed downwards. */ /** String to print through the virtual serial port when the joystick is pressed downward. */
char JoystickDownString[] = "Joystick Down\r\n"; char JoystickDownString[] = "Joystick Down\r\n";
/** String to print through the virtual serial port when the joystick is pressed left. */ /** String to print through the virtual serial port when the joystick is pressed left. */

@ -98,17 +98,17 @@
#define CONTROL_LINE_IN_RING (1 << 3) #define CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has ocurred on the virtual serial port. * to indicate that a framing error has occurred on the virtual serial port.
*/ */
#define CONTROL_LINE_IN_FRAMEERROR (1 << 4) #define CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has ocurred on the virtual serial port. * to indicate that a parity error has occurred on the virtual serial port.
*/ */
#define CONTROL_LINE_IN_PARITYERROR (1 << 5) #define CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has ocurred on the virtual serial port. * to indicate that a data overrun error has occurred on the virtual serial port.
*/ */
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6) #define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
@ -138,7 +138,7 @@
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum * CDCDevice_LineCodingParity_t enum
*/ */
uint8_t DataBits; /**< Bits of data per charater of the virtual serial port */ uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} CDC_Line_Coding_t; } CDC_Line_Coding_t;
/** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a /** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a

@ -216,7 +216,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -338,7 +338,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -57,7 +57,7 @@ TASK_LIST
* *
* These values are set by the host via a class-specific request, however they are not required to be used accurately. * These values are set by the host via a class-specific request, however they are not required to be used accurately.
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical * It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and recieves data in endpoint streams. * serial link characteristics and instead sends and receives data in endpoint streams.
*/ */
CDC_Line_Coding_t LineCoding1 = { BaudRateBPS: 9600, CDC_Line_Coding_t LineCoding1 = { BaudRateBPS: 9600,
CharFormat: OneStopBit, CharFormat: OneStopBit,
@ -70,7 +70,7 @@ CDC_Line_Coding_t LineCoding1 = { BaudRateBPS: 9600,
* *
* These values are set by the host via a class-specific request, however they are not required to be used accurately. * These values are set by the host via a class-specific request, however they are not required to be used accurately.
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical * It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and recieves data in endpoint streams. * serial link characteristics and instead sends and receives data in endpoint streams.
*/ */
CDC_Line_Coding_t LineCoding2 = { BaudRateBPS: 9600, CDC_Line_Coding_t LineCoding2 = { BaudRateBPS: 9600,
CharFormat: OneStopBit, CharFormat: OneStopBit,
@ -80,7 +80,7 @@ CDC_Line_Coding_t LineCoding2 = { BaudRateBPS: 9600,
/** String to print through the first virtual serial port when the joystick is pressed upwards. */ /** String to print through the first virtual serial port when the joystick is pressed upwards. */
char JoystickUpString[] = "Joystick Up\r\n"; char JoystickUpString[] = "Joystick Up\r\n";
/** String to print through the first virtual serial port when the joystick is pressed downwards. */ /** String to print through the first virtual serial port when the joystick is pressed downward. */
char JoystickDownString[] = "Joystick Down\r\n"; char JoystickDownString[] = "Joystick Down\r\n";
/** String to print through the first virtual serial port when the joystick is pressed left. */ /** String to print through the first virtual serial port when the joystick is pressed left. */
@ -324,7 +324,7 @@ TASK(CDC1_Task)
Endpoint_ClearCurrentBank(); Endpoint_ClearCurrentBank();
} }
/** Function to manage CDC data transmission and reception to and from the host for the second CDC interface, which echos back /** Function to manage CDC data transmission and reception to and from the host for the second CDC interface, which echoes back
* all data sent to it from the host. * all data sent to it from the host.
*/ */
TASK(CDC2_Task) TASK(CDC2_Task)
@ -335,13 +335,13 @@ TASK(CDC2_Task)
/* Check to see if any data has been received */ /* Check to see if any data has been received */
if (Endpoint_ReadWriteAllowed()) if (Endpoint_ReadWriteAllowed())
{ {
/* Create a temp buffer big enough to hold the incomming endpoint packet */ /* Create a temp buffer big enough to hold the incoming endpoint packet */
uint8_t Buffer[Endpoint_BytesInEndpoint()]; uint8_t Buffer[Endpoint_BytesInEndpoint()];
/* Remember how large the incomming packet is */ /* Remember how large the incoming packet is */
uint16_t DataLength = Endpoint_BytesInEndpoint(); uint16_t DataLength = Endpoint_BytesInEndpoint();
/* Read in the incomming packet into the buffer */ /* Read in the incoming packet into the buffer */
Endpoint_Read_Stream_LE(&Buffer, DataLength); Endpoint_Read_Stream_LE(&Buffer, DataLength);
/* Finalize the stream transfer to send the last packet */ /* Finalize the stream transfer to send the last packet */

@ -87,7 +87,7 @@
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum * CDCDevice_LineCodingParity_t enum
*/ */
uint8_t DataBits; /**< Bits of data per charater of the virtual serial port */ uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} CDC_Line_Coding_t; } CDC_Line_Coding_t;
/* Enums: */ /* Enums: */

@ -195,7 +195,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -268,7 +268,7 @@ TASK(USB_HID_Report)
if (Endpoint_ReadWriteAllowed()) if (Endpoint_ReadWriteAllowed())
{ {
/* Create a tempoary buffer to hold the read in report from the host */ /* Create a temporary buffer to hold the read in report from the host */
uint8_t GenericData[GENERIC_REPORT_SIZE]; uint8_t GenericData[GENERIC_REPORT_SIZE];
/* Read Generic Report Data */ /* Read Generic Report Data */
@ -285,7 +285,7 @@ TASK(USB_HID_Report)
if (Endpoint_ReadWriteAllowed()) if (Endpoint_ReadWriteAllowed())
{ {
/* Create a tempoary buffer to hold the report to send to the host */ /* Create a temporary buffer to hold the report to send to the host */
uint8_t GenericData[GENERIC_REPORT_SIZE]; uint8_t GenericData[GENERIC_REPORT_SIZE];
/* Create Generic Report Data */ /* Create Generic Report Data */

@ -195,7 +195,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -212,7 +212,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -67,7 +67,7 @@ bool UsingReportProtocol = true;
uint8_t IdleCount = 0; uint8_t IdleCount = 0;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle /** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
* milliseconds. This is seperate to the IdleCount timer and is incremented and compared as the host may request * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
* the current idle period via a Get Idle HID class request, thus its value must be preserved. * the current idle period via a Get Idle HID class request, thus its value must be preserved.
*/ */
uint16_t IdleMSRemaining = 0; uint16_t IdleMSRemaining = 0;
@ -243,7 +243,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Read in the LED report from the host */ /* Read in the LED report from the host */
uint8_t LEDStatus = Endpoint_Read_Byte(); uint8_t LEDStatus = Endpoint_Read_Byte();
/* Process the incomming LED report */ /* Process the incoming LED report */
ProcessLEDReport(LEDStatus); ProcessLEDReport(LEDStatus);
/* Clear the endpoint data */ /* Clear the endpoint data */

@ -282,7 +282,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -278,7 +278,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -117,7 +117,7 @@
} USB_AudioStreamEndpoint_Std_t; } USB_AudioStreamEndpoint_Std_t;
/** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either /** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either
* a physical input jack, or a logical jack (recieving input data internally, or from the host via an endpoint). * a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
*/ */
typedef struct typedef struct
{ {

@ -172,7 +172,7 @@ USB_Descriptor_String_t PROGMEM SerialNumberString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -56,7 +56,7 @@ CommandBlockWrapper_t CommandBlock;
/** Structure to hold the latest Command Status Wrapper to return to the host, containing the status of the last issued command. */ /** Structure to hold the latest Command Status Wrapper to return to the host, containing the status of the last issued command. */
CommandStatusWrapper_t CommandStatus = { Signature: CSW_SIGNATURE }; CommandStatusWrapper_t CommandStatus = { Signature: CSW_SIGNATURE };
/** Flag to asyncronously abort any in-progress data transfers upon the reception of a mass storage reset command. */ /** Flag to asynchronously abort any in-progress data transfers upon the reception of a mass storage reset command. */
volatile bool IsMassStoreReset = false; volatile bool IsMassStoreReset = false;
/** Main program entry point. This routine configures the hardware required by the application, then /** Main program entry point. This routine configures the hardware required by the application, then
@ -262,7 +262,7 @@ TASK(USB_MassStorage)
/* Return command status block to the host */ /* Return command status block to the host */
ReturnCommandStatus(); ReturnCommandStatus();
/* Check if a Mass Storage Reset ocurred */ /* Check if a Mass Storage Reset occurred */
if (IsMassStoreReset) if (IsMassStoreReset)
{ {
/* Reset the data endpoint banks */ /* Reset the data endpoint banks */

@ -38,7 +38,7 @@
#define INCLUDE_FROM_SCSI_C #define INCLUDE_FROM_SCSI_C
#include "SCSI.h" #include "SCSI.h"
/** Structure to hold the SCSI reponse data to a SCSI INQUIRY command. This gives information about the device's /** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities. * features and capabilities.
*/ */
SCSI_Inquiry_Response_t InquiryData = SCSI_Inquiry_Response_t InquiryData =
@ -88,7 +88,7 @@ void SCSI_DecodeSCSICommand(void)
{ {
bool CommandSuccess = false; bool CommandSuccess = false;
/* Run the apropriate SCSI command hander function based on the passed command */ /* Run the appropriate SCSI command hander function based on the passed command */
switch (CommandBlock.SCSICommandData[0]) switch (CommandBlock.SCSICommandData[0])
{ {
case SCSI_CMD_INQUIRY: case SCSI_CMD_INQUIRY:
@ -235,7 +235,7 @@ static bool SCSI_Command_Read_Capacity_10(void)
return true; return true;
} }
/** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command peforms a quick check of the Dataflash ICs on the /** Command processing for an issued SCSI SEND DIAGNOSTIC command. This command performs a quick check of the Dataflash ICs on the
* board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is * board, and indicates if they are present and functioning correctly. Only the Self-Test portion of the diagnostic command is
* supported. * supported.
* *

@ -195,7 +195,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -66,7 +66,7 @@ bool UsingReportProtocol = true;
uint8_t IdleCount = 0; uint8_t IdleCount = 0;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle /** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
* milliseconds. This is seperate to the IdleCount timer and is incremented and compared as the host may request * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
* the current idle period via a Get Idle HID class request, thus its value must be preserved. * the current idle period via a Get Idle HID class request, thus its value must be preserved.
*/ */
uint16_t IdleMSRemaining = 0; uint16_t IdleMSRemaining = 0;

@ -41,7 +41,7 @@
* to the output Ethernet frame if the host is requesting the IP or MAC address of the * to the output Ethernet frame if the host is requesting the IP or MAC address of the
* virtual server device on the network. * virtual server device on the network.
* *
* \param InDataStart Pointer to the start of the incomming packet's ARP header * \param InDataStart Pointer to the start of the incoming packet's ARP header
* \param OutDataStart Pointer to the start of the outgoing packet's ARP header * \param OutDataStart Pointer to the start of the outgoing packet's ARP header
* *
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise

@ -40,8 +40,8 @@
/** Processes a DHCP packet inside an Ethernet frame, and writes the appropriate response /** Processes a DHCP packet inside an Ethernet frame, and writes the appropriate response
* to the output Ethernet frame if the host is requesting or accepting an IP address. * to the output Ethernet frame if the host is requesting or accepting an IP address.
* *
* \param IPHeaderInStart Pointer to the start of the incomming packet's IP header * \param IPHeaderInStart Pointer to the start of the incoming packet's IP header
* \param DHCPHeaderInStart Pointer to the start of the incomming packet's DHCP header * \param DHCPHeaderInStart Pointer to the start of the incoming packet's DHCP header
* \param DHCPHeaderOutStart Pointer to the start of the outgoing packet's DHCP header * \param DHCPHeaderOutStart Pointer to the start of the outgoing packet's DHCP header
* *
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
@ -72,12 +72,12 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, void* DHCPHeaderInStart, v
memcpy(&DHCPHeaderOUT->ClientHardwareAddress, &DHCPHeaderIN->ClientHardwareAddress, sizeof(MAC_Address_t)); memcpy(&DHCPHeaderOUT->ClientHardwareAddress, &DHCPHeaderIN->ClientHardwareAddress, sizeof(MAC_Address_t));
DHCPHeaderOUT->Cookie = SwapEndian_32(DHCP_MAGIC_COOKIE); DHCPHeaderOUT->Cookie = SwapEndian_32(DHCP_MAGIC_COOKIE);
/* Alter the incomming IP packet header so that the corrected IP source and destinations are used - this means that /* Alter the incoming IP packet header so that the corrected IP source and destinations are used - this means that
when the response IP header is generated, it will use the corrected addresses and not the null/broatcast addresses */ when the response IP header is generated, it will use the corrected addresses and not the null/broatcast addresses */
IPHeaderIN->SourceAddress = ClientIPAddress; IPHeaderIN->SourceAddress = ClientIPAddress;
IPHeaderIN->DestinationAddress = ServerIPAddress; IPHeaderIN->DestinationAddress = ServerIPAddress;
/* Process the incomming DHCP packet options */ /* Process the incoming DHCP packet options */
while (DHCPOptionsINStart[0] != DHCP_OPTION_END) while (DHCPOptionsINStart[0] != DHCP_OPTION_END)
{ {
/* Find the Message Type DHCP option, to determine the type of DHCP packet */ /* Find the Message Type DHCP option, to determine the type of DHCP packet */

@ -102,7 +102,7 @@
uint8_t HardwareAddressLength; /**< Length in bytes of a hardware (MAC) address on the network */ uint8_t HardwareAddressLength; /**< Length in bytes of a hardware (MAC) address on the network */
uint8_t Hops; /**< Number of hops required to reach the server, unused */ uint8_t Hops; /**< Number of hops required to reach the server, unused */
uint32_t TransactionID; /**< Unique ID of the DHCP packet, for postive matching between sent and recieved packets */ uint32_t TransactionID; /**< Unique ID of the DHCP packet, for positive matching between sent and received packets */
uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */ uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
uint16_t Flags; /**< BOOTP packet flags */ uint16_t Flags; /**< BOOTP packet flags */

@ -216,7 +216,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -31,14 +31,14 @@
/** \file /** \file
* *
* Ethernet frame packet handling routines. This protocol handles the processing of raw Ethernet * Ethernet frame packet handling routines. This protocol handles the processing of raw Ethernet
* frames sent and receieved, deferring the processing of subpacket protocols to the appropriate * frames sent and received, deferring the processing of subpacket protocols to the appropriate
* protocol handlers, such as DHCP or ARP. * protocol handlers, such as DHCP or ARP.
*/ */
#include "Ethernet.h" #include "Ethernet.h"
/* Global Variables: */ /* Global Variables: */
/** Ethernet Frame buffer structure, to hold the incomming Ethernet frame from the host. */ /** Ethernet Frame buffer structure, to hold the incoming Ethernet frame from the host. */
Ethernet_Frame_Info_t FrameIN; Ethernet_Frame_Info_t FrameIN;
/** Ethernet Frame buffer structure, to hold the outgoing Ethernet frame to the host. */ /** Ethernet Frame buffer structure, to hold the outgoing Ethernet frame to the host. */
@ -60,14 +60,14 @@ const IP_Address_t BroadcastIPAddress = {BROADCAST_IP_ADDRESS};
const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS}; const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS};
/** Processes an incomming Ethernet frame, and writes the appropriate response to the output Ethernet /** Processes an incoming Ethernet frame, and writes the appropriate response to the output Ethernet
* frame buffer if the sub protocol handlers create a valid response. * frame buffer if the sub protocol handlers create a valid response.
*/ */
void Ethernet_ProcessPacket(void) void Ethernet_ProcessPacket(void)
{ {
DecodeEthernetFrameHeader(FrameIN.FrameData); DecodeEthernetFrameHeader(FrameIN.FrameData);
/* Cast the incomming Ethernet frame to the Ethernet header type */ /* Cast the incoming Ethernet frame to the Ethernet header type */
Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN.FrameData; Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN.FrameData;
Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT.FrameData; Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT.FrameData;
@ -91,7 +91,7 @@ void Ethernet_ProcessPacket(void)
break; break;
} }
/* Protcol processing routine has filled a response, complete the ethernet frame header */ /* Protocol processing routine has filled a response, complete the ethernet frame header */
if (RetSize > 0) if (RetSize > 0)
{ {
/* Fill out the response Ethernet frame header */ /* Fill out the response Ethernet frame header */

@ -65,7 +65,7 @@
*/ */
#define MAC_COMPARE(MAC1, MAC2) (memcmp(MAC1, MAC2, sizeof(MAC_Address_t)) == 0) #define MAC_COMPARE(MAC1, MAC2) (memcmp(MAC1, MAC2, sizeof(MAC_Address_t)) == 0)
/** Maximum size of an incomming or outgoing Ethernet frame in bytes */ /** Maximum size of an incoming or outgoing Ethernet frame in bytes */
#define ETHERNET_FRAME_SIZE_MAX 1500 #define ETHERNET_FRAME_SIZE_MAX 1500
/** Minimum size of an Ethernet packet in bytes, to conform to the Ethernet V2 packet standard */ /** Minimum size of an Ethernet packet in bytes, to conform to the Ethernet V2 packet standard */

@ -40,7 +40,7 @@
/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response /** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response
* to the output Ethernet frame if the host is issuing a ICMP ECHO request. * to the output Ethernet frame if the host is issuing a ICMP ECHO request.
* *
* \param InDataStart Pointer to the start of the incomming packet's ICMP header * \param InDataStart Pointer to the start of the incoming packet's ICMP header
* \param OutDataStart Pointer to the start of the outgoing packet's ICMP header * \param OutDataStart Pointer to the start of the outgoing packet's ICMP header
* *
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise

@ -39,7 +39,7 @@
/** Processes an IP packet inside an Ethernet frame, and writes the appropriate response /** Processes an IP packet inside an Ethernet frame, and writes the appropriate response
* to the output Ethernet frame if one is created by a subprotocol handler. * to the output Ethernet frame if one is created by a subprotocol handler.
* *
* \param InDataStart Pointer to the start of the incomming packet's IP header * \param InDataStart Pointer to the start of the incoming packet's IP header
* \param OutDataStart Pointer to the start of the outgoing packet's IP header * \param OutDataStart Pointer to the start of the outgoing packet's IP header
* *
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE if no * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE if no

@ -51,7 +51,7 @@
/** Protocol IP address of the virtual server machine */ /** Protocol IP address of the virtual server machine */
#define SERVER_IP_ADDRESS { 10, 0, 0, 2} #define SERVER_IP_ADDRESS { 10, 0, 0, 2}
/** Protocol IP address of the broadcase address */ /** Protocol IP address of the broadcast address */
#define BROADCAST_IP_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF} #define BROADCAST_IP_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF}
/** Default Time To Live (TTL) value for sent packets, indicating the maximum allowable hops until their destination is reached */ /** Default Time To Live (TTL) value for sent packets, indicating the maximum allowable hops until their destination is reached */
@ -75,7 +75,7 @@
uint8_t TypeOfService; /**< Special service type identifier, indicating delay/throughput/reliability levels */ uint8_t TypeOfService; /**< Special service type identifier, indicating delay/throughput/reliability levels */
uint16_t TotalLength; /**< Total length of the IP packet, in bytes */ uint16_t TotalLength; /**< Total length of the IP packet, in bytes */
uint16_t Identification; /**< Idenfication value for identifying fragmented packets */ uint16_t Identification; /**< Identification value for identifying fragmented packets */
unsigned int FragmentOffset : 13; /**< Offset of this IP fragment */ unsigned int FragmentOffset : 13; /**< Offset of this IP fragment */
unsigned int Flags : 3; /**< Fragment flags, to indicate if a packet is fragmented */ unsigned int Flags : 3; /**< Fragment flags, to indicate if a packet is fragmented */

@ -29,7 +29,7 @@
*/ */
/* Protocol decoders for Ethernet, TCP, IP, ICMP and ARP. Each of these routines /* Protocol decoders for Ethernet, TCP, IP, ICMP and ARP. Each of these routines
accepts a header to the appropriate protocol and prints out pertient information accepts a header to the appropriate protocol and prints out pertinent information
on the packet through the serial port. on the packet through the serial port.
To disable printing of a specific protocol, define the token NO_DECODE_{Protocol} To disable printing of a specific protocol, define the token NO_DECODE_{Protocol}
@ -39,7 +39,7 @@
/** \file /** \file
* *
* Protocol decoding routines, for the plain-text decoding of Ethernet frames for debugging purposes. * Protocol decoding routines, for the plain-text decoding of Ethernet frames for debugging purposes.
* Enabled protocol decoders will print incomming Ethernet frame contents through the USART in a human * Enabled protocol decoders will print incoming Ethernet frame contents through the USART in a human
* readable format. * readable format.
* *
* Note that the USART is a slow transmission medium, and will slow down packet processing considerably. * Note that the USART is a slow transmission medium, and will slow down packet processing considerably.

@ -45,7 +45,7 @@
#include "Ethernet.h" #include "Ethernet.h"
/* Macros: */ /* Macros: */
/** Physical MAC Address of the USB netowork adapter */ /** Physical MAC Address of the USB network adapter */
#define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00} #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00}
/** Implemented RNDIS Version Major */ /** Implemented RNDIS Version Major */

@ -99,7 +99,7 @@ EVENT_HANDLER(USB_Connect)
} }
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
* the status LEDs and stops all the relevent tasks. * the status LEDs and stops all the relevant tasks.
*/ */
EVENT_HANDLER(USB_Disconnect) EVENT_HANDLER(USB_Disconnect)
{ {
@ -114,7 +114,7 @@ EVENT_HANDLER(USB_Disconnect)
} }
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
* of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevent tasks. * of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks.
*/ */
EVENT_HANDLER(USB_ConfigurationChanged) EVENT_HANDLER(USB_ConfigurationChanged)
{ {
@ -238,7 +238,7 @@ void UpdateStatus(uint8_t CurrentStatus)
} }
/** Task to manage the sending and receiving of encapsulated RNDIS data and notifications. This removes the RNDIS /** Task to manage the sending and receiving of encapsulated RNDIS data and notifications. This removes the RNDIS
* wrapper from recieved Ethernet frames and places them in the FrameIN global buffer, or adds the RNDIS wrapper * wrapper from received Ethernet frames and places them in the FrameIN global buffer, or adds the RNDIS wrapper
* to a frame in the FrameOUT global before sending the buffer contents to the host. * to a frame in the FrameOUT global before sending the buffer contents to the host.
*/ */
TASK(RNDIS_Task) TASK(RNDIS_Task)

@ -60,7 +60,7 @@ TASK(TCP_Task)
{ {
/* Task to hand off TCP packets to and from the listening applications. */ /* Task to hand off TCP packets to and from the listening applications. */
/* Run each application in sequence, to process incomming and generate outgoing packets */ /* Run each application in sequence, to process incoming and generate outgoing packets */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++) for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{ {
/* Find the corresponding port entry in the port table */ /* Find the corresponding port entry in the port table */
@ -179,7 +179,7 @@ void TCP_Init(void)
*/ */
bool TCP_SetPortState(uint16_t Port, uint8_t State, void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*)) bool TCP_SetPortState(uint16_t Port, uint8_t State, void (*Handler)(TCP_ConnectionState_t*, TCP_ConnectionBuffer_t*))
{ {
/* Note, Port number should be specified in BIG endian to simplfy network code */ /* Note, Port number should be specified in BIG endian to simplify network code */
/* Check to see if the port entry is already in the port state table */ /* Check to see if the port entry is already in the port state table */
for (uint8_t PTableEntry = 0; PTableEntry < MAX_TCP_CONNECTIONS; PTableEntry++) for (uint8_t PTableEntry = 0; PTableEntry < MAX_TCP_CONNECTIONS; PTableEntry++)
@ -226,7 +226,7 @@ bool TCP_SetPortState(uint16_t Port, uint8_t State, void (*Handler)(TCP_Connecti
*/ */
uint8_t TCP_GetPortState(uint16_t Port) uint8_t TCP_GetPortState(uint16_t Port)
{ {
/* Note, Port number should be specified in BIG endian to simplfy network code */ /* Note, Port number should be specified in BIG endian to simplify network code */
for (uint8_t PTableEntry = 0; PTableEntry < MAX_TCP_CONNECTIONS; PTableEntry++) for (uint8_t PTableEntry = 0; PTableEntry < MAX_TCP_CONNECTIONS; PTableEntry++)
{ {
@ -251,7 +251,7 @@ uint8_t TCP_GetPortState(uint16_t Port)
*/ */
bool TCP_SetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort, uint8_t State) bool TCP_SetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort, uint8_t State)
{ {
/* Note, Port number should be specified in BIG endian to simplfy network code */ /* Note, Port number should be specified in BIG endian to simplify network code */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++) for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{ {
@ -291,7 +291,7 @@ bool TCP_SetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t
*/ */
uint8_t TCP_GetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort) uint8_t TCP_GetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort)
{ {
/* Note, Port number should be specified in BIG endian to simplfy network code */ /* Note, Port number should be specified in BIG endian to simplify network code */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++) for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{ {
@ -318,7 +318,7 @@ uint8_t TCP_GetConnectionState(uint16_t Port, IP_Address_t RemoteAddress, uint16
*/ */
TCP_ConnectionInfo_t* TCP_GetConnectionInfo(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort) TCP_ConnectionInfo_t* TCP_GetConnectionInfo(uint16_t Port, IP_Address_t RemoteAddress, uint16_t RemotePort)
{ {
/* Note, Port number should be specified in BIG endian to simplfy network code */ /* Note, Port number should be specified in BIG endian to simplify network code */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++) for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{ {
@ -337,8 +337,8 @@ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(uint16_t Port, IP_Address_t RemoteAd
/** Processes a TCP packet inside an Ethernet frame, and writes the appropriate response /** Processes a TCP packet inside an Ethernet frame, and writes the appropriate response
* to the output Ethernet frame if one is created by a application handler. * to the output Ethernet frame if one is created by a application handler.
* *
* \param IPHeaderInStart Pointer to the start of the incomming packet's IP header * \param IPHeaderInStart Pointer to the start of the incoming packet's IP header
* \param TCPHeaderInStart Pointer to the start of the incomming packet's TCP header * \param TCPHeaderInStart Pointer to the start of the incoming packet's TCP header
* \param TCPHeaderOutStart Pointer to the start of the outgoing packet's TCP header * \param TCPHeaderOutStart Pointer to the start of the outgoing packet's TCP header
* *
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE if no * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE if no
@ -357,7 +357,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void
bool PacketResponse = false; bool PacketResponse = false;
/* Check if the destination port is open and allows incomming connections */ /* Check if the destination port is open and allows incoming connections */
if (TCP_GetPortState(TCPHeaderIN->DestinationPort) == TCP_Port_Open) if (TCP_GetPortState(TCPHeaderIN->DestinationPort) == TCP_Port_Open)
{ {
/* Detect SYN from host to start a connection */ /* Detect SYN from host to start a connection */
@ -375,7 +375,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void
} }
else else
{ {
/* Process the incomming TCP packet based on the current connection state for the sender and port */ /* Process the incoming TCP packet based on the current connection state for the sender and port */
switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort)) switch (TCP_GetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort))
{ {
case TCP_Connection_Listen: case TCP_Connection_Listen:
@ -470,7 +470,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void
} }
else else
{ {
/* Buffer is currently in use by the application, defer processing of the incomming packet */ /* Buffer is currently in use by the application, defer processing of the incoming packet */
return NO_PROCESS; return NO_PROCESS;
} }
} }
@ -591,7 +591,7 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, IP_Address_t SourceAddre
{ {
uint32_t Checksum = 0; uint32_t Checksum = 0;
/* TCP/IP checksums are the addition of the one's compliment of each word including the IP psudo-header, /* TCP/IP checksums are the addition of the one's compliment of each word including the IP pseudo-header,
complimented */ complimented */
Checksum += ((uint16_t*)&SourceAddress)[0]; Checksum += ((uint16_t*)&SourceAddress)[0];

@ -224,7 +224,7 @@
unsigned char Reserved : 4; /**< Reserved, must be all 0 */ unsigned char Reserved : 4; /**< Reserved, must be all 0 */
unsigned char DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */ unsigned char DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */
uint8_t Flags; /**< TCP packet flags */ uint8_t Flags; /**< TCP packet flags */
uint16_t WindowSize; /**< Current data window size (bytes remaning in reception buffer) */ uint16_t WindowSize; /**< Current data window size (bytes remaining in reception buffer) */
uint16_t Checksum; /**< TCP checksum */ uint16_t Checksum; /**< TCP checksum */
uint16_t UrgentPointer; /**< Urgent data pointer */ uint16_t UrgentPointer; /**< Urgent data pointer */

@ -40,8 +40,8 @@
/** Processes a UDP packet inside an Ethernet frame, and writes the appropriate response /** Processes a UDP packet inside an Ethernet frame, and writes the appropriate response
* to the output Ethernet frame if a subprotocol handler has created a response packet. * to the output Ethernet frame if a subprotocol handler has created a response packet.
* *
* \param IPHeaderInStart Pointer to the start of the incomming packet's IP header * \param IPHeaderInStart Pointer to the start of the incoming packet's IP header
* \param UDPHeaderInStart Pointer to the start of the incomming packet's UDP header * \param UDPHeaderInStart Pointer to the start of the incoming packet's UDP header
* \param UDPHeaderOutStart Pointer to the start of the outgoing packet's UDP header * \param UDPHeaderOutStart Pointer to the start of the outgoing packet's UDP header
* *
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise

@ -216,7 +216,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -29,8 +29,8 @@
*/ */
/* Buffer Configuration: */ /* Buffer Configuration: */
/* Buffer length - select static size of created ringbuffers: */ /* Buffer length - select static size of created ring buffers: */
#define BUFF_STATICSIZE 128 // Set to the static ringbuffer size for all ringbuffers (place size after define) #define BUFF_STATICSIZE 128 // Set to the static ring buffer size for all ring buffers (place size after define)
/* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */ /* Volatile mode - uncomment to make buffers volatile, for use in ISRs, etc: */
#define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access #define BUFF_VOLATILE // Uncomment to cause all ring buffers to become volatile (and atomic if multi-byte) in access
@ -40,9 +40,9 @@
// #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full // #define BUFF_DROPNEW // Uncomment to cause full ring buffers to drop the new character when full
// #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user! // #define BUFF_NODROPCHECK // Uncomment to ignore full ring buffer checks - checking left to user!
/* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ringbuffer: */ /* Underflow behaviour - select behaviour when Buffer_GetElement is called with an empty ring buffer: */
//#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ringbuffer is read //#define BUFF_EMPTYRETURNSZERO // Uncomment to return 0 when an empty ring buffer is read
#define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ringbuffers - checking left to user! #define BUFF_NOEMPTYCHECK // Uncomment to disable checking of empty ring buffers - checking left to user!
/* Buffer storage type - set the datatype for the stored data */ /* Buffer storage type - set the datatype for the stored data */
#define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer #define BUFF_DATATYPE uint8_t // Change to the data type that is going to be stored into the buffer

@ -79,7 +79,7 @@ int main(void)
LEDs_Init(); LEDs_Init();
ReconfigureUSART(); ReconfigureUSART();
/* Ringbuffer Initialization */ /* Ring buffer Initialization */
Buffer_Initialize(&Rx_Buffer); Buffer_Initialize(&Rx_Buffer);
Buffer_Initialize(&Tx_Buffer); Buffer_Initialize(&Tx_Buffer);

@ -39,7 +39,7 @@
/* Includes: */ /* Includes: */
#include <avr/io.h> #include <avr/io.h>
#include <avr/wdt.h> #include <avr/wdt.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <avr/power.h> #include <avr/power.h>
#include "Descriptors.h" #include "Descriptors.h"
@ -99,17 +99,17 @@
#define CONTROL_LINE_IN_RING (1 << 3) #define CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has ocurred on the virtual serial port. * to indicate that a framing error has occurred on the virtual serial port.
*/ */
#define CONTROL_LINE_IN_FRAMEERROR (1 << 4) #define CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has ocurred on the virtual serial port. * to indicate that a parity error has occurred on the virtual serial port.
*/ */
#define CONTROL_LINE_IN_PARITYERROR (1 << 5) #define CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has ocurred on the virtual serial port. * to indicate that a data overrun error has occurred on the virtual serial port.
*/ */
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6) #define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
@ -139,7 +139,7 @@
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum * CDCDevice_LineCodingParity_t enum
*/ */
uint8_t DataBits; /**< Bits of data per charater of the virtual serial port */ uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} CDC_Line_Coding_t; } CDC_Line_Coding_t;
/** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a /** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"CDC Host Demo running.\r\n" ESC_INVERSE_OFF)); "CDC Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -196,7 +196,7 @@ TASK(USB_CDC_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));
@ -248,7 +248,7 @@ TASK(USB_CDC_Host)
uint16_t BufferLength = Pipe_BytesInPipe(); uint16_t BufferLength = Pipe_BytesInPipe();
uint8_t Buffer[BufferLength]; uint8_t Buffer[BufferLength];
/* Read in the pipe data to the tempoary buffer */ /* Read in the pipe data to the temporary buffer */
Pipe_Read_Stream_LE(Buffer, BufferLength); Pipe_Read_Stream_LE(Buffer, BufferLength);
/* Clear the pipe after it is read, ready for the next packet */ /* Clear the pipe after it is read, ready for the next packet */

@ -73,7 +73,7 @@
DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */ DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */ InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCDCInterfaceFound = 4, /**< A compatible CDC interface was not found in the device's Configuration Descriptor */ NoCDCInterfaceFound = 4, /**< A compatible CDC interface was not found in the device's Configuration Descriptor */
NoEndpointFound = 5, /**< Cmpatible CDC endpoints were not found in the device's CDC interface */ NoEndpointFound = 5, /**< Compatible CDC endpoints were not found in the device's CDC interface */
}; };
/* Configuration Descriptor Comparison Functions: */ /* Configuration Descriptor Comparison Functions: */

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"Generic HID Host Demo running.\r\n" ESC_INVERSE_OFF)); "Generic HID Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -288,7 +288,7 @@ TASK(USB_HID_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"Keyboard Host Demo running.\r\n" ESC_INVERSE_OFF)); "Keyboard Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -263,7 +263,7 @@ TASK(USB_Keyboard_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));
@ -310,7 +310,7 @@ TASK(USB_Keyboard_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Protocol).\r\n")); puts_P(PSTR("Control Error (Set Protocol).\r\n"));

@ -51,7 +51,7 @@
{ {
ParseSuccessful = 0, /**< HID report descriptor parsed successfully */ ParseSuccessful = 0, /**< HID report descriptor parsed successfully */
ParseError = 1, /**< Failed to fully process the HID report descriptor */ ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occured while trying to read the device HID descriptor */ ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
}; };
/* Type Defines: */ /* Type Defines: */

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"Keyboard Host Demo running.\r\n" ESC_INVERSE_OFF)); "Keyboard Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -199,7 +199,7 @@ TASK(USB_Keyboard_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));
@ -255,7 +255,7 @@ TASK(USB_Keyboard_Host)
break; break;
} }
/* All LEDs off - ready to indicate keypresses */ /* All LEDs off - ready to indicate key presses */
UpdateStatus(Status_USBReady); UpdateStatus(Status_USBReady);
puts_P(PSTR("Keyboard Enumerated.\r\n")); puts_P(PSTR("Keyboard Enumerated.\r\n"));
@ -282,7 +282,7 @@ TASK(USB_Keyboard_Host)
/* Check each HID report item in turn, looking for keyboard scan code reports */ /* Check each HID report item in turn, looking for keyboard scan code reports */
for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++) for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)
{ {
/* Create a tempoary item pointer to the next report item */ /* Create a temporary item pointer to the next report item */
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber]; HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
/* Check if the current report item is a keyboard scancode */ /* Check if the current report item is a keyboard scancode */

@ -74,7 +74,7 @@ int main(void)
/* Indicate USB not ready */ /* Indicate USB not ready */
UpdateStatus(Status_USBNotReady); UpdateStatus(Status_USBNotReady);
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"MassStore Host Demo running.\r\n" ESC_INVERSE_OFF)); "MassStore Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -137,7 +137,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -170,7 +170,7 @@ TASK(USB_MassStore_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));
@ -222,7 +222,7 @@ TASK(USB_MassStore_Host)
break; break;
} }
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = MassStore_GetMaxLUN(&MassStore_MaxLUNIndex)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = MassStore_GetMaxLUN(&MassStore_MaxLUNIndex)) != HOST_SENDCONTROL_Successful)
{ {
ShowDiskReadError(PSTR("Get Max LUN"), ErrorCode); ShowDiskReadError(PSTR("Get Max LUN"), ErrorCode);
@ -240,7 +240,7 @@ TASK(USB_MassStore_Host)
} }
/* Get sense data from the device - many devices will not accept any other commands until the sense data /* Get sense data from the device - many devices will not accept any other commands until the sense data
* is read - both on startup and after a failed command */ * is read - both on start-up and after a failed command */
SCSI_Request_Sense_Response_t SenseData; SCSI_Request_Sense_Response_t SenseData;
if ((ErrorCode = MassStore_RequestSense(0, &SenseData)) != 0) if ((ErrorCode = MassStore_RequestSense(0, &SenseData)) != 0)
{ {
@ -397,7 +397,7 @@ void UpdateStatus(uint8_t CurrentStatus)
LEDs_SetAllLEDs(LEDMask); LEDs_SetAllLEDs(LEDMask);
} }
/** Indicates that a communication error has ocurred with the attached Mass Storage Device, /** Indicates that a communication error has occurred with the attached Mass Storage Device,
* printing error codes to the serial port and waiting until the device is removed before * printing error codes to the serial port and waiting until the device is removed before
* continuing. * continuing.
* *

@ -66,7 +66,7 @@
Status_EnumerationError = 3, /**< Software error while enumerating the attached USB device */ Status_EnumerationError = 3, /**< Software error while enumerating the attached USB device */
Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */ Status_HardwareError = 4, /**< Hardware error while enumerating the attached USB device */
Status_Busy = 5, /**< Busy reading or writing to the attached Mass Storage device */ Status_Busy = 5, /**< Busy reading or writing to the attached Mass Storage device */
Status_SCSICommandError = 6, /**< Error sending or recieving a command to or from the attached SCSI device */ Status_SCSICommandError = 6, /**< Error sending or receiving a command to or from the attached SCSI device */
}; };
/* Task Definitions: */ /* Task Definitions: */

@ -37,8 +37,8 @@
* to a FAT library to give file-level access to an attached device's contents. * to a FAT library to give file-level access to an attached device's contents.
* *
* \note Many Mass Storage devices on the market are non-compliant to the * \note Many Mass Storage devices on the market are non-compliant to the
* specifications and thus can proove difficult to interface with. It * specifications and thus can prove difficult to interface with. It
* may be neccesary to retry the functions in the module several times * may be necessary to retry the functions in the module several times
* after they have returned and error to successfully send the command * after they have returned and error to successfully send the command
* to the device. Some devices may also need to have the stream function * to the device. Some devices may also need to have the stream function
* timeout period extended beyond 100ms (some badly designed devices exceeding * timeout period extended beyond 100ms (some badly designed devices exceeding
@ -52,17 +52,17 @@
/* Globals: */ /* Globals: */
/** Current CBW to send to the device. This is automatically filled by the routines /** Current CBW to send to the device. This is automatically filled by the routines
* in this file and is not externally accessable. * in this file and is not externally accessible.
*/ */
static CommandBlockWrapper_t SCSICommandBlock; static CommandBlockWrapper_t SCSICommandBlock;
/** Current CSW received from the device. This is automatically filled by the routines /** Current CSW received from the device. This is automatically filled by the routines
* in this file and is externally accessable so that the return codes may be checked. * in this file and is externally accessible so that the return codes may be checked.
*/ */
CommandStatusWrapper_t SCSICommandStatus; CommandStatusWrapper_t SCSICommandStatus;
/** Current Tag value used in issued CBWs to the device. This is automatically incremented /** Current Tag value used in issued CBWs to the device. This is automatically incremented
* by the routines in this file, and is not externally accessable. * by the routines in this file, and is not externally accessible.
*/ */
static uint32_t MassStore_Tag = 1; static uint32_t MassStore_Tag = 1;
@ -122,7 +122,7 @@ static uint8_t MassStore_WaitForDataReceived(void)
/* Check to see if a new frame has been issued (1ms elapsed) */ /* Check to see if a new frame has been issued (1ms elapsed) */
if (USB_INT_HasOccurred(USB_INT_HSOFI)) if (USB_INT_HasOccurred(USB_INT_HSOFI))
{ {
/* Clear the flag and decrement the timout period counter */ /* Clear the flag and decrement the timeout period counter */
USB_INT_Clear(USB_INT_HSOFI); USB_INT_Clear(USB_INT_HSOFI);
TimeoutMSRem--; TimeoutMSRem--;

@ -54,7 +54,7 @@
/** Command Block Wrapper signature byte, for verification of valid CBW blocks */ /** Command Block Wrapper signature byte, for verification of valid CBW blocks */
#define CBW_SIGNATURE 0x43425355UL #define CBW_SIGNATURE 0x43425355UL
/** Command Statuc Wrapper signature byte, for verification of valid CSW blocks */ /** Command Static Wrapper signature byte, for verification of valid CSW blocks */
#define CSW_SIGNATURE 0x53425355UL #define CSW_SIGNATURE 0x53425355UL
/** Data direction mask for the Flags field of a CBW, indicating Host-to-Device transfer direction */ /** Data direction mask for the Flags field of a CBW, indicating Host-to-Device transfer direction */
@ -98,13 +98,13 @@
{ {
uint32_t Signature; /**< Command status signature, always equal to CSW_SIGNATURE */ uint32_t Signature; /**< Command status signature, always equal to CSW_SIGNATURE */
uint32_t Tag; /**< Current CBW tag, to positively associate a CBW with a CSW */ uint32_t Tag; /**< Current CBW tag, to positively associate a CBW with a CSW */
uint32_t DataTransferResidue; /**< Length of data not transfered */ uint32_t DataTransferResidue; /**< Length of data not transferred */
uint8_t Status; /**< Command status, a value from the MassStorageHost_CommandStatusCodes_t enum */ uint8_t Status; /**< Command status, a value from the MassStorageHost_CommandStatusCodes_t enum */
} CommandStatusWrapper_t; } CommandStatusWrapper_t;
/** Type define for a SCSI Sense structure. Structures of this type are filled out by the /** Type define for a SCSI Sense structure. Structures of this type are filled out by the
* device via the MassStore_RequestSense() function, indicating the current sense data of the * device via the MassStore_RequestSense() function, indicating the current sense data of the
* device (giving explitic error codes for the last issued command). For details of the * device (giving explicit error codes for the last issued command). For details of the
* structure contents, refer to the SCSI specifications. * structure contents, refer to the SCSI specifications.
*/ */
typedef struct typedef struct

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"Mouse Host Demo running.\r\n" ESC_INVERSE_OFF)); "Mouse Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -259,7 +259,7 @@ TASK(USB_Mouse_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));
@ -306,7 +306,7 @@ TASK(USB_Mouse_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Protocol).\r\n")); puts_P(PSTR("Control Error (Set Protocol).\r\n"));

@ -60,7 +60,7 @@
{ {
ParseSuccessful = 0, /**< HID report descriptor parsed successfully */ ParseSuccessful = 0, /**< HID report descriptor parsed successfully */
ParseError = 1, /**< Failed to fully process the HID report descriptor */ ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occured while trying to read the device HID descriptor */ ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
}; };
/* Type Defines: */ /* Type Defines: */

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"Mouse Host Demo running.\r\n" ESC_INVERSE_OFF)); "Mouse Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -200,7 +200,7 @@ TASK(USB_Mouse_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control Error (Set Configuration).\r\n")); puts_P(PSTR("Control Error (Set Configuration).\r\n"));
@ -256,7 +256,7 @@ TASK(USB_Mouse_Host)
break; break;
} }
/* All LEDs off - ready to indicate keypresses */ /* All LEDs off - ready to indicate key presses */
UpdateStatus(Status_USBReady); UpdateStatus(Status_USBReady);
puts_P(PSTR("Mouse Enumerated.\r\n")); puts_P(PSTR("Mouse Enumerated.\r\n"));
@ -285,7 +285,7 @@ TASK(USB_Mouse_Host)
/* Check each HID report item in turn, looking for mouse X/Y/button reports */ /* Check each HID report item in turn, looking for mouse X/Y/button reports */
for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++) for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)
{ {
/* Create a tempoary item pointer to the next report item */ /* Create a temporary item pointer to the next report item */
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber]; HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
bool FoundData; bool FoundData;

@ -111,7 +111,7 @@ uint8_t SImage_RecieveBlockHeader(void)
/* Check to see if a new frame has been issued (1ms elapsed) */ /* Check to see if a new frame has been issued (1ms elapsed) */
if (USB_INT_HasOccurred(USB_INT_HSOFI)) if (USB_INT_HasOccurred(USB_INT_HSOFI))
{ {
/* Clear the flag and decrement the timout period counter */ /* Clear the flag and decrement the timeout period counter */
USB_INT_Clear(USB_INT_HSOFI); USB_INT_Clear(USB_INT_HSOFI);
TimeoutMSRem--; TimeoutMSRem--;

@ -62,7 +62,7 @@
(params * sizeof(PIMA_SendBlock.Params[0]))) (params * sizeof(PIMA_SendBlock.Params[0])))
/* Type Defines: */ /* Type Defines: */
/** Type define for a PIMA container, use to send commands and receieve responses to and from an /** Type define for a PIMA container, use to send commands and receive responses to and from an
* attached Still Image device. * attached Still Image device.
*/ */
typedef struct typedef struct

@ -75,7 +75,7 @@ int main(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
/* Startup message */ /* Start-up message */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"Still Image Host Demo running.\r\n" ESC_INVERSE_OFF)); "Still Image Host Demo running.\r\n" ESC_INVERSE_OFF));
@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError)
for(;;); for(;;);
} }
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device. * enumerating an attached USB device.
*/ */
EVENT_HANDLER(USB_DeviceEnumerationFailed) EVENT_HANDLER(USB_DeviceEnumerationFailed)
@ -165,7 +165,7 @@ TASK(USB_SImage_Host)
wLength: 0, wLength: 0,
}; };
/* Send the request, display error and wait for device detatch if request fails */ /* Send the request, display error and wait for device detach if request fails */
if (USB_Host_SendControlRequest(NULL) != HOST_SENDCONTROL_Successful) if (USB_Host_SendControlRequest(NULL) != HOST_SENDCONTROL_Successful)
{ {
puts_P(PSTR("Control error.\r\n")); puts_P(PSTR("Control error.\r\n"));
@ -223,7 +223,7 @@ TASK(USB_SImage_Host)
/* Send the GETDEVICEINFO block */ /* Send the GETDEVICEINFO block */
SImage_SendBlockHeader(); SImage_SendBlockHeader();
/* Recieve the response data block */ /* Receive the response data block */
if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError)
{ {
ShowCommandError(ErrorCode, false); ShowCommandError(ErrorCode, false);
@ -274,7 +274,7 @@ TASK(USB_SImage_Host)
UnicodeToASCII(DeviceInfoPos, DeviceVersion); UnicodeToASCII(DeviceInfoPos, DeviceVersion);
printf_P(PSTR(" Device Version: %s\r\n"), DeviceVersion); printf_P(PSTR(" Device Version: %s\r\n"), DeviceVersion);
/* Recieve the final response block from the device */ /* Receive the final response block from the device */
if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError)
{ {
ShowCommandError(ErrorCode, false); ShowCommandError(ErrorCode, false);
@ -302,7 +302,7 @@ TASK(USB_SImage_Host)
/* Send the OPENSESSION block, open a session with an ID of 0x0001 */ /* Send the OPENSESSION block, open a session with an ID of 0x0001 */
SImage_SendBlockHeader(); SImage_SendBlockHeader();
/* Recieve the response block from the device */ /* Receive the response block from the device */
if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError)
{ {
ShowCommandError(ErrorCode, false); ShowCommandError(ErrorCode, false);
@ -330,7 +330,7 @@ TASK(USB_SImage_Host)
/* Send the CLOSESESSION block, close the session with an ID of 0x0001 */ /* Send the CLOSESESSION block, close the session with an ID of 0x0001 */
SImage_SendBlockHeader(); SImage_SendBlockHeader();
/* Recieve the response block from the device */ /* Receive the response block from the device */
if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError) if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_ERROR_NoError)
{ {
ShowCommandError(ErrorCode, false); ShowCommandError(ErrorCode, false);

@ -140,7 +140,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -80,7 +80,7 @@ int main(void)
/* Turn on interrupts */ /* Turn on interrupts */
sei(); sei();
/* Startup message via USART */ /* Start-up message via USART */
puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY
"LUFA Demo running.\r\n" ESC_INVERSE_OFF)); "LUFA Demo running.\r\n" ESC_INVERSE_OFF));
@ -130,7 +130,7 @@ TASK(TestApp_CheckJoystick)
*/ */
TASK(TestApp_CheckTemp) TASK(TestApp_CheckTemp)
{ {
static SchedulerDelayCounter_t DelayCounter = 10000; // Force immediate run on startup static SchedulerDelayCounter_t DelayCounter = 10000; // Force immediate run on start-up
/* Task runs every 10000 ticks, 10 seconds for this demo */ /* Task runs every 10000 ticks, 10 seconds for this demo */
if (Scheduler_HasDelayElapsed(10000, &DelayCounter)) if (Scheduler_HasDelayElapsed(10000, &DelayCounter))
@ -161,7 +161,7 @@ TASK(TestApp_CheckHWB)
/* Set flag, indicating that current pressed state has been handled */ /* Set flag, indicating that current pressed state has been handled */
IsPressed = true; IsPressed = true;
/* First start of the USB interface permenantly blocks the joystick task */ /* First start of the USB interface permanently blocks the joystick task */
if (BlockingJoystickTask == false) if (BlockingJoystickTask == false)
{ {
Scheduler_SetTaskMode(TestApp_CheckJoystick, TASK_STOP); Scheduler_SetTaskMode(TestApp_CheckJoystick, TASK_STOP);

@ -13,6 +13,7 @@
* - KeyboardHost, MouseHost and GenericHIDHost demos now save and restore the currently selected pipe inside the pipe ISR * - KeyboardHost, MouseHost and GenericHIDHost demos now save and restore the currently selected pipe inside the pipe ISR
* - Changed GenericHID device demo to use the LUFA scheduler, added INTERRUPT_DATA_ENDPOINT and INTERRUPT_CONTROL_ENDPOINT compile * - Changed GenericHID device demo to use the LUFA scheduler, added INTERRUPT_DATA_ENDPOINT and INTERRUPT_CONTROL_ENDPOINT compile
* time options * time options
* - All comments in the library, bootloaders, demos and projects have now been spell-checked and spelling mistakes/typos corrected
* *
* \section Sec_ChangeLog090401 Version 090401 * \section Sec_ChangeLog090401 Version 090401
* *

@ -31,7 +31,7 @@
/** \file /** \file
* *
* This file contains macros which are common to all library elements, and which may be useful in user code. It * This file contains macros which are common to all library elements, and which may be useful in user code. It
* also includes other common headees, such as Atomic.h, FunctionAttributes.h and BoardTypes.h. * also includes other common headers, such as Atomic.h, FunctionAttributes.h and BoardTypes.h.
*/ */
#ifndef __COMMON_H__ #ifndef __COMMON_H__
@ -49,27 +49,27 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* Macros: */
/** Macro for encasing other multi-statment macros. This should be used along with an opening brace /** Macro for encasing other multi-statement macros. This should be used along with an opening brace
* before the start of any multi-statement macro, so that the macros contents as a whole are treated * before the start of any multi-statement macro, so that the macros contents as a whole are treated
* as a discreete block and not as a list of seperate statements which may cause problems when used as * as a discrete block and not as a list of separate statements which may cause problems when used as
* a block (such as inline IF statments). * a block (such as inline IF statements).
*/ */
#define MACROS do #define MACROS do
/** Macro for encasing other multi-statment macros. This should be used along with a preceeding closing /** Macro for encasing other multi-statement macros. This should be used along with a preceding closing
* brace at the end of any multi-statement macro, so that the macros contents as a whole are treated * brace at the end of any multi-statement macro, so that the macros contents as a whole are treated
* as a discreete block and not as a list of seperate statements which may cause problems when used as * as a discrete block and not as a list of separate statements which may cause problems when used as
* a block (such as inline IF statments). * a block (such as inline IF statements).
*/ */
#define MACROE while (0) #define MACROE while (0)
/** Defines a volatile NOP statment which cannot be optimized out by the compiler, and thus can always /** Defines a volatile NOP statement which cannot be optimized out by the compiler, and thus can always
* be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer * be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer
* removes/reorders code to the point where break points cannot reliably be set. * removes/reorders code to the point where break points cannot reliably be set.
*/ */
#define JTAG_DEBUG_POINT() asm volatile ("NOP" ::) #define JTAG_DEBUG_POINT() asm volatile ("NOP" ::)
/** Defines an explicit JTAG break point in the resulting binary via the ASM BREAK statment. When /** Defines an explicit JTAG break point in the resulting binary via the ASM BREAK statement. When
* a JTAG is used, this causes the program execution to halt when reached until manually resumed. */ * a JTAG is used, this causes the program execution to halt when reached until manually resumed. */
#define JTAG_DEBUG_BREAK() asm volatile ("BREAK" ::) #define JTAG_DEBUG_BREAK() asm volatile ("BREAK" ::)

@ -32,7 +32,7 @@
* *
* This file contains macros for applying GCC specific attributes to functions to control various optimizer * This file contains macros for applying GCC specific attributes to functions to control various optimizer
* and code generation features of the compiler. Attributes may be placed in the function prototype in any * and code generation features of the compiler. Attributes may be placed in the function prototype in any
* order, and multiple attributes can be specified for a single function via a space seperated list. * order, and multiple attributes can be specified for a single function via a space separated list.
* *
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
* functionality. * functionality.
@ -49,11 +49,11 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* Macros: */
/** Indicates to the compiler that the function can not ever return, so that any stack restoring or /** Indicates to the compiler that the function can not ever return, so that any stack restoring or
* return code may be ommited by the compiler in the resulting binary. * return code may be omitted by the compiler in the resulting binary.
*/ */
#define ATTR_NO_RETURN __attribute__ ((noreturn)) #define ATTR_NO_RETURN __attribute__ ((noreturn))
/** Places the function in one of the initilization sections, which execute before the main function /** Places the function in one of the initialization sections, which execute before the main function
* of the application. The init function number can be specified as "x", as an integer. Refer to the * of the application. The init function number can be specified as "x", as an integer. Refer to the
* avr-libc manual for more information on the initialization sections. * avr-libc manual for more information on the initialization sections.
*/ */
@ -65,12 +65,12 @@
#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
/** Indicates that the specified parameters of the function are pointers which should never be NULL. /** Indicates that the specified parameters of the function are pointers which should never be NULL.
* When applied as a 1-based comma seperated list the compiler will emmit a warning if the specified * When applied as a 1-based comma separated list the compiler will emit a warning if the specified
* parameters are known at compiler time to be NULL at the point of calling the function. * parameters are known at compiler time to be NULL at the point of calling the function.
*/ */
#define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__))) #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))
/** Removes any preample or postample from the function. When used, the function will not have any /** Removes any preamble or postamble from the function. When used, the function will not have any
* register or stack saving code. This should be used with caution, and when used the programmer * register or stack saving code. This should be used with caution, and when used the programmer
* is responsible for maintaining stack and register integrity. * is responsible for maintaining stack and register integrity.
*/ */

@ -81,7 +81,7 @@
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
static inline void Joystick_Init(void) static inline void Joystick_Init(void)
{ {
// TODO: Initialize joystick port pins as inputs with pullups // TODO: Initialize joystick port pins as inputs with pull-ups
}; };
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;

@ -68,7 +68,7 @@
#error The selected board does not contain a HWB. #error The selected board does not contain a HWB.
#endif #endif
/* Psudo-Functions for Doxygen: */ /* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Initializes the HWB driver, so that the current button position can be read. This sets the appropriate /** Initializes the HWB driver, so that the current button position can be read. This sets the appropriate
* I/O pin to an input with pull-up enabled. * I/O pin to an input with pull-up enabled.

@ -66,7 +66,7 @@
#error The selected board does not contain a joystick. #error The selected board does not contain a joystick.
#endif #endif
/* Psudo-Functions for Doxygen: */ /* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Initializes the joystick driver so that the joystick position can be read. This sets the appropriate /** Initializes the joystick driver so that the joystick position can be read. This sets the appropriate
* I/O pins to inputs with their pull-ups enabled. * I/O pins to inputs with their pull-ups enabled.

@ -68,7 +68,7 @@
#include "Board/LEDs.h" #include "Board/LEDs.h"
#endif #endif
/* Psudo-Functions for Doxygen: */ /* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Initializes the board LED driver so that the LEDs can be controlled. This sets the appropriate port /** Initializes the board LED driver so that the LEDs can be controlled. This sets the appropriate port
* I/O pins as outputs, and sets the LEDs to default to off. * I/O pins as outputs, and sets the LEDs to default to off.

@ -72,16 +72,16 @@
/** Initializes the temperature sensor driver, including setting up the appropriate ADC channel. /** Initializes the temperature sensor driver, including setting up the appropriate ADC channel.
* This must be called before any other temperature sensor routines. * This must be called before any other temperature sensor routines.
* *
* The ADC itself (not the ADC channel) must be configured seperately before calling the temperature * The ADC itself (not the ADC channel) must be configured separately before calling the temperature
* sensor functions. * sensor functions.
*/ */
#define Temperature_Init() ADC_SetupChannel(TEMP_ADC_CHANNEL); #define Temperature_Init() ADC_SetupChannel(TEMP_ADC_CHANNEL);
/* Function Prototypes: */ /* Function Prototypes: */
/** Performs a complete ADC on the temperature sensor channel, and converts the result into a /** Performs a complete ADC on the temperature sensor channel, and converts the result into a
* valid temperature between TEMP_MIN_TEMP and TEMP_MAX_TEMP in degrees Celcius. * valid temperature between TEMP_MIN_TEMP and TEMP_MAX_TEMP in degrees Celsius.
* *
* \return Signed temperature in degrees Celcius * \return Signed temperature in degrees Celsius
*/ */
int8_t Temperature_GetTemperature(void) ATTR_WARN_UNUSED_RESULT; int8_t Temperature_GetTemperature(void) ATTR_WARN_UNUSED_RESULT;

@ -97,13 +97,13 @@
#define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).bLength #define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).bLength
#endif #endif
/** Creates a prototype for or begins a descriptor comparitor routine. Descriptor comparitor routines are /** Creates a prototype for or begins a descriptor comparator routine. Descriptor comparator routines are
* small search routines which are passed a pointer to the current sub descriptor in the configuration * small search routines which are passed a pointer to the current sub descriptor in the configuration
* descriptor, and which analyse the sub descriptor to determine whether or not it matches the routine's * descriptor, and which analyse the sub descriptor to determine whether or not it matches the routine's
* search parameters. Comparitor routines provide a powerful way to scan through the config descriptor * search parameters. Comparator routines provide a powerful way to scan through the config descriptor
* for certain descriptors matching unique criteria. * for certain descriptors matching unique criteria.
* *
* Comparitor routines are passed in a single pointer named CurrentDescriptor, and should return a value * Comparator routines are passed in a single pointer named CurrentDescriptor, and should return a value
* of a member of the DSEARCH_Return_ErrorCodes_t enum. * of a member of the DSEARCH_Return_ErrorCodes_t enum.
*/ */
#define DESCRIPTOR_COMPARATOR(name) uint8_t DCOMP_##name (void* const CurrentDescriptor) #define DESCRIPTOR_COMPARATOR(name) uint8_t DCOMP_##name (void* const CurrentDescriptor)
@ -117,7 +117,7 @@
* *
* \param DSize Pointer to an int storing the remaining bytes in the configuration descriptor * \param DSize Pointer to an int storing the remaining bytes in the configuration descriptor
* \param DPos Pointer to the current position in the configuration descriptor * \param DPos Pointer to the current position in the configuration descriptor
* \param DSearch Name of the comparitor search function to use on the configuration descriptor * \param DSearch Name of the comparator search function to use on the configuration descriptor
* *
* \return Value of one of the members of the DSEARCH_Comp_Return_ErrorCodes_t enum * \return Value of one of the members of the DSEARCH_Comp_Return_ErrorCodes_t enum
* *
@ -156,7 +156,7 @@
/** Enum for return values of USB_Host_GetNextDescriptorComp() */ /** Enum for return values of USB_Host_GetNextDescriptorComp() */
enum DSEARCH_Comp_Return_ErrorCodes_t enum DSEARCH_Comp_Return_ErrorCodes_t
{ {
Descriptor_Search_Comp_Found = 0, /**< Configuration descriptor now points to decriptor which matches Descriptor_Search_Comp_Found = 0, /**< Configuration descriptor now points to descriptor which matches
* search criteria of the given comparator function. */ * search criteria of the given comparator function. */
Descriptor_Search_Comp_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */ Descriptor_Search_Comp_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */
Descriptor_Search_Comp_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */ Descriptor_Search_Comp_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */

@ -220,7 +220,7 @@
bool GetReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const ReportItem) bool GetReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const ReportItem)
ATTR_NON_NULL_PTR_ARG(1, 2); ATTR_NON_NULL_PTR_ARG(1, 2);
/** Retreives the given report item's value out of the Value member of the report item's /** Retrieves the given report item's value out of the Value member of the report item's
* HID_ReportItem_t structure and places it into the correct position in the HID report * HID_ReportItem_t structure and places it into the correct position in the HID report
* buffer. The report buffer is assumed to have the appropriate bits cleared before calling * buffer. The report buffer is assumed to have the appropriate bits cleared before calling
* this function (i.e., the buffer should be explicitly cleared before report values are added). * this function (i.e., the buffer should be explicitly cleared before report values are added).

@ -84,7 +84,7 @@
/** HID_ReportItem_t.ItemFlags flag for buffered bytes. */ /** HID_ReportItem_t.ItemFlags flag for buffered bytes. */
#define IOF_BUFFEREDBYTES (1 << 8) #define IOF_BUFFEREDBYTES (1 << 8)
/** HID_ReportItem_t.ItemFlags flag for bitfield data. */ /** HID_ReportItem_t.ItemFlags flag for bit field data. */
#define IOF_BITFIELD (0 << 8) #define IOF_BITFIELD (0 << 8)
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */

@ -58,7 +58,7 @@
/* Macros: */ /* Macros: */
/** Raises a given event name, with the specified parameters. For events with no parameters the /** Raises a given event name, with the specified parameters. For events with no parameters the
* only argument to the macro is the event name, events with parameters list the parameter values * only argument to the macro is the event name, events with parameters list the parameter values
* after the name as a comma seperated list. * after the name as a comma separated list.
* *
* When a given event is fired, its corresponding event handler code is executed. * When a given event is fired, its corresponding event handler code is executed.
* *
@ -75,7 +75,7 @@
*/ */
#define RAISE_EVENT(e, ...) Event_ ## e (__VA_ARGS__) #define RAISE_EVENT(e, ...) Event_ ## e (__VA_ARGS__)
/** Indicates that a given module can raise a given event. This is the equivelent of putting the /** Indicates that a given module can raise a given event. This is the equivalent of putting the
* event function's prototype into the module, but in a cleaner way. Each event which may be * event function's prototype into the module, but in a cleaner way. Each event which may be
* fired via the RAISE_EVENT macro in the module should have an accompanying RAISES_EVENT * fired via the RAISE_EVENT macro in the module should have an accompanying RAISES_EVENT
* prototype in the module's header file. * prototype in the module's header file.
@ -100,7 +100,7 @@
* *
* Only one event handler may be defined in any user project for each individual event. Events may * Only one event handler may be defined in any user project for each individual event. Events may
* or may not have parameters - for each event, refer to its documentation elsewhere in this module * or may not have parameters - for each event, refer to its documentation elsewhere in this module
* to determine the presense and purpose of any event parameters. * to determine the presence and purpose of any event parameters.
* *
* Usage Example: * Usage Example:
* \code * \code
@ -115,7 +115,7 @@
*/ */
#define EVENT_HANDLER(e) void Event_ ## e e ## _P #define EVENT_HANDLER(e) void Event_ ## e e ## _P
/** Indicates that a given module handles an event. This is the equivelent of putting the /** Indicates that a given module handles an event. This is the equivalent of putting the
* event function's prototype into the module, but in a cleaner way. Each event which may be * event function's prototype into the module, but in a cleaner way. Each event which may be
* handled via the EVENT_HANDLER macro in the module should have an accompanying HANDLES_EVENT * handled via the EVENT_HANDLER macro in the module should have an accompanying HANDLES_EVENT
* prototype in the module's header file. * prototype in the module's header file.
@ -136,7 +136,7 @@
*/ */
#define HANDLES_EVENT(e) EVENT_HANDLER(e) #define HANDLES_EVENT(e) EVENT_HANDLER(e)
/* Psudo-Functions for Doxygen: */ /* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from /** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from
* high to low or vice-versa. * high to low or vice-versa.
@ -165,7 +165,7 @@
* has been attached (but not yet fully enumerated), or when in device mode and the device is connected * has been attached (but not yet fully enumerated), or when in device mode and the device is connected
* to a host, beginning the enumeration process. * to a host, beginning the enumeration process.
* *
* When in device mode, this can be used to progmatically start the USB management task to reduce * When in device mode, this can be used to programmatically start the USB management task to reduce
* CPU usage. * CPU usage.
* *
* \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.
@ -183,7 +183,7 @@
* attached and enumerated device has been disconnected, or when in device mode and the device is * attached and enumerated device has been disconnected, or when in device mode and the device is
* disconnected from the host. * disconnected from the host.
* *
* When in device mode, this can be used to progmatically stop the USB management task to reduce * When in device mode, this can be used to programmatically stop the USB management task to reduce
* CPU usage. * CPU usage.
* *
* \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller. * \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.
@ -231,7 +231,7 @@
/** Event for USB device attachment. This event fires when a the USB interface is in host mode, and /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and
* a USB device has been connected to the USB interface. This is interrupt driven, thus fires before * a USB device has been connected to the USB interface. This is interrupt driven, thus fires before
* the standard USB_DeviceConnect event and so can be used to programatically start the USB management * the standard USB_DeviceConnect event and so can be used to programmatically start the USB management
* task to reduce CPU consumption. * task to reduce CPU consumption.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
@ -245,7 +245,7 @@
/** Event for USB device removal. This event fires when a the USB interface is in host mode, and /** Event for USB device removal. This event fires when a the USB interface is in host mode, and
* a USB device has been removed the USB interface whether or not it has been enumerated. This * a USB device has been removed the USB interface whether or not it has been enumerated. This
* can be used to programatically stop the USB management task to reduce CPU consumption. * can be used to programmatically stop the USB management task to reduce CPU consumption.
* *
* \note This event only exists on USB AVR models which supports host mode. * \note This event only exists on USB AVR models which supports host mode.
* *

@ -31,7 +31,7 @@
/** \file /** \file
* *
* Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains * Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains
* strucutures and macros for the easy creation of standard USB descriptors in USB device projects. * structures and macros for the easy creation of standard USB descriptors in USB device projects.
* *
* All standard descriptors have their elements named in an identical manner to the official USB specification, * All standard descriptors have their elements named in an identical manner to the official USB specification,
* however slightly more verbose alternate (non-standard) names are also supplied if the macro * however slightly more verbose alternate (non-standard) names are also supplied if the macro
@ -245,7 +245,7 @@
uint16_t ReleaseNumber; /**< Product release (version) number. */ uint16_t ReleaseNumber; /**< Product release (version) number. */
uint8_t ManufacturerStrIndex; /**< String index for the manufacturer's name. The uint8_t ManufacturerStrIndex; /**< String index for the manufacturer's name. The
* host will request this string via a seperate * host will request this string via a separate
* control request for the string descriptor. * control request for the string descriptor.
* *
* \note If no string supplied, use NO_DESCRIPTOR. * \note If no string supplied, use NO_DESCRIPTOR.
@ -255,7 +255,7 @@
* \see ManufacturerStrIndex structure entry. * \see ManufacturerStrIndex structure entry.
*/ */
uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal
* serial number, in uppercase Unicoded ASCII. * serial number, in uppercase Unicode ASCII.
* *
* \see ManufacturerStrIndex structure entry. * \see ManufacturerStrIndex structure entry.
*/ */
@ -363,7 +363,7 @@
/** Type define for a standard interface association descriptor. /** Type define for a standard interface association descriptor.
* *
* This descriptor has been added as a suppliment to the USB2.0 standard, in the ECN located at * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at
* <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows compound
* devices with multiple interfaces related to the same function to have the multiple interfaces bound * devices with multiple interfaces related to the same function to have the multiple interfaces bound
* together at the point of enumeration, loading one generic driver for all the interfaces in the single * together at the point of enumeration, loading one generic driver for all the interfaces in the single
@ -425,7 +425,7 @@
* maximum packet size that the endpoint can receive at a time. * maximum packet size that the endpoint can receive at a time.
*/ */
uint8_t PollingIntervalMS; /**< Polling interval in milliseconds for the endpont uint8_t PollingIntervalMS; /**< Polling interval in milliseconds for the endpoint
* if it is an INTERRUPT or ISOCHRONOUS type. * if it is an INTERRUPT or ISOCHRONOUS type.
*/ */
#else #else

@ -79,7 +79,7 @@
#define USB_INT_IsEnabled(int) ((USB_INT_GET_EN_REG(int) & USB_INT_GET_EN_MASK(int)) ? true : false) #define USB_INT_IsEnabled(int) ((USB_INT_GET_EN_REG(int) & USB_INT_GET_EN_MASK(int)) ? true : false)
/** Returns boolean true if the given interrupt flag is set (i.e. the condition for the interrupt has occurred, /** Returns boolean true if the given interrupt flag is set (i.e. the condition for the interrupt has occurred,
* but the interrupt vector is not neccesarily enabled), otherwise returns false. * but the interrupt vector is not necessarily enabled), otherwise returns false.
*/ */
#define USB_INT_HasOccurred(int) ((USB_INT_GET_INT_REG(int) & USB_INT_GET_INT_MASK(int)) ? true : false) #define USB_INT_HasOccurred(int) ((USB_INT_GET_INT_REG(int) & USB_INT_GET_INT_MASK(int)) ? true : false)

@ -76,7 +76,7 @@
*/ */
extern volatile bool USB_IsConnected; extern volatile bool USB_IsConnected;
/** Indicates if the USB interface is currently initialized but not neccesarily connected to a host /** Indicates if the USB interface is currently initialized but not necessarily connected to a host
* or device (i.e. if USB_Init() has been run). If this is false, all other library globals are invalid. * or device (i.e. if USB_Init() has been run). If this is false, all other library globals are invalid.
* *
* \note This variable should be treated as read-only in the user application, and never manually * \note This variable should be treated as read-only in the user application, and never manually
@ -166,10 +166,10 @@
* The USB task must be serviced within 50mS in all modes, when needed. The task may be serviced * The USB task must be serviced within 50mS in all modes, when needed. The task may be serviced
* at all times, or (for minimum CPU consumption): * at all times, or (for minimum CPU consumption):
* *
* - In device mode, it may be disabled at startup, enabled on the firing of the USB_Connect event * - In device mode, it may be disabled at start-up, enabled on the firing of the USB_Connect event
* and disabled again on the firing of the USB_Disconnect event. * and disabled again on the firing of the USB_Disconnect event.
* *
* - In host mode, it may be disabled at startup, enabled on the firing of the USB_DeviceAttached * - In host mode, it may be disabled at start-up, enabled on the firing of the USB_DeviceAttached
* event and disabled again on the firing of the USB_DeviceUnattached event. * event and disabled again on the firing of the USB_DeviceUnattached event.
* *
* \see Events.h for more information on the USB events. * \see Events.h for more information on the USB events.

@ -94,7 +94,7 @@
/** Indicates if the device is currently suspended by the host. While suspended, the device is /** Indicates if the device is currently suspended by the host. While suspended, the device is
* to enter a low power state until resumed by the host. While suspended no USB traffic to or * to enter a low power state until resumed by the host. While suspended no USB traffic to or
* from the device can ocurr (except for Remote Wakeup requests). * from the device can occur (except for Remote Wakeup requests).
* *
* This macro returns true if the USB communications have been suspended by the host, false * This macro returns true if the USB communications have been suspended by the host, false
* otherwise. * otherwise.

@ -32,7 +32,7 @@
* *
* Functions, macros and enums related to endpoint management when in USB Device mode. This * Functions, macros and enums related to endpoint management when in USB Device mode. This
* module contains the endpoint management macros, as well as endpoint interrupt and data * module contains the endpoint management macros, as well as endpoint interrupt and data
* send/recieve functions for various datatypes. * send/recieve functions for various data types.
*/ */
#ifndef __ENDPOINT_H__ #ifndef __ENDPOINT_H__
@ -210,7 +210,7 @@
/** Returns true if the currently selected endpoint may be read from (if data is waiting in the endpoint /** Returns true if the currently selected endpoint may be read from (if data is waiting in the endpoint
* bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an * bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an
* IN direction). This function will return false if an error has occured in the endpoint, or if * IN direction). This function will return false if an error has occurred in the endpoint, or if
* the endpoint is an OUT direction and no packet has been received, or if the endpoint is an IN * the endpoint is an OUT direction and no packet has been received, or if the endpoint is an IN
* direction and the endpoint bank is full. * direction and the endpoint bank is full.
*/ */
@ -262,10 +262,10 @@
*/ */
#define Endpoint_ClearSetupOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE #define Endpoint_ClearSetupOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE
/** Stalls the current endpoint, indicating to the host that a logical problem occured with the /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the
* indicated endpoint and that the current transfer sequence should be aborted. This provides a * indicated endpoint and that the current transfer sequence should be aborted. This provides a
* way for devices to indicate invalid commands to the host so that the current transfer can be * way for devices to indicate invalid commands to the host so that the current transfer can be
* aborted and the host can begin its own recovery seqeuence. * aborted and the host can begin its own recovery sequence.
* *
* The currently selected endpoint remains stalled until either the Endpoint_ClearStall() macro * The currently selected endpoint remains stalled until either the Endpoint_ClearStall() macro
* is called, or the host issues a CLEAR FEATURE request to the device for the currently selected * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected
@ -276,7 +276,7 @@
/** Clears the stall on the currently selected endpoint. */ /** Clears the stall on the currently selected endpoint. */
#define Endpoint_ClearStall() MACROS{ UECONX |= (1 << STALLRQC); }MACROE #define Endpoint_ClearStall() MACROS{ UECONX |= (1 << STALLRQC); }MACROE
/** Returns true if the currently selected endpoint is stalled, false othewise. */ /** Returns true if the currently selected endpoint is stalled, false otherwise. */
#define Endpoint_IsStalled() ((UECONX & (1 << STALLRQ)) ? true : false) #define Endpoint_IsStalled() ((UECONX & (1 << STALLRQ)) ? true : false)
/** Resets the data toggle of the currently selected endpoint. */ /** Resets the data toggle of the currently selected endpoint. */
@ -552,12 +552,12 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \note This routine should not be used on CONTROL type endpoints. * \note This routine should not be used on CONTROL type endpoints.
* *
* \param Length Number of bytes to send via the currently selected endpoint. * \param Length Number of bytes to send via the currently selected endpoint.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -576,13 +576,13 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \note This routine should not be used on CONTROL type endpoints. * \note This routine should not be used on CONTROL type endpoints.
* *
* \param Buffer Pointer to the source data buffer to read from. * \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected endpoint into the buffer. * \param Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -601,13 +601,13 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \note This routine should not be used on CONTROL type endpoints. * \note This routine should not be used on CONTROL type endpoints.
* *
* \param Buffer Pointer to the source data buffer to read from. * \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected endpoint into the buffer. * \param Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -626,13 +626,13 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \note This routine should not be used on CONTROL type endpoints. * \note This routine should not be used on CONTROL type endpoints.
* *
* \param Buffer Pointer to the destination data buffer to write to. * \param Buffer Pointer to the destination data buffer to write to.
* \param Length Number of bytes to send via the currently selected endpoint. * \param Length Number of bytes to send via the currently selected endpoint.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -651,13 +651,13 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \note This routine should not be used on CONTROL type endpoints. * \note This routine should not be used on CONTROL type endpoints.
* *
* \param Buffer Pointer to the destination data buffer to write to. * \param Buffer Pointer to the destination data buffer to write to.
* \param Length Number of bytes to send via the currently selected endpoint. * \param Length Number of bytes to send via the currently selected endpoint.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum. * \return A value from the Endpoint_Stream_RW_ErrorCodes_t enum.
*/ */
@ -749,27 +749,27 @@
#define Endpoint_Ignore_DWord() Endpoint_Discard_DWord() #define Endpoint_Ignore_DWord() Endpoint_Discard_DWord()
/** Alias for Endpoint_Read_Word_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Read_Word_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Endpoint_Read_Word() Endpoint_Read_Word_LE() #define Endpoint_Read_Word() Endpoint_Read_Word_LE()
/** Alias for Endpoint_Write_Word_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Write_Word_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Endpoint_Write_Word(Word) Endpoint_Write_Word_LE(Word) #define Endpoint_Write_Word(Word) Endpoint_Write_Word_LE(Word)
/** Alias for Endpoint_Read_DWord_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Read_DWord_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Endpoint_Read_DWord() Endpoint_Read_DWord_LE() #define Endpoint_Read_DWord() Endpoint_Read_DWord_LE()
/** Alias for Endpoint_Write_DWord_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Write_DWord_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Endpoint_Write_DWord(DWord) Endpoint_Write_DWord_LE(DWord) #define Endpoint_Write_DWord(DWord) Endpoint_Write_DWord_LE(DWord)
/** Alias for Endpoint_Read_Stream_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Read_Stream_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#if !defined(NO_STREAM_CALLBACKS) #if !defined(NO_STREAM_CALLBACKS)
#define Endpoint_Read_Stream(Buffer, Length, Callback) Endpoint_Read_Stream_LE(Buffer, Length, Callback) #define Endpoint_Read_Stream(Buffer, Length, Callback) Endpoint_Read_Stream_LE(Buffer, Length, Callback)
@ -778,7 +778,7 @@
#endif #endif
/** Alias for Endpoint_Write_Stream_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Write_Stream_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#if !defined(NO_STREAM_CALLBACKS) #if !defined(NO_STREAM_CALLBACKS)
#define Endpoint_Write_Stream(Buffer, Length, Callback) Endpoint_Write_Stream_LE(Buffer, Length, Callback) #define Endpoint_Write_Stream(Buffer, Length, Callback) Endpoint_Write_Stream_LE(Buffer, Length, Callback)
@ -787,12 +787,12 @@
#endif #endif
/** Alias for Endpoint_Read_Control_Stream_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Read_Control_Stream_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Endpoint_Read_Control_Stream(Data, Length) Endpoint_Read_Control_Stream_LE(Data, Length) #define Endpoint_Read_Control_Stream(Data, Length) Endpoint_Read_Control_Stream_LE(Data, Length)
/** Alias for Endpoint_Write_Control_Stream_LE(). By default USB transfers use little endian format, thus /** Alias for Endpoint_Write_Control_Stream_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Endpoint_Write_Control_Stream(Data, Length) Endpoint_Write_Control_Stream_LE(Data, Length) #define Endpoint_Write_Control_Stream(Data, Length) Endpoint_Write_Control_Stream_LE(Data, Length)

@ -93,8 +93,8 @@ void USB_Host_ResetDevice(void)
for (uint8_t MSRem = 10; MSRem != 0; MSRem--) for (uint8_t MSRem = 10; MSRem != 0; MSRem--)
{ {
/* Workaround for powerless-pullup devices. After a USB bus reset, /* Workaround for powerless-pull-up devices. After a USB bus reset,
all disconnection interrupts are supressed while a USB frame is all disconnection interrupts are suppressed while a USB frame is
looked for - if it is found within 10ms, the device is still looked for - if it is found within 10ms, the device is still
present. */ present. */

@ -102,7 +102,7 @@
*/ */
#define USB_Host_ResumeBus() MACROS{ UHCON |= (1 << SOFEN); }MACROE #define USB_Host_ResumeBus() MACROS{ UHCON |= (1 << SOFEN); }MACROE
/** Suspends the USB bus, preventing any communications from occuring between the host and attached /** Suspends the USB bus, preventing any communications from occurring between the host and attached
* device until the bus has been resumed. This stops the transmission of the 1MS Start Of Frame * device until the bus has been resumed. This stops the transmission of the 1MS Start Of Frame
* messages to the device. * messages to the device.
*/ */
@ -192,14 +192,14 @@
* event. * event.
*/ */
HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed
* to complete successfuly, due to a timeout or other * to complete successfully, due to a timeout or other
* error. * error.
*/ */
HOST_ENUMERROR_NoDeviceDetected = 2, /**< No device was detected, despite the USB data lines HOST_ENUMERROR_NoDeviceDetected = 2, /**< No device was detected, despite the USB data lines
* indicating the attachment of a device. * indicating the attachment of a device.
*/ */
HOST_ENUMERROR_ControlError = 3, /**< One of the enumeration control requests failed to HOST_ENUMERROR_ControlError = 3, /**< One of the enumeration control requests failed to
* complete successfuly. * complete successfully.
*/ */
HOST_ENUMERROR_PipeConfigError = 4, /**< The default control pipe (address 0) failed to HOST_ENUMERROR_PipeConfigError = 4, /**< The default control pipe (address 0) failed to
* configure correctly. * configure correctly.

@ -77,7 +77,7 @@
HOST_SENDCONTROL_DeviceDisconnect = 1, /**< The attached device was disconnected during the HOST_SENDCONTROL_DeviceDisconnect = 1, /**< The attached device was disconnected during the
* request transfer. * request transfer.
*/ */
HOST_SENDCONTROL_PipeError = 2, /**< An error occured in the pipe while sending the request. */ HOST_SENDCONTROL_PipeError = 2, /**< An error occurred in the pipe while sending the request. */
HOST_SENDCONTROL_SetupStalled = 3, /**< The attached device stalled the request, usually HOST_SENDCONTROL_SetupStalled = 3, /**< The attached device stalled the request, usually
* indicating that the request is unsupported on the device. * indicating that the request is unsupported on the device.
*/ */

@ -82,7 +82,7 @@
* host mode indicates that VBUS should be applied and a session started. * host mode indicates that VBUS should be applied and a session started.
* *
* There are two different methods of sending a SRP - either pulses on the VBUS line, or by * There are two different methods of sending a SRP - either pulses on the VBUS line, or by
* pulsing the Data + line via the internal pullup resistor. The SRP mode is given as the * pulsing the Data + line via the internal pull-up resistor. The SRP mode is given as the
* "type" parameter, and can be either USB_OTG_SRP_VBUS or USB_OTG_STP_DATA. * "type" parameter, and can be either USB_OTG_SRP_VBUS or USB_OTG_STP_DATA.
*/ */
#define USB_OTG_DEV_Initiate_SRP(type) MACROS{ OTGCON = ((OTGCON & ~(1 << SRPSEL)) | (type | (1 << SRPREQ))); }MACROE #define USB_OTG_DEV_Initiate_SRP(type) MACROS{ OTGCON = ((OTGCON & ~(1 << SRPSEL)) | (type | (1 << SRPREQ))); }MACROE

@ -32,7 +32,7 @@
* *
* Functions, macros and enums related to pipe management when in USB Host mode. This * Functions, macros and enums related to pipe management when in USB Host mode. This
* module contains the pipe management macros, as well as pipe interrupt and data * module contains the pipe management macros, as well as pipe interrupt and data
* send/recieve functions for various datatypes. * send/recieve functions for various data types.
*/ */
#ifndef __PIPE_H__ #ifndef __PIPE_H__
@ -303,7 +303,7 @@
/** Returns true if the master pipe error flag is set for the currently selected pipe, indicating that /** Returns true if the master pipe error flag is set for the currently selected pipe, indicating that
* some sort of hardware error has occurred on the pipe. * some sort of hardware error has occurred on the pipe.
* *
* \see Pipe_GetErrorFlags() macro for information on retreiving the exact error flag. * \see Pipe_GetErrorFlags() macro for information on retrieving the exact error flag.
*/ */
#define Pipe_IsError() ((UPINTX & (1 << PERRI)) ? true : false) #define Pipe_IsError() ((UPINTX & (1 << PERRI)) ? true : false)
@ -311,14 +311,14 @@
* flag for the pipe. */ * flag for the pipe. */
#define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE #define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE
/** Returns a mask of the hardware error flags which have occured on the currently selected pipe. This /** Returns a mask of the hardware error flags which have occurred on the currently selected pipe. This
* value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred. * value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred.
*/ */
#define Pipe_GetErrorFlags() UPERRX #define Pipe_GetErrorFlags() UPERRX
/** Returns true if the currently selected pipe may be read from (if data is waiting in the pipe /** Returns true if the currently selected pipe may be read from (if data is waiting in the pipe
* bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT * bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT
* direction). This function will return false if an error has occured in the pipe, or if the pipe * direction). This function will return false if an error has occurred in the pipe, or if the pipe
* is an IN direction and no packet has been received, or if the pipe is an OUT direction and the * is an IN direction and no packet has been received, or if the pipe is an OUT direction and the
* pipe bank is full. * pipe bank is full.
*/ */
@ -358,9 +358,9 @@
#define Pipe_ClearSetupOUT() MACROS{ UPINTX &= ~(1 << TXOUTI); UPINTX &= ~(1 << FIFOCON); }MACROE #define Pipe_ClearSetupOUT() MACROS{ UPINTX &= ~(1 << TXOUTI); UPINTX &= ~(1 << FIFOCON); }MACROE
/** Returns true if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on /** Returns true if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on
* the currently selected pipe. This ocurrs when the host sends a packet to the device, but the device * the currently selected pipe. This occurs when the host sends a packet to the device, but the device
* is not currently ready to handle the packet (i.e. its endpoint banks are full). Once a NAK has been * is not currently ready to handle the packet (i.e. its endpoint banks are full). Once a NAK has been
* received, it must be cleard using Pipe_ClearNAKReceived() before the previous (or any other) packet * received, it must be cleared using Pipe_ClearNAKReceived() before the previous (or any other) packet
* can be re-sent. * can be re-sent.
*/ */
#define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false) #define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false)
@ -607,11 +607,11 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \param Buffer Pointer to the source data buffer to read from. * \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected pipe into the buffer. * \param Length Number of bytes to read for the currently selected pipe into the buffer.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -629,11 +629,11 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \param Buffer Pointer to the source data buffer to read from. * \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected pipe into the buffer. * \param Length Number of bytes to read for the currently selected pipe into the buffer.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -651,10 +651,10 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \param Length Number of bytes to send via the currently selected pipe. * \param Length Number of bytes to send via the currently selected pipe.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -672,11 +672,11 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \param Buffer Pointer to the source data buffer to write to. * \param Buffer Pointer to the source data buffer to write to.
* \param Length Number of bytes to read for the currently selected pipe to read from. * \param Length Number of bytes to read for the currently selected pipe to read from.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -694,11 +694,11 @@
* *
* The callback routine should be created using the STREAM_CALLBACK() macro. If the token * The callback routine should be created using the STREAM_CALLBACK() macro. If the token
* NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled * NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are disabled
* and this function has the Callback parameter ommitted. * and this function has the Callback parameter omitted.
* *
* \param Buffer Pointer to the source data buffer to write to. * \param Buffer Pointer to the source data buffer to write to.
* \param Length Number of bytes to read for the currently selected pipe to read from. * \param Length Number of bytes to read for the currently selected pipe to read from.
* \param Callback Name of a callback routine to call between sucessive USB packet transfers, NULL if no callback * \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
* *
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum.
*/ */
@ -722,27 +722,27 @@
#define Pipe_Ignore_DWord() Pipe_Discard_DWord() #define Pipe_Ignore_DWord() Pipe_Discard_DWord()
/** Alias for Pipe_Read_Word_LE(). By default USB transfers use little endian format, thus /** Alias for Pipe_Read_Word_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Pipe_Read_Word() Pipe_Read_Word_LE() #define Pipe_Read_Word() Pipe_Read_Word_LE()
/** Alias for Pipe_Write_Word_LE(). By default USB transfers use little endian format, thus /** Alias for Pipe_Write_Word_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Pipe_Write_Word(Word) Pipe_Write_Word_LE(Word) #define Pipe_Write_Word(Word) Pipe_Write_Word_LE(Word)
/** Alias for Pipe_Read_DWord_LE(). By default USB transfers use little endian format, thus /** Alias for Pipe_Read_DWord_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Pipe_Read_DWord() Pipe_Read_DWord_LE() #define Pipe_Read_DWord() Pipe_Read_DWord_LE()
/** Alias for Pipe_Write_DWord_LE(). By default USB transfers use little endian format, thus /** Alias for Pipe_Write_DWord_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#define Pipe_Write_DWord(DWord) Pipe_Write_DWord_LE(DWord) #define Pipe_Write_DWord(DWord) Pipe_Write_DWord_LE(DWord)
/** Alias for Pipe_Read_Stream_LE(). By default USB transfers use little endian format, thus /** Alias for Pipe_Read_Stream_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#if !defined(NO_STREAM_CALLBACKS) #if !defined(NO_STREAM_CALLBACKS)
#define Pipe_Read_Stream(Buffer, Length, Callback) Pipe_Read_Stream_LE(Buffer, Length, Callback) #define Pipe_Read_Stream(Buffer, Length, Callback) Pipe_Read_Stream_LE(Buffer, Length, Callback)
@ -751,7 +751,7 @@
#endif #endif
/** Alias for Pipe_Write_Stream_LE(). By default USB transfers use little endian format, thus /** Alias for Pipe_Write_Stream_LE(). By default USB transfers use little endian format, thus
* the command with no endianness specifier indicates little endian mode. * the command with no endianness specified indicates little endian mode.
*/ */
#if !defined(NO_STREAM_CALLBACKS) #if !defined(NO_STREAM_CALLBACKS)
#define Pipe_Write_Stream(Buffer, Length, Callback) Pipe_Read_Stream_LE(Buffer, Length, Callback) #define Pipe_Write_Stream(Buffer, Length, Callback) Pipe_Read_Stream_LE(Buffer, Length, Callback)

@ -45,9 +45,9 @@
* The constants NUM_BLOCKS, BLOCK_SIZE and NUM_HANDLES must be defined in the project makefile (and passed to the * The constants NUM_BLOCKS, BLOCK_SIZE and NUM_HANDLES must be defined in the project makefile (and passed to the
* preprocessor via the -D GCC switch) for this library to compile. * preprocessor via the -D GCC switch) for this library to compile.
* *
* NUM_BLOCKS indicates the number of memory blocks in the memory psudoheap which can be chaned together and handed * NUM_BLOCKS indicates the number of memory blocks in the memory psudoheap which can be chained together and handed
* to the application via a memory handle. NUM_HANDLES is the maximum number of memory handles (pointing to one or * to the application via a memory handle. NUM_HANDLES is the maximum number of memory handles (pointing to one or
* more chained memory blocks) which can be handed out simultaneously before requring a handle (and its associated * more chained memory blocks) which can be handed out simultaneously before requiring a handle (and its associated
* memory) to be freed. BLOCK_SIZE gives the number of bytes in each memory block. * memory) to be freed. BLOCK_SIZE gives the number of bytes in each memory block.
*/ */
@ -67,7 +67,7 @@
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* Macros: */ /* Macros: */
/** Macro to dereference a given memory handle into the given type. The given type should be a pointer /** Macro to dereference a given memory handle into the given type. The given type should be a pointer
* if the memory is to contain an array of items, or should be a standard type (such as a primative or * if the memory is to contain an array of items, or should be a standard type (such as a primitive or
* structure) if the memory is to hold a single item of a single type. */ * structure) if the memory is to hold a single item of a single type. */
#define DEREF(handle, type) (*(type*)handle) #define DEREF(handle, type) (*(type*)handle)

@ -30,10 +30,10 @@
/** \file /** \file
* *
* Simple round-robbin cooperative scheduler for use in basic projects where non realtime tasks need * Simple round-robbin cooperative scheduler for use in basic projects where non real-time tasks need
* to be executed. Each task is executed in sequence, and can be enabled or disabled individually or as a group. * to be executed. Each task is executed in sequence, and can be enabled or disabled individually or as a group.
* *
* For a task to yield it must return, thus each task should have persistant data marked with the static attribute. * For a task to yield it must return, thus each task should have persistent data marked with the static attribute.
* *
* Usage Example: * Usage Example:
* \code * \code
@ -126,8 +126,8 @@
#define Scheduler_Start() Scheduler_GoSchedule(TOTAL_TASKS); #define Scheduler_Start() Scheduler_GoSchedule(TOTAL_TASKS);
/** Initializes the scheduler so that the scheduler functions can be called before the scheduler itself /** Initializes the scheduler so that the scheduler functions can be called before the scheduler itself
* is started. This must be exeucted before any scheduler function calls other than Scheduler_Start(), * is started. This must be executed before any scheduler function calls other than Scheduler_Start(),
* and can be ommitted if no such functions could be called before the scheduler is started. * and can be omitted if no such functions could be called before the scheduler is started.
*/ */
#define Scheduler_Init() Scheduler_InitScheduler(TOTAL_TASKS); #define Scheduler_Init() Scheduler_InitScheduler(TOTAL_TASKS);
@ -194,7 +194,7 @@
* *
* Usage Example: * Usage Example:
* \code * \code
* static SchedulerDelayCounter_t DelayCounter = 10000; // Force immediate run on startup * static SchedulerDelayCounter_t DelayCounter = 10000; // Force immediate run on start-up
* *
* // Task runs every 10000 ticks, 10 seconds for this demo * // Task runs every 10000 ticks, 10 seconds for this demo
* if (Scheduler_HasDelayElapsed(10000, &DelayCounter)) * if (Scheduler_HasDelayElapsed(10000, &DelayCounter))

@ -46,7 +46,7 @@
/* Macros: */ /* Macros: */
#if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \ #if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)) || defined(__DOXYGEN__) defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)) || defined(__DOXYGEN__)
/** Maximum number of bits which can be stored into a bit buffer. The memory usage is one eigth of this value per buffer. */ /** Maximum number of bits which can be stored into a bit buffer. The memory usage is one eighth of this value per buffer. */
#define MAX_BITS 8192 #define MAX_BITS 8192
#else #else
#define MAX_BITS 1024 #define MAX_BITS 1024

@ -192,7 +192,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
/** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h /** This function is called by the library when in device mode, and must be overridden (see StdDescriptors.h
* documentation) by the application code so that the address and size of a requested descriptor can be given * documentation) by the application code so that the address and size of a requested descriptor can be given
* to the USB library. When the device recieves a Get Descriptor request on the control endpoint, this function * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host. * USB host.
*/ */

@ -78,7 +78,7 @@ BitBuffer_t Track2Data;
/** Circular buffer to hold the read bits from track 3 of the inserted magnetic card. */ /** Circular buffer to hold the read bits from track 3 of the inserted magnetic card. */
BitBuffer_t Track3Data; BitBuffer_t Track3Data;
/** Delay counter between sucessive key strokes. This is to prevent the OS from ignoring multiple keys in a short /** Delay counter between successive key strokes. This is to prevent the OS from ignoring multiple keys in a short
* period of time due to key repeats. Two milliseconds works for most OSes. * period of time due to key repeats. Two milliseconds works for most OSes.
*/ */
uint8_t KeyDelayRemaining; uint8_t KeyDelayRemaining;
@ -312,7 +312,7 @@ bool GetNextReport(USB_KeyboardReport_Data_t* ReportData)
/* Set the flag indicating that a null report must eventually be sent to release all pressed keys */ /* Set the flag indicating that a null report must eventually be sent to release all pressed keys */
MustRelease = true; MustRelease = true;
/* Only send the next key on odd reports, so that they are interpersed with null reports to release keys */ /* Only send the next key on odd reports, so that they are interspersed with null reports to release keys */
if (OddReport) if (OddReport)
{ {
/* Set the report key code to the key code for the next data bit */ /* Set the report key code to the key code for the next data bit */
@ -337,12 +337,12 @@ bool GetNextReport(USB_KeyboardReport_Data_t* ReportData)
return false; return false;
} }
/** Task to read out data from inserted magnetic cards and place the seperate track data into their respective /** Task to read out data from inserted magnetic cards and place the separate track data into their respective
* data buffers for later sending to the host as keyboard key presses. * data buffers for later sending to the host as keyboard key presses.
*/ */
TASK(Magstripe_Read) TASK(Magstripe_Read)
{ {
/* Arrays to hold the buffer pointers, clock and data bit masks for the seperate card tracks */ /* Arrays to hold the buffer pointers, clock and data bit masks for the separate card tracks */
const struct const struct
{ {
BitBuffer_t* Buffer; BitBuffer_t* Buffer;
@ -396,7 +396,7 @@ TASK(Magstripe_Read)
} }
/** Task for the magnetic card reading and keyboard report generation. This task waits until a card is inserted, /** Task for the magnetic card reading and keyboard report generation. This task waits until a card is inserted,
* then reads off the card data and sends it to the host as a series of keyboard keypresses via keyboard reports. * then reads off the card data and sends it to the host as a series of keyboard key presses via keyboard reports.
*/ */
TASK(USB_Keyboard_Report) TASK(USB_Keyboard_Report)
{ {

Loading…
Cancel
Save