mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-31 05:12:33 +01:00 
			
		
		
		
	Run wspurify script on /trunk/ and /branches/ C source files, to remove any trailing whitespace at the end of each line.
This commit is contained in:
		
							parent
							
								
									77f354609f
								
							
						
					
					
						commit
						f201f6697b
					
				| @ -40,9 +40,9 @@ | |||||||
| 		#include <avr/io.h> | 		#include <avr/io.h> | ||||||
| 		#include <avr/boot.h> | 		#include <avr/boot.h> | ||||||
| 		#include <stdbool.h> | 		#include <stdbool.h> | ||||||
| 		 | 
 | ||||||
| 		#include <LUFA/Common/Common.h> | 		#include <LUFA/Common/Common.h> | ||||||
| 	 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void    BootloaderAPI_ErasePage(const uint32_t Address); | 		void    BootloaderAPI_ErasePage(const uint32_t Address); | ||||||
| 		void    BootloaderAPI_WritePage(const uint32_t Address); | 		void    BootloaderAPI_WritePage(const uint32_t Address); | ||||||
|  | |||||||
| @ -104,10 +104,10 @@ void SetupHardware(void) | |||||||
| 	/* Initialize USB Subsystem */ | 	/* Initialize USB Subsystem */ | ||||||
| 	USB_Init(); | 	USB_Init(); | ||||||
| 	LEDs_Init(); | 	LEDs_Init(); | ||||||
| 	 | 
 | ||||||
| 	/* Bootloader active LED toggle timer initialization */ | 	/* Bootloader active LED toggle timer initialization */ | ||||||
| 	TIMSK1 = (1 << TOIE1); | 	TIMSK1 = (1 << TOIE1); | ||||||
| 	TCCR1B = ((1 << CS11) | (1 << CS10));	 | 	TCCR1B = ((1 << CS11) | (1 << CS10)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */ | /** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */ | ||||||
| @ -266,7 +266,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command) | |||||||
| 				{ | 				{ | ||||||
| 					LowByte = FetchNextCommandByte(); | 					LowByte = FetchNextCommandByte(); | ||||||
| 				} | 				} | ||||||
| 				 | 
 | ||||||
| 				HighByte = !HighByte; | 				HighByte = !HighByte; | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| @ -365,7 +365,7 @@ void CDC_Task(void) | |||||||
| 	if (Command == 'E') | 	if (Command == 'E') | ||||||
| 	{ | 	{ | ||||||
| 		RunBootloader = false; | 		RunBootloader = false; | ||||||
| 	 | 
 | ||||||
| 		/* Send confirmation byte back to the host */ | 		/* Send confirmation byte back to the host */ | ||||||
| 		WriteNextResponseByte('\r'); | 		WriteNextResponseByte('\r'); | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ | |||||||
| 		#include <stdbool.h> | 		#include <stdbool.h> | ||||||
| 
 | 
 | ||||||
| 		#include "Descriptors.h" | 		#include "Descriptors.h" | ||||||
| 		#include "BootloaderAPI.h"		 | 		#include "BootloaderAPI.h" | ||||||
| 
 | 
 | ||||||
| 		#include <LUFA/Drivers/USB/USB.h> | 		#include <LUFA/Drivers/USB/USB.h> | ||||||
| 		#include <LUFA/Drivers/Board/LEDs.h> | 		#include <LUFA/Drivers/Board/LEDs.h> | ||||||
|  | |||||||
| @ -115,14 +115,14 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t    Config; | 			USB_Descriptor_Configuration_Header_t    Config; | ||||||
| 			 | 
 | ||||||
| 			// CDC Control Interface
 | 			// CDC Control Interface
 | ||||||
| 			USB_Descriptor_Interface_t               CDC_CCI_Interface; | 			USB_Descriptor_Interface_t               CDC_CCI_Interface; | ||||||
| 			USB_CDC_Descriptor_FunctionalHeader_t    CDC_Functional_Header; | 			USB_CDC_Descriptor_FunctionalHeader_t    CDC_Functional_Header; | ||||||
| 			USB_CDC_Descriptor_FunctionalACM_t       CDC_Functional_ACM; | 			USB_CDC_Descriptor_FunctionalACM_t       CDC_Functional_ACM; | ||||||
| 			USB_CDC_Descriptor_FunctionalUnion_t     CDC_Functional_Union; | 			USB_CDC_Descriptor_FunctionalUnion_t     CDC_Functional_Union; | ||||||
| 			USB_Descriptor_Endpoint_t                CDC_NotificationEndpoint; | 			USB_Descriptor_Endpoint_t                CDC_NotificationEndpoint; | ||||||
| 			 | 
 | ||||||
| 			// CDC Data Interface
 | 			// CDC Data Interface
 | ||||||
| 			USB_Descriptor_Interface_t               CDC_DCI_Interface; | 			USB_Descriptor_Interface_t               CDC_DCI_Interface; | ||||||
| 			USB_Descriptor_Endpoint_t                CDC_DataOutEndpoint; | 			USB_Descriptor_Endpoint_t                CDC_DataOutEndpoint; | ||||||
|  | |||||||
| @ -40,9 +40,9 @@ | |||||||
| 		#include <avr/io.h> | 		#include <avr/io.h> | ||||||
| 		#include <avr/boot.h> | 		#include <avr/boot.h> | ||||||
| 		#include <stdbool.h> | 		#include <stdbool.h> | ||||||
| 		 | 
 | ||||||
| 		#include <LUFA/Common/Common.h> | 		#include <LUFA/Common/Common.h> | ||||||
| 	 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void    BootloaderAPI_ErasePage(const uint32_t Address); | 		void    BootloaderAPI_ErasePage(const uint32_t Address); | ||||||
| 		void    BootloaderAPI_WritePage(const uint32_t Address); | 		void    BootloaderAPI_WritePage(const uint32_t Address); | ||||||
|  | |||||||
| @ -113,10 +113,10 @@ int main(void) | |||||||
| 
 | 
 | ||||||
| 	/* If the TCK pin is not jumpered to ground, start the user application instead */ | 	/* If the TCK pin is not jumpered to ground, start the user application instead */ | ||||||
| 	RunBootloader = (!(PINF & (1 << 4))); | 	RunBootloader = (!(PINF & (1 << 4))); | ||||||
| 	 | 
 | ||||||
| 	/* Re-enable JTAG debugging */ | 	/* Re-enable JTAG debugging */ | ||||||
| 	MCUCR &= ~(1 << JTD); | 	MCUCR &= ~(1 << JTD); | ||||||
| 	MCUCR &= ~(1 << JTD);	 | 	MCUCR &= ~(1 << JTD); | ||||||
| 	#endif | 	#endif | ||||||
| 
 | 
 | ||||||
| 	/* Turn on first LED on the board to indicate that the bootloader has started */ | 	/* Turn on first LED on the board to indicate that the bootloader has started */ | ||||||
| @ -153,7 +153,7 @@ void SetupHardware(void) | |||||||
| 	/* Initialize the USB subsystem */ | 	/* Initialize the USB subsystem */ | ||||||
| 	USB_Init(); | 	USB_Init(); | ||||||
| 	LEDs_Init(); | 	LEDs_Init(); | ||||||
| 	 | 
 | ||||||
| 	/* Bootloader active LED toggle timer initialization */ | 	/* Bootloader active LED toggle timer initialization */ | ||||||
| 	TIMSK1 = (1 << TOIE1); | 	TIMSK1 = (1 << TOIE1); | ||||||
| 	TCCR1B = ((1 << CS11) | (1 << CS10)); | 	TCCR1B = ((1 << CS11) | (1 << CS10)); | ||||||
| @ -181,7 +181,7 @@ ISR(TIMER1_OVF_vect, ISR_BLOCK) | |||||||
|  *  internally. |  *  internally. | ||||||
|  */ |  */ | ||||||
| void EVENT_USB_Device_ControlRequest(void) | void EVENT_USB_Device_ControlRequest(void) | ||||||
| {	 | { | ||||||
| 	/* Ignore any requests that aren't directed to the DFU interface */ | 	/* Ignore any requests that aren't directed to the DFU interface */ | ||||||
| 	if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != | 	if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != | ||||||
| 	    (REQTYPE_CLASS | REQREC_INTERFACE)) | 	    (REQTYPE_CLASS | REQREC_INTERFACE)) | ||||||
| @ -742,3 +742,4 @@ static void ProcessReadCommand(void) | |||||||
| 	else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01))                    // Read signature byte
 | 	else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01))                    // Read signature byte
 | ||||||
| 	  ResponseByte = SignatureInfo[DataIndexToRead - 0x30]; | 	  ResponseByte = SignatureInfo[DataIndexToRead - 0x30]; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -159,11 +159,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | |||||||
| 			Address = &DeviceDescriptor; | 			Address = &DeviceDescriptor; | ||||||
| 			Size    = sizeof(USB_Descriptor_Device_t); | 			Size    = sizeof(USB_Descriptor_Device_t); | ||||||
| 			break; | 			break; | ||||||
| 		case DTYPE_Configuration:  | 		case DTYPE_Configuration: | ||||||
| 			Address = &ConfigurationDescriptor; | 			Address = &ConfigurationDescriptor; | ||||||
| 			Size    = sizeof(USB_Descriptor_Configuration_t); | 			Size    = sizeof(USB_Descriptor_Configuration_t); | ||||||
| 			break; | 			break; | ||||||
| 		case DTYPE_String:  | 		case DTYPE_String: | ||||||
| 			if (!(DescriptorNumber)) | 			if (!(DescriptorNumber)) | ||||||
| 			{ | 			{ | ||||||
| 				Address = &LanguageString; | 				Address = &LanguageString; | ||||||
| @ -174,10 +174,10 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | |||||||
| 				Address = &ProductString; | 				Address = &ProductString; | ||||||
| 				Size    = ProductString.Header.Size; | 				Size    = ProductString.Header.Size; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	*DescriptorAddress = Address; | 	*DescriptorAddress = Address; | ||||||
| 	return Size; | 	return Size; | ||||||
| } | } | ||||||
|  | |||||||
| @ -161,7 +161,7 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t Config; | 			USB_Descriptor_Configuration_Header_t Config; | ||||||
| 			 | 
 | ||||||
| 			// DFU Interface
 | 			// DFU Interface
 | ||||||
| 			USB_Descriptor_Interface_t            DFU_Interface; | 			USB_Descriptor_Interface_t            DFU_Interface; | ||||||
| 			USB_Descriptor_DFU_Functional_t       DFU_Functional; | 			USB_Descriptor_DFU_Functional_t       DFU_Functional; | ||||||
|  | |||||||
| @ -9,13 +9,13 @@ | |||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
| 
 | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this  |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in  |   without fee, provided that the above copyright notice appear in | ||||||
|   all copies and that both that the copyright notice and this |   all copies and that both that the copyright notice and this | ||||||
|   permission notice and warranty disclaimer appear in supporting  |   permission notice and warranty disclaimer appear in supporting | ||||||
|   documentation, and that the name of the author not be used in  |   documentation, and that the name of the author not be used in | ||||||
|   advertising or publicity pertaining to distribution of the  |   advertising or publicity pertaining to distribution of the | ||||||
|   software without specific, written prior permission. |   software without specific, written prior permission. | ||||||
| 
 | 
 | ||||||
|   The author disclaim all warranties with regard to this |   The author disclaim all warranties with regard to this | ||||||
| @ -32,7 +32,7 @@ | |||||||
|  * |  * | ||||||
|  *  Main source file for the HID class bootloader. This file contains the complete bootloader logic. |  *  Main source file for the HID class bootloader. This file contains the complete bootloader logic. | ||||||
|  */ |  */ | ||||||
|   | 
 | ||||||
| #include "BootloaderHID.h" | #include "BootloaderHID.h" | ||||||
| 
 | 
 | ||||||
| /** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run
 | /** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run
 | ||||||
| @ -41,20 +41,20 @@ | |||||||
|  */ |  */ | ||||||
| static bool RunBootloader = true; | static bool RunBootloader = true; | ||||||
| 
 | 
 | ||||||
| /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously 
 | /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
 | ||||||
|  *  runs the bootloader processing routine until instructed to soft-exit. |  *  runs the bootloader processing routine until instructed to soft-exit. | ||||||
|  */ |  */ | ||||||
| int main(void) | int main(void) | ||||||
| { | { | ||||||
| 	/* Setup hardware required for the bootloader */ | 	/* Setup hardware required for the bootloader */ | ||||||
| 	SetupHardware(); | 	SetupHardware(); | ||||||
| 	 | 
 | ||||||
| 	/* Enable global interrupts so that the USB stack can function */ | 	/* Enable global interrupts so that the USB stack can function */ | ||||||
| 	sei(); | 	sei(); | ||||||
| 
 | 
 | ||||||
| 	while (RunBootloader) | 	while (RunBootloader) | ||||||
| 	  USB_USBTask(); | 	  USB_USBTask(); | ||||||
| 	 | 
 | ||||||
| 	/* Disconnect from the host - USB interface will be reset later along with the AVR */ | 	/* Disconnect from the host - USB interface will be reset later along with the AVR */ | ||||||
| 	USB_Detach(); | 	USB_Detach(); | ||||||
| 
 | 
 | ||||||
| @ -108,17 +108,17 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 	{ | 	{ | ||||||
| 		case HID_REQ_SetReport: | 		case HID_REQ_SetReport: | ||||||
| 			Endpoint_ClearSETUP(); | 			Endpoint_ClearSETUP(); | ||||||
| 			 | 
 | ||||||
| 			/* Wait until the command has been sent by the host */ | 			/* Wait until the command has been sent by the host */ | ||||||
| 			while (!(Endpoint_IsOUTReceived())); | 			while (!(Endpoint_IsOUTReceived())); | ||||||
| 		 | 
 | ||||||
| 			/* Read in the write destination address */ | 			/* Read in the write destination address */ | ||||||
| 			#if (FLASHEND > 0xFFFF) | 			#if (FLASHEND > 0xFFFF) | ||||||
| 			uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8); | 			uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8); | ||||||
| 			#else | 			#else | ||||||
| 			uint16_t PageAddress = Endpoint_Read_16_LE(); | 			uint16_t PageAddress = Endpoint_Read_16_LE(); | ||||||
| 			#endif | 			#endif | ||||||
| 			 | 
 | ||||||
| 			/* Check if the command is a program page command, or a start application command */ | 			/* Check if the command is a program page command, or a start application command */ | ||||||
| 			#if (FLASHEND > 0xFFFF) | 			#if (FLASHEND > 0xFFFF) | ||||||
| 			if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION) | 			if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION) | ||||||
| @ -133,9 +133,9 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Erase the given FLASH page, ready to be programmed */ | 				/* Erase the given FLASH page, ready to be programmed */ | ||||||
| 				boot_page_erase(PageAddress); | 				boot_page_erase(PageAddress); | ||||||
| 				boot_spm_busy_wait(); | 				boot_spm_busy_wait(); | ||||||
| 				 | 
 | ||||||
