diff options
Diffstat (limited to 'Demos/Device/ClassDriver')
22 files changed, 54 insertions, 44 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 31e8d96ad..f11122fd3 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -106,11 +106,11 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) #if defined(USE_TEST_TONE) static uint8_t SquareWaveSampleCount; static int16_t CurrentWaveValue; - + /* In test tone mode, generate a square wave at 1/256 of the sample rate */ if (SquareWaveSampleCount++ == 0xFF) CurrentWaveValue ^= 0x8000; - + /* Only generate audio if the board button is being pressed */ AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; #else @@ -122,7 +122,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) AudioSample -= (SAMPLE_MAX_RANGE / 2); #endif #endif - + 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]); /* 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: /* Check if we are just testing for a valid property, or actually reading it */ if (DataLength != NULL) @@ -223,13 +223,14 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* Data[2] = (CurrentAudioSampleFrequency >> 16); Data[1] = (CurrentAudioSampleFrequency >> 8); - Data[0] = (CurrentAudioSampleFrequency & 0xFF); + Data[0] = (CurrentAudioSampleFrequency & 0xFF); } - + return true; } } } - + return false; } + diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.c b/Demos/Device/ClassDriver/AudioInput/Descriptors.c index 2a6a77734..48059affe 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.c @@ -204,7 +204,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)) }, - + .Audio_AudioFormatSampleRates = { AUDIO_SAMPLE_FREQ(8000), diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 8858999a2..88f82006e 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -91,7 +91,7 @@ void SetupHardware(void) ISR(TIMER0_COMPA_vect, ISR_BLOCK) { uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); - + /* Check that the USB bus is ready for the next sample to read */ if (Audio_Device_IsSampleReceived(&Speaker_Audio_Interface)) { @@ -128,8 +128,8 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) LEDs_SetAllLEDs(LEDMask); } - - Endpoint_SelectEndpoint(PrevEndpoint); + + Endpoint_SelectEndpoint(PrevEndpoint); } /** 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]); /* 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: /* Check if we are just testing for a valid property, or actually reading it */ if (DataLength != NULL) @@ -260,13 +260,14 @@ bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* Data[2] = (CurrentAudioSampleFrequency >> 16); Data[1] = (CurrentAudioSampleFrequency >> 8); - Data[0] = (CurrentAudioSampleFrequency & 0xFF); + Data[0] = (CurrentAudioSampleFrequency & 0xFF); } - + return true; } } } - + return false; } + diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c index 75a13bb7a..50d0bb6a0 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c @@ -204,7 +204,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)), }, - + .Audio_AudioFormatSampleRates = { AUDIO_SAMPLE_FREQ(8000), diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h index da95077c4..aa551b00c 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h @@ -83,3 +83,4 @@ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); #endif + diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h index 4affeafe1..fc13b576c 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h +++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h @@ -109,3 +109,4 @@ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); #endif + diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 466efaf7f..be795409a 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -145,7 +145,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn { uint8_t* Data = (uint8_t*)ReportData; uint8_t CurrLEDMask = LEDs_GetLEDs(); - + Data[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); Data[1] = ((CurrLEDMask & LEDS_LED2) ? 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 NewLEDMask = LEDS_NO_LEDS; - + if (Data[0]) NewLEDMask |= LEDS_LED1; @@ -183,7 +183,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI if (Data[3]) NewLEDMask |= LEDS_LED1; - + LEDs_SetAllLEDs(NewLEDMask); } diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.c b/Demos/Device/ClassDriver/Joystick/Descriptors.c index cc7399288..bd1ba4c9d 100644 --- a/Demos/Device/ClassDriver/Joystick/Descriptors.c +++ b/Demos/Device/ClassDriver/Joystick/Descriptors.c @@ -42,7 +42,7 @@ * 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 * more details on HID report descriptors. - */ + */ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = { /* Use the HID class driver's standard Joystick report. diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 2072e77fb..6109ede2b 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -8,7 +8,7 @@ /* Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) - + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c index 03caa0771..bc015ef22 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c @@ -279,7 +279,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, Address = &ConfigurationDescriptor.HID2_MouseHID; Size = sizeof(USB_HID_Descriptor_HID_t); } - + break; case HID_DTYPE_Report: if (!(wIndex)) diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index b6a2bd7f5..2e7339b5f 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -258,3 +258,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI LEDs_SetAllLEDs(LEDMask); } } + diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c index de60d76d8..cac4853fc 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c @@ -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_END_COLLECTION(0), HID_RI_END_COLLECTION(0), - + /* Keyboard Report */ HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ HID_RI_USAGE(8, 0x06), /* Keyboard */ @@ -280,7 +280,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, break; case HID_DTYPE_HID: Address = &ConfigurationDescriptor.HID_HIDData; - Size = sizeof(USB_HID_Descriptor_HID_t); + Size = sizeof(USB_HID_Descriptor_HID_t); break; case HID_DTYPE_Report: Address = &HIDReport; diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h index 7d9b06680..a0d99d433 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h @@ -62,7 +62,7 @@ /** Size in bytes of each of the HID reporting IN endpoint. */ #define HID_EPSIZE 8 - + /* Enums: */ /** Enum for the HID report IDs used in the device. */ enum diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c index a3c0abe6b..4b6a86d89 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c @@ -148,7 +148,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn uint8_t ButtonStatus_LCL = Buttons_GetStatus(); if (!(ButtonStatus_LCL & BUTTONS_BUTTON1)) - { + { USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData; 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); } + diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c index 66b58a124..fb4673900 100644 --- a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c +++ b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c @@ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa SCSI_ASENSE_WRITE_PROTECTED, 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) */ @@ -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 */ BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS); #endif - + /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ if (IsDataRead == DATA_READ) DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks); @@ -345,3 +345,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac return true; } + diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h index 9d926ea92..3215333ca 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h @@ -73,7 +73,7 @@ /** 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) - + /** Indicates if the disk is write protected or not. */ #define DISK_READ_ONLY false diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c index 717d17286..fb4673900 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c @@ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa SCSI_ASENSE_WRITE_PROTECTED, 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) */ @@ -345,3 +345,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac return true; } + diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h index 94cb6586a..ca78a6f04 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h @@ -81,7 +81,7 @@ /** Indicates if the disk is write protected or not. */ #define DISK_READ_ONLY false - + /* Function Prototypes: */ void SetupHardware(void); diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index adcb2939a..b53b0242d 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -87,16 +87,16 @@ int main(void) if (RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface)) { LEDs_SetAllLEDs(LEDMASK_USB_BUSY); - + RNDIS_Device_ReadPacket(&Ethernet_RNDIS_Interface, &FrameIN.FrameData, &FrameIN.FrameLength); Ethernet_ProcessPacket(&FrameIN, &FrameOUT); - + 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; } - + LEDs_SetAllLEDs(LEDMASK_USB_READY); } diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/SCSI.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/SCSI.c index 66b58a124..fb4673900 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/SCSI.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/SCSI.c @@ -287,7 +287,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa SCSI_ASENSE_WRITE_PROTECTED, 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) */ @@ -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 */ BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS); #endif - + /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ if (IsDataRead == DATA_READ) DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks); @@ -345,3 +345,4 @@ static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfac return true; } + diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c index 975067fd4..402092319 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c @@ -59,7 +59,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = .NotificationEndpointDoubleBank = false, }, }; - + /** 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 * 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; } + diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h index 7bb11d0c3..07b7420bd 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h @@ -47,7 +47,7 @@ #include "Lib/SCSI.h" #include "Lib/DataflashManager.h" - + #include <LUFA/Version.h> #include <LUFA/Drivers/Board/LEDs.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. */ #define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS) - + /** Indicates if the disk is write protected or not. */ #define DISK_READ_ONLY false |