| 				/* Write each of the FLASH page's bytes in sequence */ | 				/* Write each of the FLASH page's bytes in sequence */ | ||||||
| 				for (uint8_t PageWord = 0; PageWord < (SPM_PAGESIZE / 2); PageWord++)				 | 				for (uint8_t PageWord = 0; PageWord < (SPM_PAGESIZE / 2); PageWord++) | ||||||
| 				{ | 				{ | ||||||
| 					/* Check if endpoint is empty - if so clear it and wait until ready for next packet */ | 					/* Check if endpoint is empty - if so clear it and wait until ready for next packet */ | ||||||
| 					if (!(Endpoint_BytesInEndpoint())) | 					if (!(Endpoint_BytesInEndpoint())) | ||||||
| @ -162,3 +162,4 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -8,14 +8,14 @@ | |||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
| 	   | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this  |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in  |   without fee, provided that the above copyright notice appear in | ||||||
|   all copies and that both that the copyright notice and this |   all copies and that both that the copyright notice and this | ||||||
|   permission notice and warranty disclaimer appear in supporting  |   permission notice and warranty disclaimer appear in supporting | ||||||
|   documentation, and that the name of the author not be used in  |   documentation, and that the name of the author not be used in | ||||||
|   advertising or publicity pertaining to distribution of the  |   advertising or publicity pertaining to distribution of the | ||||||
|   software without specific, written prior permission. |   software without specific, written prior permission. | ||||||
| 
 | 
 | ||||||
|   The author disclaim all warranties with regard to this |   The author disclaim all warranties with regard to this | ||||||
| @ -32,7 +32,7 @@ | |||||||
|  * |  * | ||||||
|  *  Header file for TeensyHID.c. |  *  Header file for TeensyHID.c. | ||||||
|  */ |  */ | ||||||
|   | 
 | ||||||
| #ifndef _TEENSYHID_H_ | #ifndef _TEENSYHID_H_ | ||||||
| #define _TEENSYHID_H_ | #define _TEENSYHID_H_ | ||||||
| 
 | 
 | ||||||
| @ -47,15 +47,16 @@ | |||||||
| 		#include "Descriptors.h" | 		#include "Descriptors.h" | ||||||
| 
 | 
 | ||||||
| 		#include <LUFA/Drivers/USB/USB.h> | 		#include <LUFA/Drivers/USB/USB.h> | ||||||
| 		 | 
 | ||||||
| 	/* Macros: */		 | 	/* Macros: */ | ||||||
| 		/** Bootloader special address to start the user application */ | 		/** Bootloader special address to start the user application */ | ||||||
| 		#define COMMAND_STARTAPPLICATION   0xFFFF | 		#define COMMAND_STARTAPPLICATION   0xFFFF | ||||||
| 		 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void SetupHardware(void); | 		void SetupHardware(void); | ||||||
| 
 | 
 | ||||||
| 		void EVENT_USB_Device_ConfigurationChanged(void); | 		void EVENT_USB_Device_ConfigurationChanged(void); | ||||||
| 		void EVENT_USB_Device_UnhandledControlRequest(void); | 		void EVENT_USB_Device_UnhandledControlRequest(void); | ||||||
| 		 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -8,14 +8,14 @@ | |||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
| 	   | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this  |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in  |   without fee, provided that the above copyright notice appear in | ||||||
|   all copies and that both that the copyright notice and this |   all copies and that both that the copyright notice and this | ||||||
|   permission notice and warranty disclaimer appear in supporting  |   permission notice and warranty disclaimer appear in supporting | ||||||
|   documentation, and that the name of the author not be used in  |   documentation, and that the name of the author not be used in | ||||||
|   advertising or publicity pertaining to distribution of the  |   advertising or publicity pertaining to distribution of the | ||||||
|   software without specific, written prior permission. |   software without specific, written prior permission. | ||||||
| 
 | 
 | ||||||
|   The author disclaim all warranties with regard to this |   The author disclaim all warranties with regard to this | ||||||
| @ -30,9 +30,9 @@ | |||||||
| 
 | 
 | ||||||
| /** \file
 | /** \file
 | ||||||
|  * |  * | ||||||
|  *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special  |  *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special | ||||||
|  *  computer-readable structures which the host requests upon device enumeration, to determine |  *  computer-readable structures which the host requests upon device enumeration, to determine | ||||||
|  *  the device's capabilities and functions.   |  *  the device's capabilities and functions. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "Descriptors.h" | #include "Descriptors.h" | ||||||
| @ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t HIDReport[] = | |||||||
| 	    HID_RI_LOGICAL_MINIMUM(8, 0x00), | 	    HID_RI_LOGICAL_MINIMUM(8, 0x00), | ||||||
| 	    HID_RI_LOGICAL_MAXIMUM(8, 0xFF), | 	    HID_RI_LOGICAL_MAXIMUM(8, 0xFF), | ||||||
| 	    HID_RI_REPORT_SIZE(8, 0x08), | 	    HID_RI_REPORT_SIZE(8, 0x08), | ||||||
| 	    HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)),		 | 	    HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)), | ||||||
| 	    HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), | 	    HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), | ||||||
| 	HID_RI_END_COLLECTION(0), | 	HID_RI_END_COLLECTION(0), | ||||||
| }; | }; | ||||||
| @ -91,49 +91,49 @@ const USB_Descriptor_Device_t DeviceDescriptor = | |||||||
|  */ |  */ | ||||||
| const USB_Descriptor_Configuration_t ConfigurationDescriptor = | const USB_Descriptor_Configuration_t ConfigurationDescriptor = | ||||||
| { | { | ||||||
| 	.Config =  | 	.Config = | ||||||
| 		{ | 		{ | ||||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, | 			.Header                 = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, | ||||||
| 
 | 
 | ||||||
| 			.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), | 			.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), | ||||||
| 			.TotalInterfaces        = 1, | 			.TotalInterfaces        = 1, | ||||||
| 				 | 
 | ||||||
| 			.ConfigurationNumber    = 1, | 			.ConfigurationNumber    = 1, | ||||||
| 			.ConfigurationStrIndex  = NO_DESCRIPTOR, | 			.ConfigurationStrIndex  = NO_DESCRIPTOR, | ||||||
| 				 | 
 | ||||||
| 			.ConfigAttributes       = USB_CONFIG_ATTR_BUSPOWERED, | 			.ConfigAttributes       = USB_CONFIG_ATTR_BUSPOWERED, | ||||||
| 			 | 
 | ||||||
| 			.MaxPowerConsumption    = USB_CONFIG_POWER_MA(100) | 			.MaxPowerConsumption    = USB_CONFIG_POWER_MA(100) | ||||||
| 		}, | 		}, | ||||||
| 		 | 
 | ||||||
| 	.HID_Interface =  | 	.HID_Interface = | ||||||
| 		{ | 		{ | ||||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, | 			.Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, | ||||||
| 
 | 
 | ||||||
| 			.InterfaceNumber        = 0x00, | 			.InterfaceNumber        = 0x00, | ||||||
| 			.AlternateSetting       = 0x00, | 			.AlternateSetting       = 0x00, | ||||||
| 			 | 
 | ||||||
| 			.TotalEndpoints         = 1, | 			.TotalEndpoints         = 1, | ||||||
| 				 | 
 | ||||||
| 			.Class                  = HID_CSCP_HIDClass, | 			.Class                  = HID_CSCP_HIDClass, | ||||||
| 			.SubClass               = HID_CSCP_NonBootSubclass, | 			.SubClass               = HID_CSCP_NonBootSubclass, | ||||||
| 			.Protocol               = HID_CSCP_NonBootProtocol, | 			.Protocol               = HID_CSCP_NonBootProtocol, | ||||||
| 				 | 
 | ||||||
| 			.InterfaceStrIndex      = NO_DESCRIPTOR | 			.InterfaceStrIndex      = NO_DESCRIPTOR | ||||||
| 		}, | 		}, | ||||||
| 
 | 
 | ||||||
| 	.HID_VendorHID =  | 	.HID_VendorHID = | ||||||
| 		{   | 		{ | ||||||
| 			.Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, | 			.Header                 = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, | ||||||
| 			 | 
 | ||||||
| 			.HIDSpec                = VERSION_BCD(01.11), | 			.HIDSpec                = VERSION_BCD(01.11), | ||||||
| 			.CountryCode            = 0x00, | 			.CountryCode            = 0x00, | ||||||
| 			.TotalReportDescriptors = 1, | 			.TotalReportDescriptors = 1, | ||||||
| 			.HIDReportType          = HID_DTYPE_Report, | 			.HIDReportType          = HID_DTYPE_Report, | ||||||
| 			.HIDReportLength        = sizeof(HIDReport) | 			.HIDReportLength        = sizeof(HIDReport) | ||||||
| 		}, | 		}, | ||||||
| 		 | 
 | ||||||
| 	.HID_ReportINEndpoint =  | 	.HID_ReportINEndpoint = | ||||||
| 		{ | 		{ | ||||||
| 			.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, | 			.Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, | ||||||
| 
 | 
 | ||||||
| @ -158,17 +158,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | |||||||
| 
 | 
 | ||||||
| 	const void* Address = NULL; | 	const void* Address = NULL; | ||||||
| 	uint16_t    Size    = NO_DESCRIPTOR; | 	uint16_t    Size    = NO_DESCRIPTOR; | ||||||
| 	 | 
 | ||||||
| 	/* If/Else If chain compiles slightly smaller than a switch case */ | 	/* If/Else If chain compiles slightly smaller than a switch case */ | ||||||
| 	if (DescriptorType == DTYPE_Device) | 	if (DescriptorType == DTYPE_Device) | ||||||
| 	{ | 	{ | ||||||
| 		Address = &DeviceDescriptor; | 		Address = &DeviceDescriptor; | ||||||
| 		Size    = sizeof(USB_Descriptor_Device_t);	 | 		Size    = sizeof(USB_Descriptor_Device_t); | ||||||
| 	} | 	} | ||||||
| 	else if (DescriptorType == DTYPE_Configuration) | 	else if (DescriptorType == DTYPE_Configuration) | ||||||
| 	{ | 	{ | ||||||
| 		Address = &ConfigurationDescriptor; | 		Address = &ConfigurationDescriptor; | ||||||
| 		Size    = sizeof(USB_Descriptor_Configuration_t);	 | 		Size    = sizeof(USB_Descriptor_Configuration_t); | ||||||
| 	} | 	} | ||||||
| 	else if (DescriptorType == HID_DTYPE_HID) | 	else if (DescriptorType == HID_DTYPE_HID) | ||||||
| 	{ | 	{ | ||||||
| @ -184,3 +184,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | |||||||
| 	*DescriptorAddress = Address; | 	*DescriptorAddress = Address; | ||||||
| 	return Size; | 	return Size; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -8,14 +8,14 @@ | |||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
| 	   | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this  |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in  |   without fee, provided that the above copyright notice appear in | ||||||
|   all copies and that both that the copyright notice and this |   all copies and that both that the copyright notice and this | ||||||
|   permission notice and warranty disclaimer appear in supporting  |   permission notice and warranty disclaimer appear in supporting | ||||||
|   documentation, and that the name of the author not be used in  |   documentation, and that the name of the author not be used in | ||||||
|   advertising or publicity pertaining to distribution of the  |   advertising or publicity pertaining to distribution of the | ||||||
|   software without specific, written prior permission. |   software without specific, written prior permission. | ||||||
| 
 | 
 | ||||||
|   The author disclaim all warranties with regard to this |   The author disclaim all warranties with regard to this | ||||||
| @ -47,18 +47,18 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t Config; | 			USB_Descriptor_Configuration_Header_t Config; | ||||||
| 			 | 
 | ||||||
| 			// Generic HID Interface
 | 			// Generic HID Interface
 | ||||||
| 			USB_Descriptor_Interface_t            HID_Interface; | 			USB_Descriptor_Interface_t            HID_Interface; | ||||||
| 			USB_HID_Descriptor_HID_t              HID_VendorHID; | 			USB_HID_Descriptor_HID_t              HID_VendorHID; | ||||||
| 	        USB_Descriptor_Endpoint_t             HID_ReportINEndpoint; | 	        USB_Descriptor_Endpoint_t             HID_ReportINEndpoint; | ||||||
| 		} USB_Descriptor_Configuration_t; | 		} USB_Descriptor_Configuration_t; | ||||||
| 					 | 
 | ||||||
| 	/* Macros: */ | 	/* Macros: */ | ||||||
| 		/** Endpoint number of the HID data IN endpoint. */ | 		/** Endpoint number of the HID data IN endpoint. */ | ||||||
| 		#define HID_IN_EPNUM                 1 | 		#define HID_IN_EPNUM                 1 | ||||||
| 
 | 
 | ||||||
| 		/** Size in bytes of the HID reporting IN endpoint. */		 | 		/** Size in bytes of the HID reporting IN endpoint. */ | ||||||
| 		#define HID_IN_EPSIZE                64 | 		#define HID_IN_EPSIZE                64 | ||||||
| 
 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| @ -68,3 +68,4 @@ | |||||||
| 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -710,10 +710,10 @@ int teensy_open(void) | |||||||
| { | { | ||||||
| 	teensy_close(); | 	teensy_close(); | ||||||
| 	uhid_teensy_fd = open_usb_device(0x16C0, 0x0478); | 	uhid_teensy_fd = open_usb_device(0x16C0, 0x0478); | ||||||
| 	 | 
 | ||||||
| 	if (uhid_teensy_fd < 0) | 	if (uhid_teensy_fd < 0) | ||||||
| 		uhid_teensy_fd = open_usb_device(0x03eb, 0x2067); | 		uhid_teensy_fd = open_usb_device(0x03eb, 0x2067); | ||||||
| 	 | 
 | ||||||
| 	if (uhid_teensy_fd < 0) return 0; | 	if (uhid_teensy_fd < 0) return 0; | ||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
| @ -826,7 +826,7 @@ parse_hex_line(char *line) | |||||||
| 	int addr, code, num; | 	int addr, code, num; | ||||||
|         int sum, len, cksum, i; |         int sum, len, cksum, i; | ||||||
|         char *ptr; |         char *ptr; | ||||||
|          | 
 | ||||||
|         num = 0; |         num = 0; | ||||||
|         if (line[0] != ':') return 0; |         if (line[0] != ':') return 0; | ||||||
|         if (strlen(line) < 11) return 0; |         if (strlen(line) < 11) return 0; | ||||||
|  | |||||||
| @ -106,11 +106,11 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 		#if defined(USE_TEST_TONE) | 		#if defined(USE_TEST_TONE) | ||||||
| 			static uint8_t SquareWaveSampleCount; | 			static uint8_t SquareWaveSampleCount; | ||||||
| 			static int16_t CurrentWaveValue; | 			static int16_t CurrentWaveValue; | ||||||
| 			 | 
 | ||||||
| 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | ||||||
| 			if (SquareWaveSampleCount++ == 0xFF) | 			if (SquareWaveSampleCount++ == 0xFF) | ||||||
| 			  CurrentWaveValue ^= 0x8000; | 			  CurrentWaveValue ^= 0x8000; | ||||||
| 			 | 
 | ||||||
| 			/* Only generate audio if the board button is being pressed */ | 			/* Only generate audio if the board button is being pressed */ | ||||||
| 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | ||||||
| 		#else | 		#else | ||||||
| @ -122,7 +122,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | ||||||
| 			#endif | 			#endif | ||||||
| 		#endif | 		#endif | ||||||
| 		 | 
 | ||||||
| 		Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample); | 		Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -211,10 +211,10 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* | |||||||
| 						CurrentAudioSampleFrequency = (((uint32_t)Data[2] << 16) | ((uint32_t)Data[1] << 8) | (uint32_t)Data[0]); | 						CurrentAudioSampleFrequency = (((uint32_t)Data[2] << 16) | ((uint32_t)Data[1] << 8) | (uint32_t)Data[0]); | ||||||
| 
 | 
 | ||||||
| 						/* Adjust sample reload timer to the new frequency */ | 						/* Adjust sample reload timer to the new frequency */ | ||||||
| 						OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1);				 | 						OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); | ||||||
| 					} | 					} | ||||||
| 					 | 
 | ||||||
| 					return true;				 | 					return true; | ||||||
| 				case AUDIO_REQ_GetCurrent: | 				case AUDIO_REQ_GetCurrent: | ||||||
| 					/* Check if we are just testing for a valid property, or actually reading it */ | 					/* Check if we are just testing for a valid property, or actually reading it */ | ||||||
| 					if (DataLength != NULL) | 					if (DataLength != NULL) | ||||||
| @ -223,13 +223,14 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* | |||||||
| 
 | 
 | ||||||
| 						Data[2] = (CurrentAudioSampleFrequency >> 16); | 						Data[2] = (CurrentAudioSampleFrequency >> 16); | ||||||
| 						Data[1] = (CurrentAudioSampleFrequency >> 8); | 						Data[1] = (CurrentAudioSampleFrequency >> 8); | ||||||
| 						Data[0] = (CurrentAudioSampleFrequency &  0xFF);					 | 						Data[0] = (CurrentAudioSampleFrequency &  0xFF); | ||||||
| 					} | 					} | ||||||
| 					 | 
 | ||||||
| 					return true; | 					return true; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -204,7 +204,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | |||||||
| 
 | 
 | ||||||
| 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)) | 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)) | ||||||
| 		}, | 		}, | ||||||
| 	 | 
 | ||||||
| 	.Audio_AudioFormatSampleRates = | 	.Audio_AudioFormatSampleRates = | ||||||
| 		{ | 		{ | ||||||
| 			AUDIO_SAMPLE_FREQ(8000), | 			AUDIO_SAMPLE_FREQ(8000), | ||||||
|  | |||||||
| @ -91,7 +91,7 @@ void SetupHardware(void) | |||||||
| ISR(TIMER0_COMPA_vect, ISR_BLOCK) | ISR(TIMER0_COMPA_vect, ISR_BLOCK) | ||||||
| { | { | ||||||
| 	uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); | 	uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); | ||||||
| 	 | 
 | ||||||
| 	/* Check that the USB bus is ready for the next sample to read */ | 	/* Check that the USB bus is ready for the next sample to read */ | ||||||
| 	if (Audio_Device_IsSampleReceived(&Speaker_Audio_Interface)) | 	if (Audio_Device_IsSampleReceived(&Speaker_Audio_Interface)) | ||||||
| 	{ | 	{ | ||||||
| @ -128,8 +128,8 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 
 | 
 | ||||||
| 		LEDs_SetAllLEDs(LEDMask); | 		LEDs_SetAllLEDs(LEDMask); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Endpoint_SelectEndpoint(PrevEndpoint);	 | 	Endpoint_SelectEndpoint(PrevEndpoint); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Event handler for the library USB Connection event. */ | /** Event handler for the library USB Connection event. */ | ||||||
| @ -248,10 +248,10 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* | |||||||
| 						CurrentAudioSampleFrequency = (((uint32_t)Data[2] << 16) | ((uint32_t)Data[1] << 8) | (uint32_t)Data[0]); | 						CurrentAudioSampleFrequency = (((uint32_t)Data[2] << 16) | ((uint32_t)Data[1] << 8) | (uint32_t)Data[0]); | ||||||
| 
 | 
 | ||||||
| 						/* Adjust sample reload timer to the new frequency */ | 						/* Adjust sample reload timer to the new frequency */ | ||||||
| 						OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1);				 | 						OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); | ||||||
| 					} | 					} | ||||||
| 					 | 
 | ||||||
| 					return true;				 | 					return true; | ||||||
| 				case AUDIO_REQ_GetCurrent: | 				case AUDIO_REQ_GetCurrent: | ||||||
| 					/* Check if we are just testing for a valid property, or actually reading it */ | 					/* Check if we are just testing for a valid property, or actually reading it */ | ||||||
| 					if (DataLength != NULL) | 					if (DataLength != NULL) | ||||||
| @ -260,13 +260,14 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* | |||||||
| 
 | 
 | ||||||
| 						Data[2] = (CurrentAudioSampleFrequency >> 16); | 						Data[2] = (CurrentAudioSampleFrequency >> 16); | ||||||
| 						Data[1] = (CurrentAudioSampleFrequency >> 8); | 						Data[1] = (CurrentAudioSampleFrequency >> 8); | ||||||
| 						Data[0] = (CurrentAudioSampleFrequency &  0xFF);					 | 						Data[0] = (CurrentAudioSampleFrequency &  0xFF); | ||||||
| 					} | 					} | ||||||
| 					 | 
 | ||||||
| 					return true; | 					return true; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -204,7 +204,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | |||||||
| 
 | 
 | ||||||
| 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), | 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), | ||||||
| 		}, | 		}, | ||||||
| 	 | 
 | ||||||
| 	.Audio_AudioFormatSampleRates = | 	.Audio_AudioFormatSampleRates = | ||||||
| 		{ | 		{ | ||||||
| 			AUDIO_SAMPLE_FREQ(8000), | 			AUDIO_SAMPLE_FREQ(8000), | ||||||
|  | |||||||
| @ -83,3 +83,4 @@ | |||||||
| 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -109,3 +109,4 @@ | |||||||
| 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -145,7 +145,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | |||||||
| { | { | ||||||
| 	uint8_t* Data = (uint8_t*)ReportData; | 	uint8_t* Data = (uint8_t*)ReportData; | ||||||
| 	uint8_t  CurrLEDMask = LEDs_GetLEDs(); | 	uint8_t  CurrLEDMask = LEDs_GetLEDs(); | ||||||
| 		 | 
 | ||||||
| 	Data[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); | 	Data[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); | ||||||
| 	Data[1] = ((CurrLEDMask & LEDS_LED2) ? 1 : 0); | 	Data[1] = ((CurrLEDMask & LEDS_LED2) ? 1 : 0); | ||||||
| 	Data[2] = ((CurrLEDMask & LEDS_LED3) ? 1 : 0); | 	Data[2] = ((CurrLEDMask & LEDS_LED3) ? 1 : 0); | ||||||
| @ -171,7 +171,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | |||||||
| { | { | ||||||
| 	uint8_t* Data = (uint8_t*)ReportData; | 	uint8_t* Data = (uint8_t*)ReportData; | ||||||
| 	uint8_t  NewLEDMask = LEDS_NO_LEDS; | 	uint8_t  NewLEDMask = LEDS_NO_LEDS; | ||||||
| 	 | 
 | ||||||
| 	if (Data[0]) | 	if (Data[0]) | ||||||
| 	  NewLEDMask |= LEDS_LED1; | 	  NewLEDMask |= LEDS_LED1; | ||||||
| 
 | 
 | ||||||
| @ -183,7 +183,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | |||||||
| 
 | 
 | ||||||
| 	if (Data[3]) | 	if (Data[3]) | ||||||
| 	  NewLEDMask |= LEDS_LED1; | 	  NewLEDMask |= LEDS_LED1; | ||||||
| 	   | 
 | ||||||
| 	LEDs_SetAllLEDs(NewLEDMask); | 	LEDs_SetAllLEDs(NewLEDMask); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ | |||||||
|  *  descriptor is parsed by the host and its contents used to determine what data (and in what encoding) |  *  descriptor is parsed by the host and its contents used to determine what data (and in what encoding) | ||||||
|  *  the device will send, and what it may be sent back from the host. Refer to the HID specification for |  *  the device will send, and what it may be sent back from the host. Refer to the HID specification for | ||||||
|  *  more details on HID report descriptors. |  *  more details on HID report descriptors. | ||||||
|  */  |  */ | ||||||
| const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = | const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = | ||||||
| { | { | ||||||
| 	/* Use the HID class driver's standard Joystick report.
 | 	/* Use the HID class driver's standard Joystick report.
 | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ | |||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
|    | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in |   without fee, provided that the above copyright notice appear in | ||||||
|  | |||||||
| @ -279,7 +279,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | |||||||
| 				Address = &ConfigurationDescriptor.HID2_MouseHID; | 				Address = &ConfigurationDescriptor.HID2_MouseHID; | ||||||
| 				Size    = sizeof(USB_HID_Descriptor_HID_t); | 				Size    = sizeof(USB_HID_Descriptor_HID_t); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case HID_DTYPE_Report: | 		case HID_DTYPE_Report: | ||||||
| 			if (!(wIndex)) | 			if (!(wIndex)) | ||||||
|  | |||||||
| @ -258,3 +258,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | |||||||
| 		LEDs_SetAllLEDs(LEDMask); | 		LEDs_SetAllLEDs(LEDMask); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -77,7 +77,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM HIDReport[] = | |||||||
| 	        HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), | 	        HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), | ||||||
| 	    HID_RI_END_COLLECTION(0), | 	    HID_RI_END_COLLECTION(0), | ||||||
| 	HID_RI_END_COLLECTION(0), | 	HID_RI_END_COLLECTION(0), | ||||||
| 	 | 
 | ||||||
| 	/* Keyboard Report */ | 	/* Keyboard Report */ | ||||||
| 	HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ | 	HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ | ||||||
| 	HID_RI_USAGE(8, 0x06), /* Keyboard */ | 	HID_RI_USAGE(8, 0x06), /* Keyboard */ | ||||||
| @ -280,7 +280,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, | |||||||
| 			break; | 			break; | ||||||
| 		case HID_DTYPE_HID: | 		case HID_DTYPE_HID: | ||||||
| 			Address = &ConfigurationDescriptor.HID_HIDData; | 			Address = &ConfigurationDescriptor.HID_HIDData; | ||||||
| 			Size    = sizeof(USB_HID_Descriptor_HID_t);			 | 			Size    = sizeof(USB_HID_Descriptor_HID_t); | ||||||
| 			break; | 			break; | ||||||
| 		case HID_DTYPE_Report: | 		case HID_DTYPE_Report: | ||||||
| 			Address = &HIDReport; | 			Address = &HIDReport; | ||||||
|  | |||||||
| @ -62,7 +62,7 @@ | |||||||
| 
 | 
 | ||||||
| 		/** Size in bytes of each of the HID reporting IN endpoint. */ | 		/** Size in bytes of each of the HID reporting IN endpoint. */ | ||||||
| 		#define HID_EPSIZE                8 | 		#define HID_EPSIZE                8 | ||||||
| 	 | 
 | ||||||
| 	/* Enums: */ | 	/* Enums: */ | ||||||
| 		/** Enum for the HID report IDs used in the device. */ | 		/** Enum for the HID report IDs used in the device. */ | ||||||
| 		enum | 		enum | ||||||
|  | |||||||
| @ -148,7 +148,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | |||||||
| 	uint8_t ButtonStatus_LCL = Buttons_GetStatus(); | 	uint8_t ButtonStatus_LCL = Buttons_GetStatus(); | ||||||
| 
 | 
 | ||||||
| 	if (!(ButtonStatus_LCL & BUTTONS_BUTTON1)) | 	if (!(ButtonStatus_LCL & BUTTONS_BUTTON1)) | ||||||
| 	{		 | 	{ | ||||||
| 		USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; | 		USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; | ||||||
| 
 | 
 | ||||||
| 		KeyboardReport->Modifier = HID_KEYBOARD_MODIFIER_LEFTSHIFT; | 		KeyboardReport->Modifier = HID_KEYBOARD_MODIFIER_LEFTSHIFT; | ||||||
| @ -221,3 +221,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | |||||||
| 
 | 
 | ||||||
| 	LEDs_SetAllLEDs(LEDMask); | 	LEDs_SetAllLEDs(LEDMask); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa | |||||||
| 		               SCSI_ASENSE_WRITE_PROTECTED, | 		               SCSI_ASENSE_WRITE_PROTECTED, | ||||||
| 		               SCSI_ASENSEQ_NO_QUALIFIER); | 		               SCSI_ASENSEQ_NO_QUALIFIER); | ||||||
| 
 | 
 | ||||||
| 		return false;		 | 		return false; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */ | 	/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */ | ||||||
| @ -311,7 +311,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa | |||||||
| 	/* Adjust the given block address to the real media address based on the selected LUN */ | 	/* Adjust the given block address to the real media address based on the selected LUN */ | ||||||
| 	BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS); | 	BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS); | ||||||
| 	#endif | 	#endif | ||||||
| 	 | 
 | ||||||
| 	/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ | 	/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ | ||||||
| 	if (IsDataRead == DATA_READ) | 	if (IsDataRead == DATA_READ) | ||||||
| 	  DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks); | 	  DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks); | ||||||
| @ -345,3 +345,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac | |||||||
| 
 | 
 | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -73,7 +73,7 @@ | |||||||
| 
 | 
 | ||||||
| 		/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */ | 		/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */ | ||||||
| 		#define LUN_MEDIA_BLOCKS         (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) | 		#define LUN_MEDIA_BLOCKS         (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) | ||||||
| 		 | 
 | ||||||
| 		/** Indicates if the disk is write protected or not. */ | 		/** Indicates if the disk is write protected or not. */ | ||||||
| 		#define DISK_READ_ONLY            false | 		#define DISK_READ_ONLY            false | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa | |||||||
| 		               SCSI_ASENSE_WRITE_PROTECTED, | 		               SCSI_ASENSE_WRITE_PROTECTED, | ||||||
| 		               SCSI_ASENSEQ_NO_QUALIFIER); | 		               SCSI_ASENSEQ_NO_QUALIFIER); | ||||||
| 
 | 
 | ||||||
| 		return false;		 | 		return false; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */ | 	/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */ | ||||||
| @ -345,3 +345,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac | |||||||
| 
 | 
 | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -81,7 +81,7 @@ | |||||||
| 
 | 
 | ||||||
| 		/** Indicates if the disk is write protected or not. */ | 		/** Indicates if the disk is write protected or not. */ | ||||||
| 		#define DISK_READ_ONLY           false | 		#define DISK_READ_ONLY           false | ||||||
| 		 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void SetupHardware(void); | 		void SetupHardware(void); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -87,16 +87,16 @@ int main(void) | |||||||
| 		if (RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface)) | 		if (RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface)) | ||||||
| 		{ | 		{ | ||||||
| 			LEDs_SetAllLEDs(LEDMASK_USB_BUSY); | 			LEDs_SetAllLEDs(LEDMASK_USB_BUSY); | ||||||
| 			 | 
 | ||||||
| 			RNDIS_Device_ReadPacket(&Ethernet_RNDIS_Interface, &FrameIN.FrameData, &FrameIN.FrameLength); | 			RNDIS_Device_ReadPacket(&Ethernet_RNDIS_Interface, &FrameIN.FrameData, &FrameIN.FrameLength); | ||||||
| 			Ethernet_ProcessPacket(&FrameIN, &FrameOUT); | 			Ethernet_ProcessPacket(&FrameIN, &FrameOUT); | ||||||
| 			 | 
 | ||||||
| 			if (FrameOUT.FrameLength) | 			if (FrameOUT.FrameLength) | ||||||
| 			{ | 			{ | ||||||
| 				RNDIS_Device_SendPacket(&Ethernet_RNDIS_Interface, &FrameOUT.FrameData, FrameOUT.FrameLength);				 | 				RNDIS_Device_SendPacket(&Ethernet_RNDIS_Interface, &FrameOUT.FrameData, FrameOUT.FrameLength); | ||||||
| 				FrameOUT.FrameLength = 0; | 				FrameOUT.FrameLength = 0; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			LEDs_SetAllLEDs(LEDMASK_USB_READY); | 			LEDs_SetAllLEDs(LEDMASK_USB_READY); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa | |||||||
| 		               SCSI_ASENSE_WRITE_PROTECTED, | 		               SCSI_ASENSE_WRITE_PROTECTED, | ||||||
| 		               SCSI_ASENSEQ_NO_QUALIFIER); | 		               SCSI_ASENSEQ_NO_QUALIFIER); | ||||||
| 
 | 
 | ||||||
| 		return false;		 | 		return false; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */ | 	/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */ | ||||||
| @ -311,7 +311,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa | |||||||
| 	/* Adjust the given block address to the real media address based on the selected LUN */ | 	/* Adjust the given block address to the real media address based on the selected LUN */ | ||||||
| 	BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS); | 	BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS); | ||||||
| 	#endif | 	#endif | ||||||
| 	 | 
 | ||||||
| 	/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ | 	/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ | ||||||
| 	if (IsDataRead == DATA_READ) | 	if (IsDataRead == DATA_READ) | ||||||
| 	  DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks); | 	  DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks); | ||||||
| @ -345,3 +345,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac | |||||||
| 
 | 
 | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -59,7 +59,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = | |||||||
| 				.NotificationEndpointDoubleBank = false, | 				.NotificationEndpointDoubleBank = false, | ||||||
| 			}, | 			}, | ||||||
| 	}; | 	}; | ||||||
| 	 | 
 | ||||||
| /** LUFA Mass Storage Class driver interface configuration and state information. This structure is
 | /** LUFA Mass Storage Class driver interface configuration and state information. This structure is
 | ||||||
|  *  passed to all Mass Storage Class driver functions, so that multiple instances of the same class |  *  passed to all Mass Storage Class driver functions, so that multiple instances of the same class | ||||||
|  *  within a device can be differentiated from one another. |  *  within a device can be differentiated from one another. | ||||||
| @ -211,3 +211,4 @@ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSI | |||||||
| 
 | 
 | ||||||
| 	return CommandSuccess; | 	return CommandSuccess; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ | |||||||
| 
 | 
 | ||||||
| 		#include "Lib/SCSI.h" | 		#include "Lib/SCSI.h" | ||||||
| 		#include "Lib/DataflashManager.h" | 		#include "Lib/DataflashManager.h" | ||||||
| 		 | 
 | ||||||
| 		#include <LUFA/Version.h> | 		#include <LUFA/Version.h> | ||||||
| 		#include <LUFA/Drivers/Board/LEDs.h> | 		#include <LUFA/Drivers/Board/LEDs.h> | ||||||
| 		#include <LUFA/Drivers/Board/Joystick.h> | 		#include <LUFA/Drivers/Board/Joystick.h> | ||||||
| @ -74,7 +74,7 @@ | |||||||
| 
 | 
 | ||||||
| 		/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */ | 		/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */ | ||||||
| 		#define LUN_MEDIA_BLOCKS         (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) | 		#define LUN_MEDIA_BLOCKS         (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) | ||||||
| 		 | 
 | ||||||
| 		/** Indicates if the disk is write protected or not. */ | 		/** Indicates if the disk is write protected or not. */ | ||||||
| 		#define DISK_READ_ONLY            false | 		#define DISK_READ_ONLY            false | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t Config; | 			USB_Descriptor_Configuration_Header_t Config; | ||||||
| 			 | 
 | ||||||
| 			// SideShow Interface
 | 			// SideShow Interface
 | ||||||
| 			USB_Descriptor_Interface_t            SSHOW_Interface; | 			USB_Descriptor_Interface_t            SSHOW_Interface; | ||||||
| 			USB_Descriptor_Endpoint_t             SSHOW_DataInEndpoint; | 			USB_Descriptor_Endpoint_t             SSHOW_DataInEndpoint; | ||||||
|  | |||||||
| @ -102,3 +102,4 @@ | |||||||
| 		void     SideShow_Discard_Byte_Stream(void); | 		void     SideShow_Discard_Byte_Stream(void); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -125,3 +125,4 @@ | |||||||
| 		#endif | 		#endif | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| /*
 | /*
 | ||||||
|              LUFA Library |              LUFA Library | ||||||
|      Copyright (C) Dean Camera, 2011. |      Copyright (C) Dean Camera, 2011. | ||||||
|                | 
 | ||||||
|   dean [at] fourwalledcubicle [dot] com |   dean [at] fourwalledcubicle [dot] com | ||||||
|            www.lufa-lib.org |            www.lufa-lib.org | ||||||
| */ | */ | ||||||
| @ -9,13 +9,13 @@ | |||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
| 
 | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this  |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in  |   without fee, provided that the above copyright notice appear in | ||||||
|   all copies and that both that the copyright notice and this |   all copies and that both that the copyright notice and this | ||||||
|   permission notice and warranty disclaimer appear in supporting  |   permission notice and warranty disclaimer appear in supporting | ||||||
|   documentation, and that the name of the author not be used in  |   documentation, and that the name of the author not be used in | ||||||
|   advertising or publicity pertaining to distribution of the  |   advertising or publicity pertaining to distribution of the | ||||||
|   software without specific, written prior permission. |   software without specific, written prior permission. | ||||||
| 
 | 
 | ||||||
|   The author disclaim all warranties with regard to this |   The author disclaim all warranties with regard to this | ||||||
| @ -38,7 +38,7 @@ TMC_Capabilities_t Capabilities = | |||||||
| 	{ | 	{ | ||||||
| 		.Status     = TMC_STATUS_SUCCESS, | 		.Status     = TMC_STATUS_SUCCESS, | ||||||
| 		.TMCVersion = VERSION_BCD(1.00), | 		.TMCVersion = VERSION_BCD(1.00), | ||||||
| 		 | 
 | ||||||
| 		.Interface  = | 		.Interface  = | ||||||
| 			{ | 			{ | ||||||
| 				.ListenOnly             = false, | 				.ListenOnly             = false, | ||||||
| @ -82,7 +82,7 @@ int main(void) | |||||||
| 
 | 
 | ||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); | 	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); | ||||||
| 	sei(); | 	sei(); | ||||||
| 	 | 
 | ||||||
| 	for (;;) | 	for (;;) | ||||||
| 	{ | 	{ | ||||||
| 		TMC_Task(); | 		TMC_Task(); | ||||||
| @ -99,7 +99,7 @@ void SetupHardware(void) | |||||||
| 
 | 
 | ||||||
| 	/* Disable clock division */ | 	/* Disable clock division */ | ||||||
| 	clock_prescale_set(clock_div_1); | 	clock_prescale_set(clock_div_1); | ||||||
| 	 | 
 | ||||||
| 	/* Hardware Initialization */ | 	/* Hardware Initialization */ | ||||||
| 	LEDs_Init(); | 	LEDs_Init(); | ||||||
| 	USB_Init(); | 	USB_Init(); | ||||||
| @ -167,43 +167,43 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				{ | 				{ | ||||||
| 					/* Indicate that all in-progress/pending data OUT requests should be aborted */ | 					/* Indicate that all in-progress/pending data OUT requests should be aborted */ | ||||||
| 					IsTMCBulkOUTReset = true; | 					IsTMCBulkOUTReset = true; | ||||||
| 					 | 
 | ||||||
| 					/* Save the split request for later checking when a new request is received */ | 					/* Save the split request for later checking when a new request is received */ | ||||||
| 					RequestInProgress = Req_InitiateAbortBulkOut; | 					RequestInProgress = Req_InitiateAbortBulkOut; | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearSETUP(); | 				Endpoint_ClearSETUP(); | ||||||
| 				 | 
 | ||||||
| 				/* Write the request response byte */ | 				/* Write the request response byte */ | ||||||
| 				Endpoint_Write_8(TMCRequestStatus); | 				Endpoint_Write_8(TMCRequestStatus); | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearIN(); | 				Endpoint_ClearIN(); | ||||||
| 				Endpoint_ClearStatusStage(); | 				Endpoint_ClearStatusStage(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case Req_CheckAbortBulkOutStatus: | 		case Req_CheckAbortBulkOutStatus: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | ||||||
| 			{ | 			{ | ||||||
| 				/* Check that an ABORT BULK OUT transaction has been requested and that the request has completed */ | 				/* Check that an ABORT BULK OUT transaction has been requested and that the request has completed */ | ||||||
| 				if (RequestInProgress != Req_InitiateAbortBulkOut) | 				if (RequestInProgress != Req_InitiateAbortBulkOut) | ||||||
| 				  TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS;				 | 				  TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS; | ||||||
| 				else if (IsTMCBulkOUTReset) | 				else if (IsTMCBulkOUTReset) | ||||||
| 				  TMCRequestStatus = TMC_STATUS_PENDING; | 				  TMCRequestStatus = TMC_STATUS_PENDING; | ||||||
| 				else | 				else | ||||||
| 				  RequestInProgress = 0;	 | 				  RequestInProgress = 0; | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearSETUP(); | 				Endpoint_ClearSETUP(); | ||||||
| 								 | 
 | ||||||
| 				/* Write the request response bytes */ | 				/* Write the request response bytes */ | ||||||
| 				Endpoint_Write_8(TMCRequestStatus); | 				Endpoint_Write_8(TMCRequestStatus); | ||||||
| 				Endpoint_Write_16_LE(0); | 				Endpoint_Write_16_LE(0); | ||||||
| 				Endpoint_Write_32_LE(LastTransferLength); | 				Endpoint_Write_32_LE(LastTransferLength); | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearIN(); | 				Endpoint_ClearIN(); | ||||||
| 				Endpoint_ClearStatusStage();				 | 				Endpoint_ClearStatusStage(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case Req_InitiateAbortBulkIn: | 		case Req_InitiateAbortBulkIn: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | ||||||
| @ -211,7 +211,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Check that no split transaction is already in progress and the data transfer tag is valid */ | 				/* Check that no split transaction is already in progress and the data transfer tag is valid */ | ||||||
| 				if (RequestInProgress != 0) | 				if (RequestInProgress != 0) | ||||||
| 				{ | 				{ | ||||||
| 					TMCRequestStatus = TMC_STATUS_SPLIT_IN_PROGRESS;				 | 					TMCRequestStatus = TMC_STATUS_SPLIT_IN_PROGRESS; | ||||||
| 				} | 				} | ||||||
| 				else if (USB_ControlRequest.wValue != CurrentTransferTag) | 				else if (USB_ControlRequest.wValue != CurrentTransferTag) | ||||||
| 				{ | 				{ | ||||||
| @ -221,13 +221,13 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				{ | 				{ | ||||||
| 					/* Indicate that all in-progress/pending data IN requests should be aborted */ | 					/* Indicate that all in-progress/pending data IN requests should be aborted */ | ||||||
| 					IsTMCBulkINReset = true; | 					IsTMCBulkINReset = true; | ||||||
| 					 | 
 | ||||||
| 					/* Save the split request for later checking when a new request is received */ | 					/* Save the split request for later checking when a new request is received */ | ||||||
| 					RequestInProgress = Req_InitiateAbortBulkIn; | 					RequestInProgress = Req_InitiateAbortBulkIn; | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearSETUP(); | 				Endpoint_ClearSETUP(); | ||||||
| 				 | 
 | ||||||
| 				/* Write the request response bytes */ | 				/* Write the request response bytes */ | ||||||
| 				Endpoint_Write_8(TMCRequestStatus); | 				Endpoint_Write_8(TMCRequestStatus); | ||||||
| 				Endpoint_Write_8(CurrentTransferTag); | 				Endpoint_Write_8(CurrentTransferTag); | ||||||
| @ -235,7 +235,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				Endpoint_ClearIN(); | 				Endpoint_ClearIN(); | ||||||
| 				Endpoint_ClearStatusStage(); | 				Endpoint_ClearStatusStage(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case Req_CheckAbortBulkInStatus: | 		case Req_CheckAbortBulkInStatus: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | ||||||
| @ -249,7 +249,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				  RequestInProgress = 0; | 				  RequestInProgress = 0; | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearSETUP(); | 				Endpoint_ClearSETUP(); | ||||||
| 								 | 
 | ||||||
| 				/* Write the request response bytes */ | 				/* Write the request response bytes */ | ||||||
| 				Endpoint_Write_8(TMCRequestStatus); | 				Endpoint_Write_8(TMCRequestStatus); | ||||||
| 				Endpoint_Write_16_LE(0); | 				Endpoint_Write_16_LE(0); | ||||||
| @ -258,7 +258,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				Endpoint_ClearIN(); | 				Endpoint_ClearIN(); | ||||||
| 				Endpoint_ClearStatusStage(); | 				Endpoint_ClearStatusStage(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case Req_InitiateClear: | 		case Req_InitiateClear: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) | ||||||
| @ -266,34 +266,34 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Check that no split transaction is already in progress */ | 				/* Check that no split transaction is already in progress */ | ||||||
| 				if (RequestInProgress != 0) | 				if (RequestInProgress != 0) | ||||||
| 				{ | 				{ | ||||||
| 					Endpoint_Write_8(TMC_STATUS_SPLIT_IN_PROGRESS);				 | 					Endpoint_Write_8(TMC_STATUS_SPLIT_IN_PROGRESS); | ||||||
| 				} | 				} | ||||||
| 				else | 				else | ||||||
| 				{ | 				{ | ||||||
| 					/* Indicate that all in-progress/pending data IN and OUT requests should be aborted */ | 					/* Indicate that all in-progress/pending data IN and OUT requests should be aborted */ | ||||||
| 					IsTMCBulkINReset  = true; | 					IsTMCBulkINReset  = true; | ||||||
| 					IsTMCBulkOUTReset = true; | 					IsTMCBulkOUTReset = true; | ||||||
| 					 | 
 | ||||||
| 					/* Save the split request for later checking when a new request is received */ | 					/* Save the split request for later checking when a new request is received */ | ||||||
| 					RequestInProgress = Req_InitiateClear; | 					RequestInProgress = Req_InitiateClear; | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearSETUP(); | 				Endpoint_ClearSETUP(); | ||||||
| 				 | 
 | ||||||
| 				/* Write the request response byte */ | 				/* Write the request response byte */ | ||||||
| 				Endpoint_Write_8(TMCRequestStatus); | 				Endpoint_Write_8(TMCRequestStatus); | ||||||
| 
 | 
 | ||||||
| 				Endpoint_ClearIN(); | 				Endpoint_ClearIN(); | ||||||
| 				Endpoint_ClearStatusStage(); | 				Endpoint_ClearStatusStage(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case Req_CheckClearStatus: | 		case Req_CheckClearStatus: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) | ||||||
| 			{ | 			{ | ||||||
| 				/* Check that a CLEAR transaction has been requested and that the request has completed */ | 				/* Check that a CLEAR transaction has been requested and that the request has completed */ | ||||||
| 				if (RequestInProgress != Req_InitiateClear) | 				if (RequestInProgress != Req_InitiateClear) | ||||||
| 				  TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS;				 | 				  TMCRequestStatus = TMC_STATUS_SPLIT_NOT_IN_PROGRESS; | ||||||
| 				else if (IsTMCBulkINReset || IsTMCBulkOUTReset) | 				else if (IsTMCBulkINReset || IsTMCBulkOUTReset) | ||||||
| 				  TMCRequestStatus = TMC_STATUS_PENDING; | 				  TMCRequestStatus = TMC_STATUS_PENDING; | ||||||
| 				else | 				else | ||||||
| @ -304,22 +304,22 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Write the request response bytes */ | 				/* Write the request response bytes */ | ||||||
| 				Endpoint_Write_8(TMCRequestStatus); | 				Endpoint_Write_8(TMCRequestStatus); | ||||||
| 				Endpoint_Write_8(0); | 				Endpoint_Write_8(0); | ||||||
| 				 | 
 | ||||||
| 				Endpoint_ClearIN(); | 				Endpoint_ClearIN(); | ||||||
| 				Endpoint_ClearStatusStage();				 | 				Endpoint_ClearStatusStage(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case Req_GetCapabilities: | 		case Req_GetCapabilities: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) | ||||||
| 			{ | 			{ | ||||||
| 				Endpoint_ClearSETUP(); | 				Endpoint_ClearSETUP(); | ||||||
| 					 | 
 | ||||||
| 				/* Write the device capabilities to the control endpoint */ | 				/* Write the device capabilities to the control endpoint */ | ||||||
| 				Endpoint_Write_Control_Stream_LE(&Capabilities, sizeof(TMC_Capabilities_t));				 | 				Endpoint_Write_Control_Stream_LE(&Capabilities, sizeof(TMC_Capabilities_t)); | ||||||
| 				Endpoint_ClearOUT(); | 				Endpoint_ClearOUT(); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -351,16 +351,16 @@ void TMC_Task(void) | |||||||
| 	/* Device must be connected and configured for the task to run */ | 	/* Device must be connected and configured for the task to run */ | ||||||
| 	if (USB_DeviceState != DEVICE_STATE_Configured) | 	if (USB_DeviceState != DEVICE_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	 | 
 | ||||||
| 	TMC_MessageHeader_t MessageHeader; | 	TMC_MessageHeader_t MessageHeader; | ||||||
| 	uint8_t             MessagePayload[128]; | 	uint8_t             MessagePayload[128]; | ||||||
| 	 | 
 | ||||||
| 	/* Try to read in a TMC message from the interface, process if one is available */ | 	/* Try to read in a TMC message from the interface, process if one is available */ | ||||||
| 	if (ReadTMCHeader(&MessageHeader)) | 	if (ReadTMCHeader(&MessageHeader)) | ||||||
| 	{ | 	{ | ||||||
| 		/* Indicate busy */ | 		/* Indicate busy */ | ||||||
| 		LEDs_SetAllLEDs(LEDMASK_USB_BUSY); | 		LEDs_SetAllLEDs(LEDMASK_USB_BUSY); | ||||||
| 		 | 
 | ||||||
| 		switch (MessageHeader.MessageID) | 		switch (MessageHeader.MessageID) | ||||||
| 		{ | 		{ | ||||||
| 			case TMC_MESSAGEID_DEV_DEP_MSG_OUT: | 			case TMC_MESSAGEID_DEV_DEP_MSG_OUT: | ||||||
| @ -371,15 +371,15 @@ void TMC_Task(void) | |||||||
| 					if (IsTMCBulkOUTReset) | 					if (IsTMCBulkOUTReset) | ||||||
| 					  break; | 					  break; | ||||||
| 				} | 				} | ||||||
| 				 | 
 | ||||||
| 				Endpoint_ClearOUT(); | 				Endpoint_ClearOUT(); | ||||||
| 
 | 
 | ||||||
| 				ProcessSentMessage(MessagePayload, LastTransferLength);				 | 				ProcessSentMessage(MessagePayload, LastTransferLength); | ||||||
| 				break; | 				break; | ||||||
| 			case TMC_MESSAGEID_DEV_DEP_MSG_IN: | 			case TMC_MESSAGEID_DEV_DEP_MSG_IN: | ||||||
| 				Endpoint_ClearOUT(); | 				Endpoint_ClearOUT(); | ||||||
| 				 | 
 | ||||||
| 				MessageHeader.TransferSize = GetNextMessage(MessagePayload);				 | 				MessageHeader.TransferSize = GetNextMessage(MessagePayload); | ||||||
| 				MessageHeader.MessageIDSpecific.DeviceOUT.LastMessageTransaction = true; | 				MessageHeader.MessageIDSpecific.DeviceOUT.LastMessageTransaction = true; | ||||||
| 				WriteTMCHeader(&MessageHeader); | 				WriteTMCHeader(&MessageHeader); | ||||||
| 
 | 
 | ||||||
| @ -400,7 +400,7 @@ void TMC_Task(void) | |||||||
| 
 | 
 | ||||||
| 		LEDs_SetAllLEDs(LEDMASK_USB_READY); | 		LEDs_SetAllLEDs(LEDMASK_USB_READY); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	/* All pending data has been processed - reset the data abort flags */ | 	/* All pending data has been processed - reset the data abort flags */ | ||||||
| 	IsTMCBulkINReset  = false; | 	IsTMCBulkINReset  = false; | ||||||
| 	IsTMCBulkOUTReset = false; | 	IsTMCBulkOUTReset = false; | ||||||
| @ -419,11 +419,11 @@ bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader) | |||||||
| 
 | 
 | ||||||
| 	/* Select the Data Out endpoint */ | 	/* Select the Data Out endpoint */ | ||||||
| 	Endpoint_SelectEndpoint(TMC_OUT_EPNUM); | 	Endpoint_SelectEndpoint(TMC_OUT_EPNUM); | ||||||
| 	 | 
 | ||||||
| 	/* Abort if no command has been sent from the host */ | 	/* Abort if no command has been sent from the host */ | ||||||
| 	if (!(Endpoint_IsOUTReceived())) | 	if (!(Endpoint_IsOUTReceived())) | ||||||
| 	  return false; | 	  return false; | ||||||
| 	 | 
 | ||||||
| 	/* Read in the header of the command from the host */ | 	/* Read in the header of the command from the host */ | ||||||
| 	BytesTransferred = 0; | 	BytesTransferred = 0; | ||||||
| 	while ((ErrorCode = Endpoint_Read_Stream_LE(MessageHeader, sizeof(TMC_MessageHeader_t), &BytesTransferred)) == | 	while ((ErrorCode = Endpoint_Read_Stream_LE(MessageHeader, sizeof(TMC_MessageHeader_t), &BytesTransferred)) == | ||||||
| @ -435,7 +435,7 @@ bool ReadTMCHeader(TMC_MessageHeader_t* const MessageHeader) | |||||||
| 
 | 
 | ||||||
| 	/* Store the new command tag value for later use */ | 	/* Store the new command tag value for later use */ | ||||||
| 	CurrentTransferTag = MessageHeader->Tag; | 	CurrentTransferTag = MessageHeader->Tag; | ||||||
| 	 | 
 | ||||||
| 	/* Indicate if the command has been aborted or not */ | 	/* Indicate if the command has been aborted or not */ | ||||||
| 	return (!(IsTMCBulkOUTReset) && (ErrorCode == ENDPOINT_RWSTREAM_NoError)); | 	return (!(IsTMCBulkOUTReset) && (ErrorCode == ENDPOINT_RWSTREAM_NoError)); | ||||||
| } | } | ||||||
| @ -464,3 +464,4 @@ bool WriteTMCHeader(TMC_MessageHeader_t* const MessageHeader) | |||||||
| 	/* Indicate if the command has been aborted or not */ | 	/* Indicate if the command has been aborted or not */ | ||||||
| 	return (!(IsTMCBulkINReset) && (ErrorCode == ENDPOINT_RWSTREAM_NoError)); | 	return (!(IsTMCBulkINReset) && (ErrorCode == ENDPOINT_RWSTREAM_NoError)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -163,16 +163,16 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Extract out the relevant request information to get the target Endpoint address and control being set */ | 				/* Extract out the relevant request information to get the target Endpoint address and control being set */ | ||||||
| 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | ||||||
| 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | ||||||
| 				 | 
 | ||||||
| 				/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */ | 				/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */ | ||||||
| 				if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | 				if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | ||||||
| 				{ | 				{ | ||||||
| 					uint8_t SampleRate[3]; | 					uint8_t SampleRate[3]; | ||||||
| 				 | 
 | ||||||
| 					Endpoint_ClearSETUP(); | 					Endpoint_ClearSETUP(); | ||||||
| 					Endpoint_Read_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | 					Endpoint_Read_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | ||||||
| 					Endpoint_ClearIN(); | 					Endpoint_ClearIN(); | ||||||
| 					 | 
 | ||||||
| 					/* Set the new sampling frequency to the value given by the host */ | 					/* Set the new sampling frequency to the value given by the host */ | ||||||
| 					CurrentAudioSampleFrequency = (((uint32_t)SampleRate[2] << 16) | ((uint32_t)SampleRate[1] << 8) | (uint32_t)SampleRate[0]); | 					CurrentAudioSampleFrequency = (((uint32_t)SampleRate[2] << 16) | ((uint32_t)SampleRate[1] << 8) | (uint32_t)SampleRate[0]); | ||||||
| 
 | 
 | ||||||
| @ -180,7 +180,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 					OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); | 					OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case AUDIO_REQ_GetCurrent: | 		case AUDIO_REQ_GetCurrent: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) | ||||||
| @ -188,20 +188,20 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Extract out the relevant request information to get the target Endpoint address and control being retrieved */ | 				/* Extract out the relevant request information to get the target Endpoint address and control being retrieved */ | ||||||
| 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | ||||||
| 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | ||||||
| 				 | 
 | ||||||
| 				/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */ | 				/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */ | ||||||
| 				if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | 				if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | ||||||
| 				{ | 				{ | ||||||
| 					uint8_t SampleRate[3]; | 					uint8_t SampleRate[3]; | ||||||
| 					 | 
 | ||||||
| 					/* Convert the sampling rate value into the 24-bit format the host expects for the property */ | 					/* Convert the sampling rate value into the 24-bit format the host expects for the property */ | ||||||
| 					SampleRate[2] = (CurrentAudioSampleFrequency >> 16); | 					SampleRate[2] = (CurrentAudioSampleFrequency >> 16); | ||||||
| 					SampleRate[1] = (CurrentAudioSampleFrequency >> 8); | 					SampleRate[1] = (CurrentAudioSampleFrequency >> 8); | ||||||
| 					SampleRate[0] = (CurrentAudioSampleFrequency &  0xFF); | 					SampleRate[0] = (CurrentAudioSampleFrequency &  0xFF); | ||||||
| 				 | 
 | ||||||
| 					Endpoint_ClearSETUP(); | 					Endpoint_ClearSETUP(); | ||||||
| 					Endpoint_Write_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | 					Endpoint_Write_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | ||||||
| 					Endpoint_ClearOUT();					 | 					Endpoint_ClearOUT(); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| @ -225,11 +225,11 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 		#if defined(USE_TEST_TONE) | 		#if defined(USE_TEST_TONE) | ||||||
| 			static uint8_t SquareWaveSampleCount; | 			static uint8_t SquareWaveSampleCount; | ||||||
| 			static int16_t CurrentWaveValue; | 			static int16_t CurrentWaveValue; | ||||||
| 			 | 
 | ||||||
| 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | ||||||
| 			if (SquareWaveSampleCount++ == 0xFF) | 			if (SquareWaveSampleCount++ == 0xFF) | ||||||
| 			  CurrentWaveValue ^= 0x8000; | 			  CurrentWaveValue ^= 0x8000; | ||||||
| 			 | 
 | ||||||
| 			/* Only generate audio if the board button is being pressed */ | 			/* Only generate audio if the board button is being pressed */ | ||||||
| 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | ||||||
| 		#else | 		#else | ||||||
| @ -239,7 +239,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 			#if defined(MICROPHONE_BIASED_TO_HALF_RAIL) | 			#if defined(MICROPHONE_BIASED_TO_HALF_RAIL) | ||||||
| 			/* Microphone is biased to half rail voltage, subtract the bias from the sample value */ | 			/* Microphone is biased to half rail voltage, subtract the bias from the sample value */ | ||||||
| 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | ||||||
| 			#endif		 | 			#endif | ||||||
| 		#endif | 		#endif | ||||||
| 
 | 
 | ||||||
| 		/* Write the sample to the buffer */ | 		/* Write the sample to the buffer */ | ||||||
|  | |||||||
| @ -204,7 +204,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | |||||||
| 
 | 
 | ||||||
| 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), | 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), | ||||||
| 		}, | 		}, | ||||||
| 	 | 
 | ||||||
| 	.Audio_AudioFormatSampleRates = | 	.Audio_AudioFormatSampleRates = | ||||||
| 		{ | 		{ | ||||||
| 			AUDIO_SAMPLE_FREQ(8000), | 			AUDIO_SAMPLE_FREQ(8000), | ||||||
|  | |||||||
| @ -189,16 +189,16 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Extract out the relevant request information to get the target Endpoint address and control being set */ | 				/* Extract out the relevant request information to get the target Endpoint address and control being set */ | ||||||
| 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | ||||||
| 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | ||||||
| 				 | 
 | ||||||
| 				/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */ | 				/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */ | ||||||
| 				if ((EndpointAddress == (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | 				if ((EndpointAddress == (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | ||||||
| 				{ | 				{ | ||||||
| 					uint8_t SampleRate[3]; | 					uint8_t SampleRate[3]; | ||||||
| 				 | 
 | ||||||
| 					Endpoint_ClearSETUP(); | 					Endpoint_ClearSETUP(); | ||||||
| 					Endpoint_Read_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | 					Endpoint_Read_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | ||||||
| 					Endpoint_ClearOUT(); | 					Endpoint_ClearOUT(); | ||||||
| 					 | 
 | ||||||
| 					/* Set the new sampling frequency to the value given by the host */ | 					/* Set the new sampling frequency to the value given by the host */ | ||||||
| 					CurrentAudioSampleFrequency = (((uint32_t)SampleRate[2] << 16) | ((uint32_t)SampleRate[1] << 8) | (uint32_t)SampleRate[0]); | 					CurrentAudioSampleFrequency = (((uint32_t)SampleRate[2] << 16) | ((uint32_t)SampleRate[1] << 8) | (uint32_t)SampleRate[0]); | ||||||
| 
 | 
 | ||||||
| @ -206,7 +206,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 					OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); | 					OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			break; | 			break; | ||||||
| 		case AUDIO_REQ_GetCurrent: | 		case AUDIO_REQ_GetCurrent: | ||||||
| 			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)) | 			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)) | ||||||
| @ -214,20 +214,20 @@ void EVENT_USB_Device_ControlRequest(void) | |||||||
| 				/* Extract out the relevant request information to get the target Endpoint address and control being retrieved */ | 				/* Extract out the relevant request information to get the target Endpoint address and control being retrieved */ | ||||||
| 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | 				uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; | ||||||
| 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | 				uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); | ||||||
| 				 | 
 | ||||||
| 				/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */ | 				/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */ | ||||||
| 				if ((EndpointAddress == (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | 				if ((EndpointAddress == (ENDPOINT_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) | ||||||
| 				{ | 				{ | ||||||
| 					uint8_t SampleRate[3]; | 					uint8_t SampleRate[3]; | ||||||
| 					 | 
 | ||||||
| 					/* Convert the sampling rate value into the 24-bit format the host expects for the property */ | 					/* Convert the sampling rate value into the 24-bit format the host expects for the property */ | ||||||
| 					SampleRate[2] = (CurrentAudioSampleFrequency >> 16); | 					SampleRate[2] = (CurrentAudioSampleFrequency >> 16); | ||||||
| 					SampleRate[1] = (CurrentAudioSampleFrequency >> 8); | 					SampleRate[1] = (CurrentAudioSampleFrequency >> 8); | ||||||
| 					SampleRate[0] = (CurrentAudioSampleFrequency &  0xFF); | 					SampleRate[0] = (CurrentAudioSampleFrequency &  0xFF); | ||||||
| 				 | 
 | ||||||
| 					Endpoint_ClearSETUP(); | 					Endpoint_ClearSETUP(); | ||||||
| 					Endpoint_Write_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | 					Endpoint_Write_Control_Stream_LE(SampleRate, sizeof(SampleRate)); | ||||||
| 					Endpoint_ClearOUT();					 | 					Endpoint_ClearOUT(); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| @ -286,7 +286,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 
 | 
 | ||||||
| 		LEDs_SetAllLEDs(LEDMask); | 		LEDs_SetAllLEDs(LEDMask); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Endpoint_SelectEndpoint(PrevEndpoint); | 	Endpoint_SelectEndpoint(PrevEndpoint); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -204,7 +204,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | |||||||
| 
 | 
 | ||||||
| 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), | 			.TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), | ||||||
| 		}, | 		}, | ||||||
| 	 | 
 | ||||||
| 	.Audio_AudioFormatSampleRates = | 	.Audio_AudioFormatSampleRates = | ||||||
| 		{ | 		{ | ||||||
| 			AUDIO_SAMPLE_FREQ(8000), | 			AUDIO_SAMPLE_FREQ(8000), | ||||||
|  | |||||||
| @ -83,3 +83,4 @@ | |||||||
| 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -109,3 +109,4 @@ | |||||||
| 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -157,7 +157,7 @@ void ProcessGenericHIDReport(uint8_t* DataArray) | |||||||
| 		holding the report sent from the host. | 		holding the report sent from the host. | ||||||
| 	*/ | 	*/ | ||||||
| 
 | 
 | ||||||
| 	uint8_t NewLEDMask = LEDS_NO_LEDS;	 | 	uint8_t NewLEDMask = LEDS_NO_LEDS; | ||||||
| 
 | 
 | ||||||
| 	if (DataArray[0]) | 	if (DataArray[0]) | ||||||
| 	  NewLEDMask |= LEDS_LED1; | 	  NewLEDMask |= LEDS_LED1; | ||||||
| @ -170,7 +170,7 @@ void ProcessGenericHIDReport(uint8_t* DataArray) | |||||||
| 
 | 
 | ||||||
| 	if (DataArray[3]) | 	if (DataArray[3]) | ||||||
| 	  NewLEDMask |= LEDS_LED1; | 	  NewLEDMask |= LEDS_LED1; | ||||||
| 	   | 
 | ||||||
| 	LEDs_SetAllLEDs(NewLEDMask); | 	LEDs_SetAllLEDs(NewLEDMask); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -187,7 +187,7 @@ void CreateGenericHIDReport(uint8_t* DataArray) | |||||||
| 	*/ | 	*/ | ||||||
| 
 | 
 | ||||||
| 	uint8_t CurrLEDMask = LEDs_GetLEDs(); | 	uint8_t CurrLEDMask = LEDs_GetLEDs(); | ||||||
| 		 | 
 | ||||||
| 	DataArray[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); | 	DataArray[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); | ||||||
| 	DataArray[1] = ((CurrLEDMask & LEDS_LED2) ? 1 : 0); | 	DataArray[1] = ((CurrLEDMask & LEDS_LED2) ? 1 : 0); | ||||||
| 	DataArray[2] = ((CurrLEDMask & LEDS_LED3) ? 1 : 0); | 	DataArray[2] = ((CurrLEDMask & LEDS_LED3) ? 1 : 0); | ||||||
|  | |||||||
| @ -59,7 +59,7 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t Config; | 			USB_Descriptor_Configuration_Header_t Config; | ||||||
| 			 | 
 | ||||||
| 			// Mass Storage Interface
 | 			// Mass Storage Interface
 | ||||||
| 			USB_Descriptor_Interface_t            MS_Interface; | 			USB_Descriptor_Interface_t            MS_Interface; | ||||||
| 			USB_Descriptor_Endpoint_t             MS_DataInEndpoint; | 			USB_Descriptor_Endpoint_t             MS_DataInEndpoint; | ||||||
|  | |||||||
| @ -287,12 +287,12 @@ static bool SCSI_Command_ReadWrite_10(const bool IsDataRead) | |||||||
| 		               SCSI_ASENSE_WRITE_PROTECTED, | 		               SCSI_ASENSE_WRITE_PROTECTED, | ||||||
| 		               SCSI_ASENSEQ_NO_QUALIFIER); | 		               SCSI_ASENSEQ_NO_QUALIFIER); | ||||||
| 
 | 
 | ||||||
| 		return false;		 | 		return false; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	BlockAddress = SwapEndian_32(*(uint32_t*)&CommandBlock.SCSICommandData[2]); | 	BlockAddress = SwapEndian_32(*(uint32_t*)&CommandBlock.SCSICommandData[2]); | ||||||
| 	TotalBlocks  = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[7]); | 	TotalBlocks  = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[7]); | ||||||
| 	 | 
 | ||||||
| 	/* Check if the block address is outside the maximum allowable value for the LUN */ | 	/* Check if the block address is outside the maximum allowable value for the LUN */ | ||||||
| 	if (BlockAddress >= LUN_MEDIA_BLOCKS) | 	if (BlockAddress >= LUN_MEDIA_BLOCKS) | ||||||
| 	{ | 	{ | ||||||
| @ -340,3 +340,4 @@ static bool SCSI_Command_ModeSense_6(void) | |||||||
| 
 | 
 | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -309,7 +309,8 @@ static void ReturnCommandStatus(void) | |||||||
| 		if (IsMassStoreReset) | 		if (IsMassStoreReset) | ||||||
| 		  return; | 		  return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	/* Finalize the stream transfer to send the last packet */ | 	/* Finalize the stream transfer to send the last packet */ | ||||||
| 	Endpoint_ClearIN(); | 	Endpoint_ClearIN(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t Config; | 			USB_Descriptor_Configuration_Header_t Config; | ||||||
| 			 | 
 | ||||||
| 			// Mouse HID Interface
 | 			// Mouse HID Interface
 | ||||||
| 			USB_Descriptor_Interface_t            HID_Interface; | 			USB_Descriptor_Interface_t            HID_Interface; | ||||||
| 			USB_HID_Descriptor_HID_t              HID_MouseHID; | 			USB_HID_Descriptor_HID_t              HID_MouseHID; | ||||||
|  | |||||||
| @ -73,9 +73,9 @@ void SetupHardware(void) | |||||||
| 	LEDs_Init(); | 	LEDs_Init(); | ||||||
| 	Serial_Init(9600, false); | 	Serial_Init(9600, false); | ||||||
| 	USB_Init(); | 	USB_Init(); | ||||||
| 	 | 
 | ||||||
| 	/* Create a stdio stream for the serial port for stdin and stdout */ | 	/* Create a stdio stream for the serial port for stdin and stdout */ | ||||||
| 	Serial_CreateStream(NULL);	 | 	Serial_CreateStream(NULL); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
 | /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
 | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ | |||||||
| 		typedef struct | 		typedef struct | ||||||
| 		{ | 		{ | ||||||
| 			USB_Descriptor_Configuration_Header_t Config; | 			USB_Descriptor_Configuration_Header_t Config; | ||||||
| 			 | 
 | ||||||
| 			// Mouse HID Interface
 | 			// Mouse HID Interface
 | ||||||
| 			USB_Descriptor_Interface_t            HID_Interface; | 			USB_Descriptor_Interface_t            HID_Interface; | ||||||
| 			USB_HID_Descriptor_HID_t              HID_MouseHID; | 			USB_HID_Descriptor_HID_t              HID_MouseHID; | ||||||
|  | |||||||
| @ -74,7 +74,7 @@ void EVENT_USB_Host_DeviceUnattached(void) | |||||||
|  *  enumerated by the host and is now ready to be used by the application. |  *  enumerated by the host and is now ready to be used by the application. | ||||||
|  */ |  */ | ||||||
| void EVENT_USB_Host_DeviceEnumerationComplete(void) | void EVENT_USB_Host_DeviceEnumerationComplete(void) | ||||||
| {	 | { | ||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); | 	LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); | ||||||
| 
 | 
 | ||||||
| 	uint16_t ConfigDescriptorSize; | 	uint16_t ConfigDescriptorSize; | ||||||
|  | |||||||
| @ -225,3 +225,4 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, | |||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | 	LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -76,3 +76,4 @@ | |||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -96,7 +96,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 
 | 
 | ||||||
| 		LEDs_SetAllLEDs(LEDMask); | 		LEDs_SetAllLEDs(LEDMask); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Pipe_SelectPipe(PrevPipe); | 	Pipe_SelectPipe(PrevPipe); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -193,7 +193,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 	TIMSK0  = (1 << OCIE0A); | 	TIMSK0  = (1 << OCIE0A); | ||||||
| 	OCR0A   = ((F_CPU / 8 / 48000) - 1); | 	OCR0A   = ((F_CPU / 8 / 48000) - 1); | ||||||
| 	TCCR0A  = (1 << WGM01);  // CTC mode
 | 	TCCR0A  = (1 << WGM01);  // CTC mode
 | ||||||
| 	TCCR0B  = (1 << CS01);   // Fcpu/8 speed	
 | 	TCCR0B  = (1 << CS01);   // Fcpu/8 speed
 | ||||||
| 
 | 
 | ||||||
| 	/* Set speaker as output */ | 	/* Set speaker as output */ | ||||||
| 	DDRC   |= (1 << 6); | 	DDRC   |= (1 << 6); | ||||||
|  | |||||||
| @ -81,11 +81,11 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 		#if defined(USE_TEST_TONE) | 		#if defined(USE_TEST_TONE) | ||||||
| 			static uint8_t SquareWaveSampleCount; | 			static uint8_t SquareWaveSampleCount; | ||||||
| 			static int16_t CurrentWaveValue; | 			static int16_t CurrentWaveValue; | ||||||
| 			 | 
 | ||||||
| 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | ||||||
| 			if (SquareWaveSampleCount++ == 0xFF) | 			if (SquareWaveSampleCount++ == 0xFF) | ||||||
| 			  CurrentWaveValue ^= 0x8000; | 			  CurrentWaveValue ^= 0x8000; | ||||||
| 			 | 
 | ||||||
| 			/* Only generate audio if the board button is being pressed */ | 			/* Only generate audio if the board button is being pressed */ | ||||||
| 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | ||||||
| 		#else | 		#else | ||||||
| @ -97,11 +97,11 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | ||||||
| 			#endif | 			#endif | ||||||
| 		#endif | 		#endif | ||||||
| 		 | 
 | ||||||
| 		Audio_Host_WriteSample16(&Speaker_Audio_Interface, AudioSample);	 | 		Audio_Host_WriteSample16(&Speaker_Audio_Interface, AudioSample); | ||||||
| 		Audio_Host_WriteSample16(&Speaker_Audio_Interface, AudioSample); | 		Audio_Host_WriteSample16(&Speaker_Audio_Interface, AudioSample); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Pipe_SelectPipe(PrevPipe); | 	Pipe_SelectPipe(PrevPipe); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -185,7 +185,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 		USB_Host_SetDeviceConfiguration(0); | 		USB_Host_SetDeviceConfiguration(0); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); | 	USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); | ||||||
| 	if (Audio_Host_GetSetEndpointProperty(&Speaker_Audio_Interface, Speaker_Audio_Interface.Config.DataOUTPipeNumber, | 	if (Audio_Host_GetSetEndpointProperty(&Speaker_Audio_Interface, Speaker_Audio_Interface.Config.DataOUTPipeNumber, | ||||||
| 	                                      AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq, | 	                                      AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq, | ||||||
|  | |||||||
| @ -140,7 +140,7 @@ void KeyboardHost_Task(void) | |||||||
| 			{ | 			{ | ||||||
| 				PressedKey = '\n'; | 				PressedKey = '\n'; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			if (PressedKey) | 			if (PressedKey) | ||||||
| 			  putchar(PressedKey); | 			  putchar(PressedKey); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -107,7 +107,7 @@ void KeyboardHost_Task(void) | |||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	 | 
 | ||||||
| 	if (HID_Host_IsReportReceived(&Keyboard_HID_Interface)) | 	if (HID_Host_IsReportReceived(&Keyboard_HID_Interface)) | ||||||
| 	{ | 	{ | ||||||
| 		uint8_t KeyboardReport[Keyboard_HID_Interface.State.LargestReportSize]; | 		uint8_t KeyboardReport[Keyboard_HID_Interface.State.LargestReportSize]; | ||||||
|  | |||||||
| @ -68,7 +68,7 @@ int main(void) | |||||||
| 	for (;;) | 	for (;;) | ||||||
| 	{ | 	{ | ||||||
| 		MassStorageHost_Task(); | 		MassStorageHost_Task(); | ||||||
| 		 | 
 | ||||||
| 		MS_Host_USBTask(&FlashDisk_MS_Interface); | 		MS_Host_USBTask(&FlashDisk_MS_Interface); | ||||||
| 		USB_USBTask(); | 		USB_USBTask(); | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -70,7 +70,7 @@ | |||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void SetupHardware(void); | 		void SetupHardware(void); | ||||||
| 		void MassStorageHost_Task(void); | 		void MassStorageHost_Task(void); | ||||||
| 		 | 
 | ||||||
| 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode); | 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode); | ||||||
| 		void EVENT_USB_Host_DeviceAttached(void); | 		void EVENT_USB_Host_DeviceAttached(void); | ||||||
| 		void EVENT_USB_Host_DeviceUnattached(void); | 		void EVENT_USB_Host_DeviceUnattached(void); | ||||||
|  | |||||||
| @ -102,7 +102,7 @@ void MouseHost_Task(void) | |||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	   | 
 | ||||||
| 	if (HID_Host_IsReportReceived(&Mouse_HID_Interface)) | 	if (HID_Host_IsReportReceived(&Mouse_HID_Interface)) | ||||||
| 	{ | 	{ | ||||||
| 		uint8_t LEDMask = LEDS_NO_LEDS; | 		uint8_t LEDMask = LEDS_NO_LEDS; | ||||||
|  | |||||||
| @ -107,7 +107,7 @@ void MouseHost_Task(void) | |||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	 | 
 | ||||||
| 	if (HID_Host_IsReportReceived(&Mouse_HID_Interface)) | 	if (HID_Host_IsReportReceived(&Mouse_HID_Interface)) | ||||||
| 	{ | 	{ | ||||||
| 		uint8_t MouseReport[Mouse_HID_Interface.State.LargestReportSize]; | 		uint8_t MouseReport[Mouse_HID_Interface.State.LargestReportSize]; | ||||||
|  | |||||||
| @ -71,7 +71,7 @@ int main(void) | |||||||
| 	for (;;) | 	for (;;) | ||||||
| 	{ | 	{ | ||||||
| 		StillImageHost_Task(); | 		StillImageHost_Task(); | ||||||
| 		 | 
 | ||||||
| 		SI_Host_USBTask(&DigitalCamera_SI_Interface); | 		SI_Host_USBTask(&DigitalCamera_SI_Interface); | ||||||
| 		USB_USBTask(); | 		USB_USBTask(); | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -62,7 +62,7 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface = | |||||||
| int main(void) | int main(void) | ||||||
| { | { | ||||||
| 	SetupHardware(); | 	SetupHardware(); | ||||||
| 	 | 
 | ||||||
| 	puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE)); | 	puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE)); | ||||||
| 
 | 
 | ||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); | 	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); | ||||||
|  | |||||||
| @ -78,7 +78,7 @@ void SetupHardware(void) | |||||||
| void AndroidHost_Task(void) | void AndroidHost_Task(void) | ||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return;	 | 	  return; | ||||||
| 
 | 
 | ||||||
| 	/* Select the data IN pipe */ | 	/* Select the data IN pipe */ | ||||||
| 	Pipe_SelectPipe(ANDROID_DATA_IN_PIPE); | 	Pipe_SelectPipe(ANDROID_DATA_IN_PIPE); | ||||||
| @ -148,7 +148,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 
 | 
 | ||||||
| 	/* Get and process the configuration descriptor data */ | 	/* Get and process the configuration descriptor data */ | ||||||
| 	uint8_t ErrorCode = ProcessDeviceDescriptor(); | 	uint8_t ErrorCode = ProcessDeviceDescriptor(); | ||||||
| 	 | 
 | ||||||
| 	bool RequiresModeSwitch = (ErrorCode == NonAccessoryModeAndroidDevice); | 	bool RequiresModeSwitch = (ErrorCode == NonAccessoryModeAndroidDevice); | ||||||
| 
 | 
 | ||||||
| 	/* Error out if the device is not an Android device or an error occurred */ | 	/* Error out if the device is not an Android device or an error occurred */ | ||||||
| @ -166,12 +166,12 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	printf_P(PSTR("Android Device Detected - %sAccessory mode.\r\n"), (RequiresModeSwitch ? "Non-" : "")); | 	printf_P(PSTR("Android Device Detected - %sAccessory mode.\r\n"), (RequiresModeSwitch ? "Non-" : "")); | ||||||
| 	 | 
 | ||||||
| 	/* Check if a valid Android device was attached, but it is not current in Accessory mode */ | 	/* Check if a valid Android device was attached, but it is not current in Accessory mode */ | ||||||
| 	if (RequiresModeSwitch) | 	if (RequiresModeSwitch) | ||||||
| 	{ | 	{ | ||||||
| 		uint16_t AndroidProtocol; | 		uint16_t AndroidProtocol; | ||||||
| 	 | 
 | ||||||
| 		/* Fetch the version of the Android Accessory Protocol supported by the device */ | 		/* Fetch the version of the Android Accessory Protocol supported by the device */ | ||||||
| 		if ((ErrorCode = Android_GetAccessoryProtocol(&AndroidProtocol)) != HOST_SENDCONTROL_Successful) | 		if ((ErrorCode = Android_GetAccessoryProtocol(&AndroidProtocol)) != HOST_SENDCONTROL_Successful) | ||||||
| 		{ | 		{ | ||||||
| @ -181,7 +181,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 			LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | 			LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		/* Validate the returned protocol version */ | 		/* Validate the returned protocol version */ | ||||||
| 		if (AndroidProtocol != AOA_PROTOCOL_AccessoryV1) | 		if (AndroidProtocol != AOA_PROTOCOL_AccessoryV1) | ||||||
| 		{ | 		{ | ||||||
| @ -190,7 +190,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 			LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | 			LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 	 | 
 | ||||||
| 		/* Send the device strings and start the Android Accessory Mode */ | 		/* Send the device strings and start the Android Accessory Mode */ | ||||||
| 		Android_SendString(AOA_STRING_Manufacturer, "Dean Camera"); | 		Android_SendString(AOA_STRING_Manufacturer, "Dean Camera"); | ||||||
| 		Android_SendString(AOA_STRING_Model,        "LUFA Android Demo"); | 		Android_SendString(AOA_STRING_Model,        "LUFA Android Demo"); | ||||||
| @ -199,7 +199,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 		Android_SendString(AOA_STRING_URI,          "http://www.lufa-lib.org"); | 		Android_SendString(AOA_STRING_URI,          "http://www.lufa-lib.org"); | ||||||
| 		Android_SendString(AOA_STRING_Serial,       "0000000012345678"); | 		Android_SendString(AOA_STRING_Serial,       "0000000012345678"); | ||||||
| 
 | 
 | ||||||
| 		Android_StartAccessoryMode();	 | 		Android_StartAccessoryMode(); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ | |||||||
| 
 | 
 | ||||||
| 		#include "DeviceDescriptor.h" | 		#include "DeviceDescriptor.h" | ||||||
| 		#include "ConfigDescriptor.h" | 		#include "ConfigDescriptor.h" | ||||||
| 		#include "Lib/AndroidAccessoryCommands.h"  | 		#include "Lib/AndroidAccessoryCommands.h" | ||||||
| 
 | 
 | ||||||
| 		#include <LUFA/Version.h> | 		#include <LUFA/Version.h> | ||||||
| 		#include <LUFA/Drivers/Misc/TerminalCodes.h> | 		#include <LUFA/Drivers/Misc/TerminalCodes.h> | ||||||
|  | |||||||
| @ -66,7 +66,7 @@ uint8_t ProcessConfigurationDescriptor(void) | |||||||
| 		default: | 		default: | ||||||
| 			return DevControlError; | 			return DevControlError; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	/* There should be only one compatible Android Accessory Mode interface in the device, attempt to find it */ | 	/* There should be only one compatible Android Accessory Mode interface in the device, attempt to find it */ | ||||||
| 	if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, | 	if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, | ||||||
| 	                              DCOMP_NextAndroidAccessoryInterface) != DESCRIPTOR_SEARCH_COMP_Found) | 	                              DCOMP_NextAndroidAccessoryInterface) != DESCRIPTOR_SEARCH_COMP_Found) | ||||||
|  | |||||||
| @ -33,8 +33,8 @@ | |||||||
|  *  Android Accessory Mode utility functions, for the configuration of an attached |  *  Android Accessory Mode utility functions, for the configuration of an attached | ||||||
|  *  Android device into Android Accessory Mode ready for general communication. |  *  Android device into Android Accessory Mode ready for general communication. | ||||||
|  */ |  */ | ||||||
|   | 
 | ||||||
| #include "AndroidAccessoryCommands.h"  | #include "AndroidAccessoryCommands.h" | ||||||
| 
 | 
 | ||||||
| uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol) | uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol) | ||||||
| { | { | ||||||
| @ -79,5 +79,6 @@ uint8_t Android_StartAccessoryMode(void) | |||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	Pipe_SelectPipe(PIPE_CONTROLPIPE); | 	Pipe_SelectPipe(PIPE_CONTROLPIPE); | ||||||
| 	return USB_Host_SendControlRequest(NULL);	 | 	return USB_Host_SendControlRequest(NULL); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -41,11 +41,12 @@ | |||||||
| 		#include <stdbool.h> | 		#include <stdbool.h> | ||||||
| 
 | 
 | ||||||
| 		#include <LUFA/Drivers/USB/USB.h> | 		#include <LUFA/Drivers/USB/USB.h> | ||||||
| 	 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol); | 		uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol); | ||||||
| 		uint8_t Android_SendString(const uint8_t StringIndex, | 		uint8_t Android_SendString(const uint8_t StringIndex, | ||||||
| 		                           const char* const String); | 		                           const char* const String); | ||||||
| 		uint8_t Android_StartAccessoryMode(void);	 | 		uint8_t Android_StartAccessoryMode(void); | ||||||
| 	 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -123,7 +123,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 		LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | 		LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if ((ErrorCode = USB_Host_SetInterfaceAltSetting(StreamingInterfaceIndex, | 	if ((ErrorCode = USB_Host_SetInterfaceAltSetting(StreamingInterfaceIndex, | ||||||
| 	                                                 StreamingInterfaceAltSetting)) != HOST_SENDCONTROL_Successful) | 	                                                 StreamingInterfaceAltSetting)) != HOST_SENDCONTROL_Successful) | ||||||
| 	{ | 	{ | ||||||
| @ -143,7 +143,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 			.wIndex        = StreamingEndpointAddress, | 			.wIndex        = StreamingEndpointAddress, | ||||||
| 			.wLength       = sizeof(USB_Audio_SampleFreq_t), | 			.wLength       = sizeof(USB_Audio_SampleFreq_t), | ||||||
| 		}; | 		}; | ||||||
| 		 | 
 | ||||||
| 	USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); | 	USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); | ||||||
| 
 | 
 | ||||||
| 	/* Select the control pipe for the request transfer */ | 	/* Select the control pipe for the request transfer */ | ||||||
| @ -153,7 +153,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 	if ((ErrorCode = USB_Host_SendControlRequest(&SampleRate)) != HOST_SENDCONTROL_Successful) | 	if ((ErrorCode = USB_Host_SendControlRequest(&SampleRate)) != HOST_SENDCONTROL_Successful) | ||||||
| 	{ | 	{ | ||||||
| 		LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | 		LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | ||||||
| 		USB_Host_SetDeviceConfiguration(0);		 | 		USB_Host_SetDeviceConfiguration(0); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -161,7 +161,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 	TIMSK0  = (1 << OCIE0A); | 	TIMSK0  = (1 << OCIE0A); | ||||||
| 	OCR0A   = ((F_CPU / 8 / 48000) - 1); | 	OCR0A   = ((F_CPU / 8 / 48000) - 1); | ||||||
| 	TCCR0A  = (1 << WGM01);  // CTC mode
 | 	TCCR0A  = (1 << WGM01);  // CTC mode
 | ||||||
| 	TCCR0B  = (1 << CS01);   // Fcpu/8 speed	
 | 	TCCR0B  = (1 << CS01);   // Fcpu/8 speed
 | ||||||
| 
 | 
 | ||||||
| 	/* Set speaker as output */ | 	/* Set speaker as output */ | ||||||
| 	DDRC   |= (1 << 6); | 	DDRC   |= (1 << 6); | ||||||
| @ -169,7 +169,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 	/* PWM speaker timer initialization */ | 	/* PWM speaker timer initialization */ | ||||||
| 	TCCR3A  = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)); // Set on match, clear on TOP
 | 	TCCR3A  = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)); // Set on match, clear on TOP
 | ||||||
| 	TCCR3B  = ((1 << WGM32) | (1 << CS30));  // Fast 8-Bit PWM, F_CPU speed
 | 	TCCR3B  = ((1 << WGM32) | (1 << CS30));  // Fast 8-Bit PWM, F_CPU speed
 | ||||||
| 	 | 
 | ||||||
| 	puts_P(PSTR("Microphone Enumerated.\r\n")); | 	puts_P(PSTR("Microphone Enumerated.\r\n")); | ||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_READY); | 	LEDs_SetAllLEDs(LEDMASK_USB_READY); | ||||||
| } | } | ||||||
| @ -238,7 +238,8 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 
 | 
 | ||||||
| 		LEDs_SetAllLEDs(LEDMask); | 		LEDs_SetAllLEDs(LEDMask); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Pipe_Freeze(); | 	Pipe_Freeze(); | ||||||
| 	Pipe_SelectPipe(PrevPipe); | 	Pipe_SelectPipe(PrevPipe); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ uint8_t ProcessConfigurationDescriptor(void) | |||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				/* Save the interface in case we need to refer back to it later */ | 				/* Save the interface in case we need to refer back to it later */ | ||||||
| 				AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);			 | 				AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t); | ||||||
| 
 | 
 | ||||||
| 				/* Find the next Audio Streaming interface within that Audio Control interface */ | 				/* Find the next Audio Streaming interface within that Audio Control interface */ | ||||||
| 				if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, | 				if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, | ||||||
| @ -218,3 +218,4 @@ uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) | |||||||
| 
 | 
 | ||||||
| 	return DESCRIPTOR_SEARCH_NotFound; | 	return DESCRIPTOR_SEARCH_NotFound; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -68,7 +68,7 @@ void SetupHardware(void) | |||||||
| 	Serial_Init(9600, false); | 	Serial_Init(9600, false); | ||||||
| 	Buttons_Init(); | 	Buttons_Init(); | ||||||
| 	ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32); | 	ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32); | ||||||
| 	ADC_SetupChannel(MIC_IN_ADC_CHANNEL);	 | 	ADC_SetupChannel(MIC_IN_ADC_CHANNEL); | ||||||
| 	LEDs_Init(); | 	LEDs_Init(); | ||||||
| 	USB_Init(); | 	USB_Init(); | ||||||
| 
 | 
 | ||||||
| @ -126,7 +126,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 		LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | 		LEDs_SetAllLEDs(LEDMASK_USB_ERROR); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if ((ErrorCode = USB_Host_SetInterfaceAltSetting(StreamingInterfaceIndex, | 	if ((ErrorCode = USB_Host_SetInterfaceAltSetting(StreamingInterfaceIndex, | ||||||
| 	                                                 StreamingInterfaceAltSetting)) != HOST_SENDCONTROL_Successful) | 	                                                 StreamingInterfaceAltSetting)) != HOST_SENDCONTROL_Successful) | ||||||
| 	{ | 	{ | ||||||
| @ -146,7 +146,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 			.wIndex        = StreamingEndpointAddress, | 			.wIndex        = StreamingEndpointAddress, | ||||||
| 			.wLength       = sizeof(USB_Audio_SampleFreq_t), | 			.wLength       = sizeof(USB_Audio_SampleFreq_t), | ||||||
| 		}; | 		}; | ||||||
| 		 | 
 | ||||||
| 	USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); | 	USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); | ||||||
| 
 | 
 | ||||||
| 	/* Select the control pipe for the request transfer */ | 	/* Select the control pipe for the request transfer */ | ||||||
| @ -164,8 +164,8 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) | |||||||
| 	TIMSK0  = (1 << OCIE0A); | 	TIMSK0  = (1 << OCIE0A); | ||||||
| 	OCR0A   = ((F_CPU / 8 / 48000) - 1); | 	OCR0A   = ((F_CPU / 8 / 48000) - 1); | ||||||
| 	TCCR0A  = (1 << WGM01);  // CTC mode
 | 	TCCR0A  = (1 << WGM01);  // CTC mode
 | ||||||
| 	TCCR0B  = (1 << CS01);   // Fcpu/8 speed	
 | 	TCCR0B  = (1 << CS01);   // Fcpu/8 speed
 | ||||||
| 	 | 
 | ||||||
| 	puts_P(PSTR("Speaker Enumerated.\r\n")); | 	puts_P(PSTR("Speaker Enumerated.\r\n")); | ||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_READY); | 	LEDs_SetAllLEDs(LEDMASK_USB_READY); | ||||||
| } | } | ||||||
| @ -207,16 +207,16 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 	/* Check if the current pipe can be written to (device ready for more data) */ | 	/* Check if the current pipe can be written to (device ready for more data) */ | ||||||
| 	if (Pipe_IsOUTReady()) | 	if (Pipe_IsOUTReady()) | ||||||
| 	{ | 	{ | ||||||
| 		int16_t AudioSample;		 | 		int16_t AudioSample; | ||||||
| 	 | 
 | ||||||
| 		#if defined(USE_TEST_TONE) | 		#if defined(USE_TEST_TONE) | ||||||
| 			static uint8_t SquareWaveSampleCount; | 			static uint8_t SquareWaveSampleCount; | ||||||
| 			static int16_t CurrentWaveValue; | 			static int16_t CurrentWaveValue; | ||||||
| 			 | 
 | ||||||
| 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | 			/* In test tone mode, generate a square wave at 1/256 of the sample rate */ | ||||||
| 			if (SquareWaveSampleCount++ == 0xFF) | 			if (SquareWaveSampleCount++ == 0xFF) | ||||||
| 			  CurrentWaveValue ^= 0x8000; | 			  CurrentWaveValue ^= 0x8000; | ||||||
| 			 | 
 | ||||||
| 			/* Only generate audio if the board button is being pressed */ | 			/* Only generate audio if the board button is being pressed */ | ||||||
| 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | 			AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; | ||||||
| 		#else | 		#else | ||||||
| @ -226,12 +226,12 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 			#if defined(MICROPHONE_BIASED_TO_HALF_RAIL) | 			#if defined(MICROPHONE_BIASED_TO_HALF_RAIL) | ||||||
| 			/* Microphone is biased to half rail voltage, subtract the bias from the sample value */ | 			/* Microphone is biased to half rail voltage, subtract the bias from the sample value */ | ||||||
| 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | 			AudioSample -= (SAMPLE_MAX_RANGE / 2); | ||||||
| 			#endif		 | 			#endif | ||||||
| 		#endif | 		#endif | ||||||
| 		 | 
 | ||||||
| 		Pipe_Write_16_LE(AudioSample); | 		Pipe_Write_16_LE(AudioSample); | ||||||
| 		Pipe_Write_16_LE(AudioSample); | 		Pipe_Write_16_LE(AudioSample); | ||||||
| 		 | 
 | ||||||
| 		if (!(Pipe_IsReadWriteAllowed())) | 		if (!(Pipe_IsReadWriteAllowed())) | ||||||
| 		  Pipe_ClearOUT(); | 		  Pipe_ClearOUT(); | ||||||
| 	} | 	} | ||||||
| @ -239,3 +239,4 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) | |||||||
| 	Pipe_Freeze(); | 	Pipe_Freeze(); | ||||||
| 	Pipe_SelectPipe(PrevPipe); | 	Pipe_SelectPipe(PrevPipe); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ uint8_t ProcessConfigurationDescriptor(void) | |||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				/* Save the interface in case we need to refer back to it later */ | 				/* Save the interface in case we need to refer back to it later */ | ||||||
| 				AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);			 | 				AudioControlInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t); | ||||||
| 
 | 
 | ||||||
| 				/* Find the next Audio Streaming interface within that Audio Control interface */ | 				/* Find the next Audio Streaming interface within that Audio Control interface */ | ||||||
| 				if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, | 				if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, | ||||||
| @ -218,3 +218,4 @@ uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) | |||||||
| 
 | 
 | ||||||
| 	return DESCRIPTOR_SEARCH_NotFound; | 	return DESCRIPTOR_SEARCH_NotFound; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -51,7 +51,7 @@ int main(void) | |||||||
| 	for (;;) | 	for (;;) | ||||||
| 	{ | 	{ | ||||||
| 		ReadNextReport(); | 		ReadNextReport(); | ||||||
| 		 | 
 | ||||||
| 		USB_USBTask(); | 		USB_USBTask(); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -81,7 +81,7 @@ | |||||||
| 		                     const uint8_t ReportIndex, | 		                     const uint8_t ReportIndex, | ||||||
| 		                     const uint8_t ReportType, | 		                     const uint8_t ReportType, | ||||||
| 		                     uint16_t ReportLength); | 		                     uint16_t ReportLength); | ||||||
| 		 | 
 | ||||||
| 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode); | 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode); | ||||||
| 		void EVENT_USB_Host_DeviceAttached(void); | 		void EVENT_USB_Host_DeviceAttached(void); | ||||||
| 		void EVENT_USB_Host_DeviceUnattached(void); | 		void EVENT_USB_Host_DeviceUnattached(void); | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ | |||||||
| 		#include <LUFA/Drivers/USB/USB.h> | 		#include <LUFA/Drivers/USB/USB.h> | ||||||
| 
 | 
 | ||||||
| 		#include "JoystickHostWithParser.h" | 		#include "JoystickHostWithParser.h" | ||||||
| 		 | 
 | ||||||
| 	/* Macros: */ | 	/* Macros: */ | ||||||
| 		/** HID Report Descriptor Usage Page value for a toggle button. */ | 		/** HID Report Descriptor Usage Page value for a toggle button. */ | ||||||
| 		#define USAGE_PAGE_BUTTON           0x09 | 		#define USAGE_PAGE_BUTTON           0x09 | ||||||
| @ -55,7 +55,7 @@ | |||||||
| 		#define USAGE_X                     0x30 | 		#define USAGE_X                     0x30 | ||||||
| 
 | 
 | ||||||
| 		/** HID Report Descriptor Usage value for a Y axis movement. */ | 		/** HID Report Descriptor Usage value for a Y axis movement. */ | ||||||
| 		#define USAGE_Y                     0x31	 | 		#define USAGE_Y                     0x31 | ||||||
| 
 | 
 | ||||||
| 	/* Enums: */ | 	/* Enums: */ | ||||||
| 		/** Enum for the possible return codes of the \ref GetHIDReportData() function. */ | 		/** Enum for the possible return codes of the \ref GetHIDReportData() function. */ | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ void EVENT_USB_Host_DeviceUnattached(void) | |||||||
| void EVENT_USB_Host_DeviceEnumerationComplete(void) | void EVENT_USB_Host_DeviceEnumerationComplete(void) | ||||||
| { | { | ||||||
| 	puts_P(PSTR("Getting Config Data.\r\n")); | 	puts_P(PSTR("Getting Config Data.\r\n")); | ||||||
| 	 | 
 | ||||||
| 	uint8_t ErrorCode; | 	uint8_t ErrorCode; | ||||||
| 
 | 
 | ||||||
| 	/* Get and process the configuration descriptor data */ | 	/* Get and process the configuration descriptor data */ | ||||||
| @ -179,7 +179,7 @@ void JoystickHost_Task(void) | |||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	 | 
 | ||||||
| 	/* Select and unfreeze joystick data pipe */ | 	/* Select and unfreeze joystick data pipe */ | ||||||
| 	Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE); | 	Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE); | ||||||
| 	Pipe_Unfreeze(); | 	Pipe_Unfreeze(); | ||||||
| @ -268,3 +268,4 @@ void ProcessJoystickReport(uint8_t* JoystickReport) | |||||||
| 	/* Display the button information on the board LEDs */ | 	/* Display the button information on the board LEDs */ | ||||||
| 	LEDs_SetAllLEDs(LEDMask); | 	LEDs_SetAllLEDs(LEDMask); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ | |||||||
| 
 | 
 | ||||||
| 		/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ | 		/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ | ||||||
| 		#define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3) | 		#define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3) | ||||||
| 		 | 
 | ||||||
| 	/* Function Prototypes: */ | 	/* Function Prototypes: */ | ||||||
| 		void SetupHardware(void); | 		void SetupHardware(void); | ||||||
| 		void JoystickHost_Task(void); | 		void JoystickHost_Task(void); | ||||||
|  | |||||||
| @ -181,7 +181,7 @@ void KeyboardHost_Task(void) | |||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	 | 
 | ||||||
| 	/* Select and unfreeze keyboard data pipe */ | 	/* Select and unfreeze keyboard data pipe */ | ||||||
| 	Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE); | 	Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE); | ||||||
| 	Pipe_Unfreeze(); | 	Pipe_Unfreeze(); | ||||||
| @ -259,7 +259,7 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport) | |||||||
| 				} | 				} | ||||||
| 				else if (KeyCode == HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS) | 				else if (KeyCode == HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS) | ||||||
| 				{ | 				{ | ||||||
| 					PressedKey = '0';						 | 					PressedKey = '0'; | ||||||
| 				} | 				} | ||||||
| 				else if (KeyCode == HID_KEYBOARD_SC_SPACE) | 				else if (KeyCode == HID_KEYBOARD_SC_SPACE) | ||||||
| 				{ | 				{ | ||||||
|  | |||||||
| @ -165,7 +165,7 @@ void MIDIHost_Task(void) | |||||||
| { | { | ||||||
| 	if (USB_HostState != HOST_STATE_Configured) | 	if (USB_HostState != HOST_STATE_Configured) | ||||||
| 	  return; | 	  return; | ||||||
| 	   | 
 | ||||||
| 	Pipe_SelectPipe(MIDI_DATA_IN_PIPE); | 	Pipe_SelectPipe(MIDI_DATA_IN_PIPE); | ||||||
| 
 | 
 | ||||||
| 	if (Pipe_IsINReceived()) | 	if (Pipe_IsINReceived()) | ||||||
| @ -185,7 +185,7 @@ void MIDIHost_Task(void) | |||||||
| 			printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off", | 			printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off", | ||||||
| 																				   ((MIDIEvent.Data1 & 0x0F) + 1), | 																				   ((MIDIEvent.Data1 & 0x0F) + 1), | ||||||
| 																				   MIDIEvent.Data2, MIDIEvent.Data3); | 																				   MIDIEvent.Data2, MIDIEvent.Data3); | ||||||
| 		}				 | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	Pipe_SelectPipe(MIDI_DATA_OUT_PIPE); | 	Pipe_SelectPipe(MIDI_DATA_OUT_PIPE); | ||||||
|  | |||||||
| @ -108,7 +108,7 @@ static uint8_t MassStore_SendCommand(MS_CommandBlockWrapper_t* const SCSICommand | |||||||
| 			return ErrorCode; | 			return ErrorCode; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	/* Retrieve the returned SCSI status from the device */ | 	/* Retrieve the returned SCSI status from the device */ | ||||||
| 	MS_CommandStatusWrapper_t SCSIStatusBlock; | 	MS_CommandStatusWrapper_t SCSIStatusBlock; | ||||||
| 	return MassStore_GetReturnedStatus(&SCSIStatusBlock); | 	return MassStore_GetReturnedStatus(&SCSIStatusBlock); | ||||||
| @ -267,7 +267,7 @@ static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSI | |||||||
| 	{ | 	{ | ||||||
| 		return ErrorCode; | 		return ErrorCode; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	/* Clear the data ready for next reception */ | 	/* Clear the data ready for next reception */ | ||||||
| 	Pipe_ClearIN(); | 	Pipe_ClearIN(); | ||||||
| 
 | 
 | ||||||
| @ -302,13 +302,13 @@ uint8_t MassStore_MassStorageReset(void) | |||||||
| 
 | 
 | ||||||
| 	/* Select the control pipe for the request transfer */ | 	/* Select the control pipe for the request transfer */ | ||||||
| 	Pipe_SelectPipe(PIPE_CONTROLPIPE); | 	Pipe_SelectPipe(PIPE_CONTROLPIPE); | ||||||
| 	 | 
 | ||||||
| 	if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) | 	if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) | ||||||
| 	  return ErrorCode; | 	  return ErrorCode; | ||||||
| 	 | 
 | ||||||
| 	/* Select first data pipe to clear STALL condition if one exists */ | 	/* Select first data pipe to clear STALL condition if one exists */ | ||||||
| 	Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE); | 	Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE); | ||||||
| 	 | 
 | ||||||
| 	if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) | 	if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) | ||||||
| 	  return ErrorCode; | 	  return ErrorCode; | ||||||
| 
 | 
 | ||||||
| @ -317,7 +317,7 @@ uint8_t MassStore_MassStorageReset(void) | |||||||
| 
 | 
 | ||||||
| 	if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) | 	if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) | ||||||
| 	  return ErrorCode; | 	  return ErrorCode; | ||||||
| 	 | 
 | ||||||
| 	return HOST_SENDCONTROL_Successful; | 	return HOST_SENDCONTROL_Successful; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -284,3 +284,4 @@ void ProcessMouseReport(uint8_t* MouseReport) | |||||||
| 	/* Display the button information on the board LEDs */ | 	/* Display the button information on the board LEDs */ | ||||||
| 	LEDs_SetAllLEDs(LEDMask); | 	LEDs_SetAllLEDs(LEDMask); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -218,7 +218,7 @@ void PrinterHost_Task(void) | |||||||
| 	puts_P(PSTR("Test Page Sent.\r\n")); | 	puts_P(PSTR("Test Page Sent.\r\n")); | ||||||
| 
 | 
 | ||||||
| 	/* Indicate device no longer busy */ | 	/* Indicate device no longer busy */ | ||||||
| 	LEDs_SetAllLEDs(LEDMASK_USB_READY);	 | 	LEDs_SetAllLEDs(LEDMASK_USB_READY); | ||||||
| 	USB_Host_SetDeviceConfiguration(0); | 	USB_Host_SetDeviceConfiguration(0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -83,6 +83,6 @@ | |||||||
| 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode); | 		void EVENT_USB_Host_HostError(const uint8_t ErrorCode); | ||||||
| 		void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, | 		void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, | ||||||
| 		                                            const uint8_t SubErrorCode); | 		                                            const uint8_t SubErrorCode); | ||||||
| 		 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -222,7 +222,7 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor) | |||||||
| 		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); | 		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); | ||||||
| 
 | 
 | ||||||
| 		/* Check the endpoint type, break out if correct BULK or INTERRUPT type endpoint found */ | 		/* Check the endpoint type, break out if correct BULK or INTERRUPT type endpoint found */ | ||||||
| 		if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) ||  | 		if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) || | ||||||
| 		    ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)) | 		    ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)) | ||||||
| 		{ | 		{ | ||||||
| 			return DESCRIPTOR_SEARCH_Found; | 			return DESCRIPTOR_SEARCH_Found; | ||||||
|  | |||||||
| @ -177,7 +177,7 @@ uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor) | |||||||
| 		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); | 		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); | ||||||
| 
 | 
 | ||||||
| 		/* Check the endpoint type, break out if correct BULK or INTERRUPT type endpoint found */ | 		/* Check the endpoint type, break out if correct BULK or INTERRUPT type endpoint found */ | ||||||
| 		if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) ||  | 		if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) || | ||||||
| 		    ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)) | 		    ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)) | ||||||
| 		{ | 		{ | ||||||
| 			return DESCRIPTOR_SEARCH_Found; | 			return DESCRIPTOR_SEARCH_Found; | ||||||
|  | |||||||
| @ -221,7 +221,7 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor) | |||||||
| 	{ | 	{ | ||||||
| 		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); | 		USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); | ||||||
| 
 | 
 | ||||||
| 		if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) ||  | 		if (((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) || | ||||||
| 		    ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)) | 		    ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)) | ||||||
| 		{ | 		{ | ||||||
| 			return DESCRIPTOR_SEARCH_Found; | 			return DESCRIPTOR_SEARCH_Found; | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ | |||||||
|    header, copy this into your project's root directory and supply |    header, copy this into your project's root directory and supply | ||||||
|    the \c USE_LUFA_CONFIG_HEADER token to the compiler so that it is |    the \c USE_LUFA_CONFIG_HEADER token to the compiler so that it is | ||||||
|    defined in all compiled source files. |    defined in all compiled source files. | ||||||
|     | 
 | ||||||
|    For information on what each token does, refer to the LUFA |    For information on what each token does, refer to the LUFA | ||||||
|    manual section "Summary of Compile Tokens". |    manual section "Summary of Compile Tokens". | ||||||
| */ | */ | ||||||
| @ -85,7 +85,7 @@ | |||||||
| //		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
 | //		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
 | ||||||
| 
 | 
 | ||||||
| 	#elif (ARCH == ARCH_XMEGA) | 	#elif (ARCH == ARCH_XMEGA) | ||||||
| 	 | 
 | ||||||
| 		/* Non-USB Related Configuration Tokens: */ | 		/* Non-USB Related Configuration Tokens: */ | ||||||
| //		#define DISABLE_TERMINAL_CODES
 | //		#define DISABLE_TERMINAL_CODES
 | ||||||
| 
 | 
 | ||||||
| @ -151,6 +151,6 @@ | |||||||
| //		#define USB_HOST_TIMEOUT_MS              {Insert Value Here}
 | //		#define USB_HOST_TIMEOUT_MS              {Insert Value Here}
 | ||||||
| //		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
 | //		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
 | ||||||
| 
 | 
 | ||||||
| 	#endif	 | 	#endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -55,7 +55,7 @@ | |||||||
| 		#if !defined(__INCLUDE_FROM_COMMON_H) | 		#if !defined(__INCLUDE_FROM_COMMON_H) | ||||||
| 			#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. | 			#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. | ||||||
| 		#endif | 		#endif | ||||||
| 		 | 
 | ||||||
| 	/* Enable C linkage for C++ Compilers: */ | 	/* Enable C linkage for C++ Compilers: */ | ||||||
| 		#if defined(__cplusplus) | 		#if defined(__cplusplus) | ||||||
| 			extern "C" { | 			extern "C" { | ||||||
| @ -82,7 +82,7 @@ | |||||||
| 				                                                  "M" (_SFR_IO_ADDR(MCUCR))          \ | 				                                                  "M" (_SFR_IO_ADDR(MCUCR))          \ | ||||||
| 				                                                : "r0");                             \ | 				                                                : "r0");                             \ | ||||||
| 				                                        }MACROE | 				                                        }MACROE | ||||||
| 			 | 
 | ||||||
| 				/** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always
 | 				/** Defines a volatile \c 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. | ||||||
| @ -136,7 +136,7 @@ | |||||||
| 					#define pgm_read_ptr(Address)        (void*)pgm_read_word(Address) | 					#define pgm_read_ptr(Address)        (void*)pgm_read_word(Address) | ||||||
| 				#endif | 				#endif | ||||||
| 			#endif | 			#endif | ||||||
| 			 | 
 | ||||||
| 	/* Disable C linkage for C++ Compilers: */ | 	/* Disable C linkage for C++ Compilers: */ | ||||||
| 		#if defined(__cplusplus) | 		#if defined(__cplusplus) | ||||||
| 			} | 			} | ||||||
|  | |||||||
| @ -66,10 +66,10 @@ | |||||||
| 
 | 
 | ||||||
| 			/** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */ | 			/** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */ | ||||||
| 			#define ARCH_UC3            1 | 			#define ARCH_UC3            1 | ||||||
| 			 | 
 | ||||||
| 			/** Selects the Atmel XMEGA AVR (ATXMEGA*U chips) architecture. */ | 			/** Selects the Atmel XMEGA AVR (ATXMEGA*U chips) architecture. */ | ||||||
| 			#define ARCH_XMEGA          2 | 			#define ARCH_XMEGA          2 | ||||||
| 			 | 
 | ||||||
| 			#if !defined(__DOXYGEN__) | 			#if !defined(__DOXYGEN__) | ||||||
| 				#define ARCH_           ARCH_AVR8 | 				#define ARCH_           ARCH_AVR8 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -133,14 +133,14 @@ | |||||||
| 			 *  \param[in] Func  Name of the function which the given function name should alias. | 			 *  \param[in] Func  Name of the function which the given function name should alias. | ||||||
| 			 */ | 			 */ | ||||||
| 			#define ATTR_ALIAS(Func)               __attribute__ ((alias( #Func ))) | 			#define ATTR_ALIAS(Func)               __attribute__ ((alias( #Func ))) | ||||||
| 			 | 
 | ||||||
| 			/** Marks a variable or struct element for packing into the smallest space available, omitting any
 | 			/** Marks a variable or struct element for packing into the smallest space available, omitting any
 | ||||||
| 			 *  alignment bytes usually added between fields to optimize field accesses. | 			 *  alignment bytes usually added between fields to optimize field accesses. | ||||||
| 			 */ | 			 */ | ||||||
| 			#define ATTR_PACKED                     __attribute__ ((packed)) | 			#define ATTR_PACKED                     __attribute__ ((packed)) | ||||||
| 
 | 
 | ||||||
| 			/** Indicates the minimum alignment in bytes for a variable or struct element.
 | 			/** Indicates the minimum alignment in bytes for a variable or struct element.
 | ||||||
| 			 *  | 			 * | ||||||
| 			 *  \param[in] Bytes  Minimum number of bytes the item should be aligned to. | 			 *  \param[in] Bytes  Minimum number of bytes the item should be aligned to. | ||||||
| 			 */ | 			 */ | ||||||
| 			#define ATTR_ALIGNED(Bytes)            __attribute__ ((aligned(Bytes))) | 			#define ATTR_ALIGNED(Bytes)            __attribute__ ((aligned(Bytes))) | ||||||
|  | |||||||
| @ -140,13 +140,13 @@ | |||||||
| 
 | 
 | ||||||
| 			/** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */ | 			/** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */ | ||||||
| 			#define BOARD_USBFOO        25 | 			#define BOARD_USBFOO        25 | ||||||
| 			 | 
 | ||||||
| 			/** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */ | 			/** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */ | ||||||
| 			#define BOARD_SPARKFUN8U2   26 | 			#define BOARD_SPARKFUN8U2   26 | ||||||
| 
 | 
 | ||||||
| 			/** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */ | 			/** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */ | ||||||
| 			#define BOARD_EVK1101       27 | 			#define BOARD_EVK1101       27 | ||||||
| 			 | 
 | ||||||
| 			/** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */ | 			/** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */ | ||||||
| 			#define BOARD_TUL           28 | 			#define BOARD_TUL           28 | ||||||
| 
 | 
 | ||||||
| @ -155,7 +155,7 @@ | |||||||
| 
 | 
 | ||||||
| 			/** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */ | 			/** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */ | ||||||
| 			#define BOARD_EVK1104       30 | 			#define BOARD_EVK1104       30 | ||||||
| 			 | 
 | ||||||
| 			/** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */ | 			/** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */ | ||||||
| 			#define BOARD_A3BU_XPLAINED 31 | 			#define BOARD_A3BU_XPLAINED 31 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ | |||||||
|  * |  * | ||||||
|  *  @{ |  *  @{ | ||||||
|  */ |  */ | ||||||
|   | 
 | ||||||
| /** \defgroup Group_GlobalInt Global Interrupt Macros
 | /** \defgroup Group_GlobalInt Global Interrupt Macros
 | ||||||
|  *  \brief Convenience macros for the management of interrupts globally within the device. |  *  \brief Convenience macros for the management of interrupts globally within the device. | ||||||
|  * |  * | ||||||
| @ -54,13 +54,13 @@ | |||||||
| 
 | 
 | ||||||
| 	/* Macros: */ | 	/* Macros: */ | ||||||
| 		#define __INCLUDE_FROM_COMMON_H | 		#define __INCLUDE_FROM_COMMON_H | ||||||
| 		 | 
 | ||||||
| 	/* Includes: */ | 	/* Includes: */ | ||||||
| 		#include <stdint.h> | 		#include <stdint.h> | ||||||
| 		#include <stdbool.h> | 		#include <stdbool.h> | ||||||
| 		#include <string.h> | 		#include <string.h> | ||||||
| 		#include <stddef.h> | 		#include <stddef.h> | ||||||
| 		 | 
 | ||||||
| 		#if defined(USE_LUFA_CONFIG_HEADER) | 		#if defined(USE_LUFA_CONFIG_HEADER) | ||||||
| 			#include "LUFAConfig.h" | 			#include "LUFAConfig.h" | ||||||
| 		#endif | 		#endif | ||||||
| @ -70,7 +70,7 @@ | |||||||
| 		#include "ArchitectureSpecific.h" | 		#include "ArchitectureSpecific.h" | ||||||
| 		#include "CompilerSpecific.h" | 		#include "CompilerSpecific.h" | ||||||
| 		#include "Attributes.h" | 		#include "Attributes.h" | ||||||
| 		 | 
 | ||||||
| 	/* Enable C linkage for C++ Compilers: */ | 	/* Enable C linkage for C++ Compilers: */ | ||||||
| 		#if defined(__cplusplus) | 		#if defined(__cplusplus) | ||||||
| 			extern "C" { | 			extern "C" { | ||||||
| @ -90,9 +90,9 @@ | |||||||
| 			#include <avr/eeprom.h> | 			#include <avr/eeprom.h> | ||||||
| 			#include <avr/boot.h> | 			#include <avr/boot.h> | ||||||
| 			#include <util/delay.h> | 			#include <util/delay.h> | ||||||
| 			 | 
 | ||||||
| 			typedef uint8_t uint_reg_t; | 			typedef uint8_t uint_reg_t; | ||||||
| 			 | 
 | ||||||
| 			#define ARCH_HAS_EEPROM_ADDRESS_SPACE | 			#define ARCH_HAS_EEPROM_ADDRESS_SPACE | ||||||
| 			#define ARCH_HAS_FLASH_ADDRESS_SPACE | 			#define ARCH_HAS_FLASH_ADDRESS_SPACE | ||||||
| 			#define ARCH_HAS_MULTI_ADDRESS_SPACE | 			#define ARCH_HAS_MULTI_ADDRESS_SPACE | ||||||
| @ -110,7 +110,7 @@ | |||||||
| 			// =================================================
 | 			// =================================================
 | ||||||
| 
 | 
 | ||||||
| 			typedef uint32_t uint_reg_t; | 			typedef uint32_t uint_reg_t; | ||||||
| 			 | 
 | ||||||
| 			#define ARCH_BIG_ENDIAN | 			#define ARCH_BIG_ENDIAN | ||||||
| 
 | 
 | ||||||
| 			#include "Endianness.h" | 			#include "Endianness.h" | ||||||
| @ -120,15 +120,15 @@ | |||||||
| 			#include <avr/pgmspace.h> | 			#include <avr/pgmspace.h> | ||||||
| 			#include <avr/eeprom.h> | 			#include <avr/eeprom.h> | ||||||
| 			#include <util/delay.h> | 			#include <util/delay.h> | ||||||
| 			 | 
 | ||||||
| 			typedef uint8_t uint_reg_t; | 			typedef uint8_t uint_reg_t; | ||||||
| 			 | 
 | ||||||
| 			#define ARCH_HAS_EEPROM_ADDRESS_SPACE | 			#define ARCH_HAS_EEPROM_ADDRESS_SPACE | ||||||
| 			#define ARCH_HAS_FLASH_ADDRESS_SPACE | 			#define ARCH_HAS_FLASH_ADDRESS_SPACE | ||||||
| 			#define ARCH_HAS_MULTI_ADDRESS_SPACE | 			#define ARCH_HAS_MULTI_ADDRESS_SPACE | ||||||
| 			#define ARCH_LITTLE_ENDIAN | 			#define ARCH_LITTLE_ENDIAN | ||||||
| 
 | 
 | ||||||
| 			#include "Endianness.h"		 | 			#include "Endianness.h" | ||||||
| 		#else | 		#else | ||||||
| 			#error Unknown device architecture specified. | 			#error Unknown device architecture specified. | ||||||
| 		#endif | 		#endif | ||||||
| @ -176,7 +176,7 @@ | |||||||
| 			#if !defined(MIN) || defined(__DOXYGEN__) | 			#if !defined(MIN) || defined(__DOXYGEN__) | ||||||
| 				#define MIN(x, y)               (((x) < (y)) ? (x) : (y)) | 				#define MIN(x, y)               (((x) < (y)) ? (x) : (y)) | ||||||
| 			#endif | 			#endif | ||||||
| 			 | 
 | ||||||
| 			#if !defined(STRINGIFY) || defined(__DOXYGEN__) | 			#if !defined(STRINGIFY) || defined(__DOXYGEN__) | ||||||
| 				/** Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation
 | 				/** Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation
 | ||||||
| 				 *  marks around the input, converting the source into a string literal. | 				 *  marks around the input, converting the source into a string literal. | ||||||
| @ -256,7 +256,7 @@ | |||||||
| 				while (Milliseconds--) | 				while (Milliseconds--) | ||||||
| 				{ | 				{ | ||||||
| 					__builtin_mtsr(AVR32_COUNT, 0); | 					__builtin_mtsr(AVR32_COUNT, 0); | ||||||
| 					while (__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000));				 | 					while (__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000)); | ||||||
| 				} | 				} | ||||||
| 				#elif (ARCH == ARCH_XMEGA) | 				#elif (ARCH == ARCH_XMEGA) | ||||||
| 				if (GCC_IS_COMPILE_CONST(Milliseconds)) | 				if (GCC_IS_COMPILE_CONST(Milliseconds)) | ||||||
| @ -267,7 +267,7 @@ | |||||||
| 				{ | 				{ | ||||||
| 					while (Milliseconds--) | 					while (Milliseconds--) | ||||||
| 					  _delay_ms(1); | 					  _delay_ms(1); | ||||||
| 				}				 | 				} | ||||||
| 				#endif | 				#endif | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| @ -316,12 +316,12 @@ | |||||||
| 				else | 				else | ||||||
| 				  __builtin_csrf(AVR32_SR_GM_OFFSET); | 				  __builtin_csrf(AVR32_SR_GM_OFFSET); | ||||||
| 				#elif (ARCH == ARCH_XMEGA) | 				#elif (ARCH == ARCH_XMEGA) | ||||||
| 				SREG = GlobalIntState;				 | 				SREG = GlobalIntState; | ||||||
| 				#endif | 				#endif | ||||||
| 				 | 
 | ||||||
| 				GCC_MEMORY_BARRIER(); | 				GCC_MEMORY_BARRIER(); | ||||||
| 			} | 			} | ||||||
| 		 | 
 | ||||||
| 			/** Enables global interrupt handling for the device, allowing interrupts to be handled.
 | 			/** Enables global interrupt handling for the device, allowing interrupts to be handled.
 | ||||||
| 			 * | 			 * | ||||||
| 			 *  \ingroup Group_GlobalInt | 			 *  \ingroup Group_GlobalInt | ||||||
| @ -340,7 +340,7 @@ | |||||||
| 				#endif | 				#endif | ||||||
| 
 | 
 | ||||||
| 				GCC_MEMORY_BARRIER(); | 				GCC_MEMORY_BARRIER(); | ||||||
| 			}		 | 			} | ||||||
| 
 | 
 | ||||||
| 			/** Disabled global interrupt handling for the device, preventing interrupts from being handled.
 | 			/** Disabled global interrupt handling for the device, preventing interrupts from being handled.
 | ||||||
| 			 * | 			 * | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ | |||||||
|  * |  * | ||||||
|  *  Compiler specific definitions to expose certain compiler features which may increase the level of code optimization |  *  Compiler specific definitions to expose certain compiler features which may increase the level of code optimization | ||||||
|  *  for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction |  *  for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction | ||||||
|  *  with atomic variable access.  |  *  with atomic variable access. | ||||||
|  * |  * | ||||||
|  *  Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value |  *  Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value | ||||||
|  *  so that they can be used in existing code without the need for extra compiler checks in the user application code. |  *  so that they can be used in existing code without the need for extra compiler checks in the user application code. | ||||||
| @ -77,7 +77,7 @@ | |||||||
| 				 *  assembly output in an unexpected manner on sections of code that are ordering-specific. | 				 *  assembly output in an unexpected manner on sections of code that are ordering-specific. | ||||||
| 				 */ | 				 */ | ||||||
| 				#define GCC_MEMORY_BARRIER()                  __asm__ __volatile__("" ::: "memory"); | 				#define GCC_MEMORY_BARRIER()                  __asm__ __volatile__("" ::: "memory"); | ||||||
| 				 | 
 | ||||||
| 				/** Evaluates to boolean true if the specified value can be determined at compile time to be a constant value
 | 				/** Evaluates to boolean true if the specified value can be determined at compile time to be a constant value
 | ||||||
| 				 *  when compiling under GCC. | 				 *  when compiling under GCC. | ||||||
| 				 * | 				 * | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ | |||||||
| 		#if !defined(__INCLUDE_FROM_COMMON_H) | 		#if !defined(__INCLUDE_FROM_COMMON_H) | ||||||
| 			#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. | 			#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. | ||||||
| 		#endif | 		#endif | ||||||
| 		 | 
 | ||||||
| 		#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN)) | 		#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN)) | ||||||
| 			#error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture. | 			#error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture. | ||||||
| 		#endif | 		#endif | ||||||
| @ -115,11 +115,11 @@ | |||||||
| 				#define CPU_TO_LE16(x)           SWAPENDIAN_16(x) | 				#define CPU_TO_LE16(x)           SWAPENDIAN_16(x) | ||||||
| 				#define CPU_TO_LE32(x)           SWAPENDIAN_32(x) | 				#define CPU_TO_LE32(x)           SWAPENDIAN_32(x) | ||||||
| 				#define CPU_TO_BE16(x)           (x) | 				#define CPU_TO_BE16(x)           (x) | ||||||
| 				#define CPU_TO_BE32(x)           (x)			 | 				#define CPU_TO_BE32(x)           (x) | ||||||
| 			#elif !defined(le16_to_cpu) | 			#elif !defined(le16_to_cpu) | ||||||
| 				/** \name Run-time endianness conversion */ | 				/** \name Run-time endianness conversion */ | ||||||
| 				//@{
 | 				//@{
 | ||||||
| 			 | 
 | ||||||
| 				/** Performs a conversion between a Little Endian encoded 16-bit piece of data and the
 | 				/** Performs a conversion between a Little Endian encoded 16-bit piece of data and the
 | ||||||
| 				 *  Endianness of the currently selected CPU architecture. | 				 *  Endianness of the currently selected CPU architecture. | ||||||
| 				 * | 				 * | ||||||
| @ -398,7 +398,7 @@ | |||||||
| 			{ | 			{ | ||||||
| 				if (GCC_IS_COMPILE_CONST(Word)) | 				if (GCC_IS_COMPILE_CONST(Word)) | ||||||
| 				  return SWAPENDIAN_16(Word); | 				  return SWAPENDIAN_16(Word); | ||||||
| 			 | 
 | ||||||
| 				uint8_t Temp; | 				uint8_t Temp; | ||||||
| 
 | 
 | ||||||
| 				union | 				union | ||||||
| @ -486,3 +486,4 @@ | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| /** @} */ | /** @} */ | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -124,3 +124,4 @@ | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| /** @} */ | /** @} */ | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -66,7 +66,7 @@ | |||||||
| 		/* Macros: */ | 		/* Macros: */ | ||||||
| 			#define JOY_FMASK                 ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)) | 			#define JOY_FMASK                 ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)) | ||||||
| 			#define JOY_CMASK                 (1 << 6) | 			#define JOY_CMASK                 (1 << 6) | ||||||
| 			 | 
 | ||||||
| 			#define JOY_PORTC_MASK_SHIFT      3 | 			#define JOY_PORTC_MASK_SHIFT      3 | ||||||
| 	#endif | 	#endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -127,3 +127,4 @@ | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| /** @} */ | /** @} */ | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| /*
 | /*
 | ||||||
|              LUFA Library |              LUFA Library | ||||||
|      Copyright (C) Dean Camera, 2011. |      Copyright (C) Dean Camera, 2011. | ||||||
|                | 
 | ||||||
|   dean [at] fourwalledcubicle [dot] com |   dean [at] fourwalledcubicle [dot] com | ||||||
|            www.lufa-lib.org |            www.lufa-lib.org | ||||||
| */ | */ | ||||||
| @ -9,13 +9,13 @@ | |||||||
| /*
 | /*
 | ||||||
|   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) |   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) | ||||||
| 
 | 
 | ||||||
|   Permission to use, copy, modify, distribute, and sell this  |   Permission to use, copy, modify, distribute, and sell this | ||||||
|   software and its documentation for any purpose is hereby granted |   software and its documentation for any purpose is hereby granted | ||||||
|   without fee, provided that the above copyright notice appear in  |   without fee, provided that the above copyright notice appear in | ||||||
|   all copies and that both that the copyright notice and this |   all copies and that both that the copyright notice and this | ||||||
|   permission notice and warranty disclaimer appear in supporting  |   permission notice and warranty disclaimer appear in supporting | ||||||
|   documentation, and that the name of the author not be used in  |   documentation, and that the name of the author not be used in | ||||||
|   advertising or publicity pertaining to distribution of the  |   advertising or publicity pertaining to distribution of the | ||||||
|   software without specific, written prior permission. |   software without specific, written prior permission. | ||||||
| 
 | 
 | ||||||
|   The author disclaim all warranties with regard to this |   The author disclaim all warranties with regard to this | ||||||
| @ -82,7 +82,7 @@ | |||||||
| 				DDRB  |=  LEDS_ALL_LEDS; | 				DDRB  |=  LEDS_ALL_LEDS; | ||||||
| 				PORTB &= ~LEDS_ALL_LEDS; | 				PORTB &= ~LEDS_ALL_LEDS; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) | 			static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) | ||||||
| 			{ | 			{ | ||||||
| 				PORTB |= LEDMask; | 				PORTB |= LEDMask; | ||||||
| @ -97,18 +97,18 @@ | |||||||
| 			{ | 			{ | ||||||
| 				PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LEDMask); | 				PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LEDMask); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, | 			static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, | ||||||
| 			                                   const uint8_t ActiveMask) | 			                                   const uint8_t ActiveMask) | ||||||
| 			{ | 			{ | ||||||
| 				PORTB = ((PORTB & ~LEDMask) | ActiveMask); | 				PORTB = ((PORTB & ~LEDMask) | ActiveMask); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) | 			static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) | ||||||
| 			{ | 			{ | ||||||
| 				PORTB ^= LEDMask; | 				PORTB ^= LEDMask; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; | 			static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; | ||||||
| 			static inline uint8_t LEDs_GetLEDs(void) | 			static inline uint8_t LEDs_GetLEDs(void) | ||||||
| 			{ | 			{ | ||||||
| @ -120,7 +120,8 @@ | |||||||
| 		#if defined(__cplusplus) | 		#if defined(__cplusplus) | ||||||
| 			} | 			} | ||||||
| 		#endif | 		#endif | ||||||
| 		 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| /** @} */ | /** @} */ | ||||||
|  | 
 | ||||||
|  | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dean Camera
						Dean Camera