From e9e6730d4999bea6e0eaefc2fce062ef090388b8 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 13 May 2012 21:01:23 +0000 Subject: AppConfigHeaders: Move out the last of the demo/app configurations into new AppConfig.h header files. --- Bootloaders/DFU/BootloaderDFU.h | 8 +-- Bootloaders/DFU/BootloaderDFU.txt | 4 +- Bootloaders/DFU/Config/AppConfig.h | 48 +++++++++++++++++ Demos/Device/ClassDriver/AudioInput/AudioInput.c | 2 +- Demos/Device/ClassDriver/AudioInput/AudioInput.h | 7 +-- Demos/Device/ClassDriver/AudioInput/AudioInput.txt | 5 ++ .../ClassDriver/AudioInput/Config/AppConfig.h | 2 + .../ClassDriver/GenericHID/Config/AppConfig.h | 48 +++++++++++++++++ Demos/Device/ClassDriver/GenericHID/Descriptors.h | 5 +- Demos/Device/ClassDriver/GenericHID/GenericHID.h | 3 +- Demos/Device/ClassDriver/GenericHID/GenericHID.txt | 6 +-- .../ClassDriver/MassStorage/Config/AppConfig.h | 50 ++++++++++++++++++ .../ClassDriver/MassStorage/Lib/DataflashManager.h | 3 ++ Demos/Device/ClassDriver/MassStorage/MassStorage.h | 10 +--- .../Device/ClassDriver/MassStorage/MassStorage.txt | 7 ++- .../MassStorageKeyboard/Config/AppConfig.h | 50 ++++++++++++++++++ .../MassStorageKeyboard/Lib/DataflashManager.h | 3 ++ .../MassStorageKeyboard/MassStorageKeyboard.h | 10 +--- .../MassStorageKeyboard/MassStorageKeyboard.txt | 8 ++- .../ClassDriver/RNDISEthernet/Config/AppConfig.h | 60 ++++++++++++++++++++++ .../RNDISEthernet/Config/NetworkConfig.h | 55 -------------------- .../ClassDriver/RNDISEthernet/Lib/Ethernet.h | 6 --- Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h | 2 +- .../RNDISEthernet/Lib/ProtocolDecoders.h | 2 +- .../ClassDriver/RNDISEthernet/RNDISEthernet.txt | 34 +++++++++--- .../VirtualSerialMassStorage/Config/AppConfig.h | 50 ++++++++++++++++++ .../Lib/DataflashManager.h | 3 ++ .../VirtualSerialMassStorage.h | 10 +--- .../VirtualSerialMassStorage.txt | 8 ++- Demos/Device/LowLevel/AudioInput/AudioInput.c | 2 +- Demos/Device/LowLevel/AudioInput/AudioInput.h | 6 --- .../Device/LowLevel/AudioInput/Config/AppConfig.h | 2 + .../Device/LowLevel/GenericHID/Config/AppConfig.h | 48 +++++++++++++++++ Demos/Device/LowLevel/GenericHID/Descriptors.h | 5 +- Demos/Device/LowLevel/GenericHID/GenericHID.h | 3 +- Demos/Device/LowLevel/GenericHID/GenericHID.txt | 6 +-- .../Device/LowLevel/MassStorage/Config/AppConfig.h | 50 ++++++++++++++++++ .../LowLevel/MassStorage/Lib/DataflashManager.h | 7 +-- Demos/Device/LowLevel/MassStorage/MassStorage.h | 4 +- Demos/Device/LowLevel/MassStorage/MassStorage.txt | 7 ++- Demos/Device/LowLevel/Mouse/Mouse.h | 1 + .../LowLevel/RNDISEthernet/Config/AppConfig.h | 60 ++++++++++++++++++++++ .../LowLevel/RNDISEthernet/Config/NetworkConfig.h | 55 -------------------- Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h | 6 --- Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h | 3 +- .../LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h | 3 +- .../LowLevel/RNDISEthernet/RNDISEthernet.txt | 32 ++++++++---- .../ClassDriver/AudioOutputHost/AudioOutputHost.c | 3 ++ .../ClassDriver/AudioOutputHost/AudioOutputHost.h | 14 +---- .../AudioOutputHost/AudioOutputHost.txt | 9 +++- .../ClassDriver/AudioOutputHost/Config/AppConfig.h | 51 ++++++++++++++++++ .../LowLevel/AudioOutputHost/AudioOutputHost.c | 3 ++ .../LowLevel/AudioOutputHost/AudioOutputHost.h | 13 +---- .../LowLevel/AudioOutputHost/AudioOutputHost.txt | 9 +++- .../LowLevel/AudioOutputHost/Config/AppConfig.h | 51 ++++++++++++++++++ LUFA.pnproj | 2 +- Projects/MIDIToneGenerator/Config/AppConfig.h | 48 +++++++++++++++++ Projects/MIDIToneGenerator/MIDIToneGenerator.h | 4 +- Projects/MIDIToneGenerator/MIDIToneGenerator.txt | 2 +- 59 files changed, 760 insertions(+), 258 deletions(-) create mode 100644 Bootloaders/DFU/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/GenericHID/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/MassStorage/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Config/AppConfig.h delete mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Config/NetworkConfig.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/AppConfig.h create mode 100644 Demos/Device/LowLevel/GenericHID/Config/AppConfig.h create mode 100644 Demos/Device/LowLevel/MassStorage/Config/AppConfig.h create mode 100644 Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h delete mode 100644 Demos/Device/LowLevel/RNDISEthernet/Config/NetworkConfig.h create mode 100644 Demos/Host/ClassDriver/AudioOutputHost/Config/AppConfig.h create mode 100644 Demos/Host/LowLevel/AudioOutputHost/Config/AppConfig.h create mode 100644 Projects/MIDIToneGenerator/Config/AppConfig.h diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index 46b70c0e9..ffd330d7f 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -49,18 +49,12 @@ #include "Descriptors.h" #include "BootloaderAPI.h" + #include "Config/AppConfig.h" #include #include /* Macros: */ - /** Configuration define. Define this token to true to case the bootloader to reject all memory commands - * until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this - * can protect the AVR's firmware from being dumped from a secured AVR. When false, memory operations are - * allowed at any time. - */ - #define SECURE_MODE false - /** Major bootloader version number. */ #define BOOTLOADER_VERSION_MINOR 2 diff --git a/Bootloaders/DFU/BootloaderDFU.txt b/Bootloaders/DFU/BootloaderDFU.txt index c7e1b1ed4..a4cc6e201 100644 --- a/Bootloaders/DFU/BootloaderDFU.txt +++ b/Bootloaders/DFU/BootloaderDFU.txt @@ -140,10 +140,10 @@ * * * SECURE_MODE - * BootloaderDFU.h + * AppConfig.h * If defined to \c true, the bootloader will not accept any memory commands other than a chip erase on start-up, until an * erase has been performed. This can be used in conjunction with the AVR's lockbits to prevent the AVRs firmware from - * being dumped by unauthorized persons. + * being dumped by unauthorized persons. When false, all memory operations are allowed at any time. * * */ diff --git a/Bootloaders/DFU/Config/AppConfig.h b/Bootloaders/DFU/Config/AppConfig.h new file mode 100644 index 000000000..26a79b42c --- /dev/null +++ b/Bootloaders/DFU/Config/AppConfig.h @@ -0,0 +1,48 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define SECURE_MODE false + +#endif \ No newline at end of file diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 867a09eef..953ecf8b6 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -94,7 +94,7 @@ void SetupHardware(void) USB_Init(); /* Start the ADC conversion in free running mode */ - ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_MUX_MASK); + ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL)); } /** ISR to handle the reloading of the data endpoint with the next sample. */ diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h index 6bf5e882a..fb5e69c8b 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h @@ -49,14 +49,9 @@ #include #include "Descriptors.h" + #include "Config/AppConfig.h" /* Macros: */ - /** ADC channel number for the microphone input. */ - #define MIC_IN_ADC_CHANNEL 2 - - /** ADC channel MUX mask for the microphone input. */ - #define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2 - /** Maximum audio sample value for the microphone input. */ #define SAMPLE_MAX_RANGE 0xFFFF diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.txt b/Demos/Device/ClassDriver/AudioInput/AudioInput.txt index 17b476e24..654536c80 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.txt +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.txt @@ -72,6 +72,11 @@ * Description: * * + * MIC_IN_ADC_CHANNEL + * AppConfig.h + * Sets the ADC channel used by the demo for the input audio samples from an attached microphone. + * + * * USE_TEST_TONE * AppConfig.h * When defined, this alters the demo to produce a square wave test tone when the first board button is pressed diff --git a/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h b/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h index 01101649a..7702e259a 100644 --- a/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h +++ b/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h @@ -43,6 +43,8 @@ #ifndef _APP_CONFIG_H_ #define _APP_CONFIG_H_ + #define MIC_IN_ADC_CHANNEL 2 + #define MICROPHONE_BIASED_TO_HALF_RAIL #define USE_TEST_TONE diff --git a/Demos/Device/ClassDriver/GenericHID/Config/AppConfig.h b/Demos/Device/ClassDriver/GenericHID/Config/AppConfig.h new file mode 100644 index 000000000..fccd16e3b --- /dev/null +++ b/Demos/Device/ClassDriver/GenericHID/Config/AppConfig.h @@ -0,0 +1,48 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define GENERIC_REPORT_SIZE 8 + +#endif \ No newline at end of file diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.h b/Demos/Device/ClassDriver/GenericHID/Descriptors.h index 0b9ec8f71..5e2740478 100644 --- a/Demos/Device/ClassDriver/GenericHID/Descriptors.h +++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.h @@ -40,6 +40,8 @@ #include #include + + #include "Config/AppConfig.h" /* Type Defines: */ /** Type define for the device configuration descriptor structure. This must be defined in the @@ -63,9 +65,6 @@ /** Size in bytes of the Generic HID reporting endpoint. */ #define GENERIC_EPSIZE 8 - /** Size in bytes of the Generic HID reports (including report ID byte). */ - #define GENERIC_REPORT_SIZE 8 - /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index ed3bb535c..7512fa918 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -44,7 +44,8 @@ #include #include "Descriptors.h" - + #include "Config/AppConfig.h" + #include #include #include diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.txt b/Demos/Device/ClassDriver/GenericHID/GenericHID.txt index db8eb1cec..998471a2c 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.txt +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.txt @@ -67,9 +67,9 @@ * * * GENERIC_REPORT_SIZE - * Descriptors.h - * This token defines the size of the device reports, both sent and received. The value must be an - * integer ranging from 1 to 255. + * AppConfig.h + * This token defines the size of the device reports, both sent and received (including report ID byte). The value + * must be an integer ranging from 1 to 255. * * */ diff --git a/Demos/Device/ClassDriver/MassStorage/Config/AppConfig.h b/Demos/Device/ClassDriver/MassStorage/Config/AppConfig.h new file mode 100644 index 000000000..2582279ea --- /dev/null +++ b/Demos/Device/ClassDriver/MassStorage/Config/AppConfig.h @@ -0,0 +1,50 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define TOTAL_LUNS 1 + + #define DISK_READ_ONLY false + +#endif \ No newline at end of file diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h index 18606eaf1..a7c6105fa 100644 --- a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h +++ b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h @@ -65,6 +65,9 @@ */ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) + /** 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) + /* Function Prototypes: */ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h index da01449d0..bd55dabfb 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h @@ -47,6 +47,7 @@ #include "Lib/SCSI.h" #include "Lib/DataflashManager.h" + #include "Config/AppConfig.h" #include #include @@ -68,15 +69,6 @@ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ #define LEDMASK_USB_BUSY LEDS_LED2 - /** Total number of logical drives within the device - must be non-zero. */ - #define TOTAL_LUNS 1 - - /** 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 - /* Function Prototypes: */ void SetupHardware(void); diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.txt b/Demos/Device/ClassDriver/MassStorage/MassStorage.txt index e84e58427..c2761a38d 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.txt +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.txt @@ -83,10 +83,15 @@ * * * TOTAL_LUNS - * MassStorage.h + * AppConfig.h * Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive - * this can be set to any positive non-zero amount. * + * + * DISK_READ_ONLY + * AppConfig.h + * Configuration define, indicating if the disk should be write protected or not. + * * */ diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Config/AppConfig.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Config/AppConfig.h new file mode 100644 index 000000000..2582279ea --- /dev/null +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Config/AppConfig.h @@ -0,0 +1,50 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define TOTAL_LUNS 1 + + #define DISK_READ_ONLY false + +#endif \ No newline at end of file diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h index f7552dc4a..e5d25e0a9 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h @@ -63,6 +63,9 @@ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) + /** 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) + /* Function Prototypes: */ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h index 8f8fa0029..dae07f9f5 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h @@ -50,6 +50,7 @@ #include "Lib/SCSI.h" #include "Lib/DataflashManager.h" + #include "Config/AppConfig.h" #include #include @@ -73,15 +74,6 @@ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ #define LEDMASK_USB_BUSY LEDS_LED2 - /** Total number of logical drives within the device - must be non-zero. */ - #define TOTAL_LUNS 1 - - /** 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 - /* Function Prototypes: */ void SetupHardware(void); diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt index ba0415b85..01bf5772c 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt @@ -84,10 +84,14 @@ * * * TOTAL_LUNS - * MassStorage.h + * AppConfig.h * Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive - * this can be set to any positive non-zero amount. * - * + * + * DISK_READ_ONLY + * AppConfig.h + * Configuration define, indicating if the disk should be write protected or not. + * */ diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Config/AppConfig.h b/Demos/Device/ClassDriver/RNDISEthernet/Config/AppConfig.h new file mode 100644 index 000000000..3b1ca5366 --- /dev/null +++ b/Demos/Device/ClassDriver/RNDISEthernet/Config/AppConfig.h @@ -0,0 +1,60 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define CLIENT_IP_ADDRESS { 10, 0, 0, 1} + #define SERVER_IP_ADDRESS { 10, 0, 0, 2} + + #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00} + #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01} + + #define NO_DECODE_ETHERNET + #define NO_DECODE_ARP + #define NO_DECODE_IP + #define NO_DECODE_ICMP + #define NO_DECODE_TCP + #define NO_DECODE_UDP + #define NO_DECODE_DHCP + +#endif diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Config/NetworkConfig.h b/Demos/Device/ClassDriver/RNDISEthernet/Config/NetworkConfig.h deleted file mode 100644 index e6ac093ad..000000000 --- a/Demos/Device/ClassDriver/RNDISEthernet/Config/NetworkConfig.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 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 - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Network Configuration Header File - * - * This header file is used to configure various portions of the - * network stack used by the application. - * - * For information on what each token does, refer to the LUFA - * manual section "Summary of Compile Tokens". - */ - -#ifndef _NETWORK_CONFIG_H_ -#define _NETWORK_CONFIG_H_ - - #define CLIENT_IP_ADDRESS { 10, 0, 0, 1} - #define SERVER_IP_ADDRESS { 10, 0, 0, 2} - - #define NO_DECODE_ETHERNET - #define NO_DECODE_ARP - #define NO_DECODE_IP - #define NO_DECODE_ICMP - #define NO_DECODE_TCP - #define NO_DECODE_UDP - #define NO_DECODE_DHCP - -#endif diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h index aeebd0ac8..86e1a4038 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h @@ -52,12 +52,6 @@ #include "IP.h" /* Macros: */ - /** Physical MAC address of the USB RNDIS network adapter. */ - #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00} - - /** Physical MAC address of the virtual server on the network. */ - #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01} - /** Physical MAC address of the network broadcast address. */ #define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h index 2d89ad52f..d1a709fbd 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h @@ -43,7 +43,7 @@ #include "EthernetProtocols.h" #include "Ethernet.h" #include "ProtocolDecoders.h" - #include "Config/NetworkConfig.h" + #include "Config/AppConfig.h" /* Macros: */ /** Protocol IP address of the broadcast address. */ diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h index aadbed822..bb640928d 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h @@ -45,7 +45,7 @@ #include "EthernetProtocols.h" #include "Ethernet.h" - #include "Config/NetworkConfig.h" + #include "Config/AppConfig.h" /* Function Prototypes: */ void DecodeEthernetFrameHeader(void* InDataStart); diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt index f05ec65c2..a458370da 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt @@ -84,38 +84,58 @@ * Description: * * + * CLIENT_IP_ADDRESS + * AppConfig.h + * Configures the IP address given to the client (PC) via the DHCP server. + * + * + * SERVER_IP_ADDRESS + * AppConfig.h + * Configures the IP address of the virtual server. + * + * + * ADAPTER_MAC_ADDRESS + * AppConfig.h + * Configures the MAC address of the RNDIS adapter on the host (PC) side. + * + * + * SERVER_MAC_ADDRESS + * AppConfig.h + * Configures the MAC address of the virtual server on the network. + * + * * NO_DECODE_ETHERNET - * NetworkConfig.h + * AppConfig.h * When defined, received Ethernet headers will not be decoded and printed to the device serial port. * * * NO_DECODE_ARP - * NetworkConfig.h + * AppConfig.h * When defined, received ARP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_IP - * NetworkConfig.h + * AppConfig.h * When defined, received IP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_ICMP - * NetworkConfig.h + * AppConfig.h * When defined, received ICMP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_TCP - * NetworkConfig.h + * AppConfig.h * When defined, received TCP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_UDP - * NetworkConfig.h + * AppConfig.h * When defined, received UDP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_DHCP - * NetworkConfig.h + * AppConfig.h * When defined, received DHCP headers will not be decoded and printed to the device serial port. * * diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/AppConfig.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/AppConfig.h new file mode 100644 index 000000000..2582279ea --- /dev/null +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/AppConfig.h @@ -0,0 +1,50 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define TOTAL_LUNS 1 + + #define DISK_READ_ONLY false + +#endif \ No newline at end of file diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/DataflashManager.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/DataflashManager.h index 1d1238658..4b26c245e 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/DataflashManager.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/DataflashManager.h @@ -65,6 +65,9 @@ */ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) + /** 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) + /* Function Prototypes: */ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, const uint32_t BlockAddress, diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h index 486351b2f..49d63d087 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h @@ -47,6 +47,7 @@ #include "Lib/SCSI.h" #include "Lib/DataflashManager.h" + #include "Config/AppConfig.h" #include #include @@ -69,15 +70,6 @@ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ #define LEDMASK_USB_BUSY LEDS_LED2 - /** Total number of logical drives within the device - must be non-zero. */ - #define TOTAL_LUNS 1 - - /** 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 - /* Function Prototypes: */ void SetupHardware(void); void CheckJoystickMovement(void); diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt index ff1d3c26e..088f20ac4 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt @@ -77,10 +77,14 @@ * * * TOTAL_LUNS - * MassStorage.h + * AppConfig.h * Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive - * this can be set to any positive non-zero amount. * - * + * + * DISK_READ_ONLY + * AppConfig.h + * Configuration define, indicating if the disk should be write protected or not. + * */ diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index eb9c4b57c..925517b39 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -77,7 +77,7 @@ void SetupHardware(void) USB_Init(); /* Start the ADC conversion in free running mode */ - ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_MUX_MASK); + ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL)); } /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.h b/Demos/Device/LowLevel/AudioInput/AudioInput.h index fc2093716..0539e0694 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.h +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.h @@ -52,12 +52,6 @@ #include /* Macros: */ - /** ADC channel number for the microphone input. */ - #define MIC_IN_ADC_CHANNEL 2 - - /** ADC channel MUX mask for the microphone input. */ - #define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2 - /** Maximum audio sample value for the microphone input. */ #define SAMPLE_MAX_RANGE 0xFFFF diff --git a/Demos/Device/LowLevel/AudioInput/Config/AppConfig.h b/Demos/Device/LowLevel/AudioInput/Config/AppConfig.h index 01101649a..7702e259a 100644 --- a/Demos/Device/LowLevel/AudioInput/Config/AppConfig.h +++ b/Demos/Device/LowLevel/AudioInput/Config/AppConfig.h @@ -43,6 +43,8 @@ #ifndef _APP_CONFIG_H_ #define _APP_CONFIG_H_ + #define MIC_IN_ADC_CHANNEL 2 + #define MICROPHONE_BIASED_TO_HALF_RAIL #define USE_TEST_TONE diff --git a/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h b/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h new file mode 100644 index 000000000..fccd16e3b --- /dev/null +++ b/Demos/Device/LowLevel/GenericHID/Config/AppConfig.h @@ -0,0 +1,48 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define GENERIC_REPORT_SIZE 8 + +#endif \ No newline at end of file diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.h b/Demos/Device/LowLevel/GenericHID/Descriptors.h index e47220a1c..d9b7d42d3 100644 --- a/Demos/Device/LowLevel/GenericHID/Descriptors.h +++ b/Demos/Device/LowLevel/GenericHID/Descriptors.h @@ -41,6 +41,8 @@ #include + #include "Config/AppConfig.h" + /* Type Defines: */ /** Type define for the device configuration descriptor structure. This must be defined in the * application code, as the configuration descriptor contains several sub-descriptors which @@ -67,9 +69,6 @@ /** Size in bytes of the Generic HID reporting endpoint. */ #define GENERIC_EPSIZE 8 - /** Size in bytes of the Generic HID reports (including report ID byte). */ - #define GENERIC_REPORT_SIZE 8 - /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h index 0fe06bb67..29bcabcbd 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.h +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h @@ -45,7 +45,8 @@ #include #include "Descriptors.h" - + #include "Config/AppConfig.h" + #include #include #include diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.txt b/Demos/Device/LowLevel/GenericHID/GenericHID.txt index db8eb1cec..998471a2c 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.txt +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.txt @@ -67,9 +67,9 @@ * * * GENERIC_REPORT_SIZE - * Descriptors.h - * This token defines the size of the device reports, both sent and received. The value must be an - * integer ranging from 1 to 255. + * AppConfig.h + * This token defines the size of the device reports, both sent and received (including report ID byte). The value + * must be an integer ranging from 1 to 255. * * */ diff --git a/Demos/Device/LowLevel/MassStorage/Config/AppConfig.h b/Demos/Device/LowLevel/MassStorage/Config/AppConfig.h new file mode 100644 index 000000000..2582279ea --- /dev/null +++ b/Demos/Device/LowLevel/MassStorage/Config/AppConfig.h @@ -0,0 +1,50 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define TOTAL_LUNS 1 + + #define DISK_READ_ONLY false + +#endif \ No newline at end of file diff --git a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h index d70a86c19..7612ddadb 100644 --- a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h +++ b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h @@ -45,7 +45,7 @@ #include #include #include - + /* Preprocessor Checks: */ #if (DATAFLASH_PAGE_SIZE % 16) #error Dataflash page size must be a multiple of 16 bytes. @@ -65,11 +65,6 @@ */ #define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) - /** Total number of Logical Units (drives) in the device. The total device capacity is shared equally between - * each drive - this can be set to any positive non-zero amount. - */ - #define TOTAL_LUNS 1 - /** 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) diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h index c1573706d..e457a6ed5 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.h +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h @@ -46,6 +46,7 @@ #include "Lib/SCSI.h" #include "Lib/DataflashManager.h" + #include "Config/AppConfig.h" #include #include @@ -68,9 +69,6 @@ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ #define LEDMASK_USB_BUSY LEDS_LED2 - /** Indicates if the disk is write protected or not. */ - #define DISK_READ_ONLY false - /* Global Variables: */ extern MS_CommandBlockWrapper_t CommandBlock; extern MS_CommandStatusWrapper_t CommandStatus; diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.txt b/Demos/Device/LowLevel/MassStorage/MassStorage.txt index 8d0488265..35b47a46a 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.txt +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.txt @@ -83,10 +83,15 @@ * * * TOTAL_LUNS - * MassStorage.h + * AppConfig.h * Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive * - this can be set to any positive non-zero amount. * + * + * DISK_READ_ONLY + * AppConfig.h + * Indicates if the disk should be write protected or not. + * * */ diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h index c04f457a1..182ea2511 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.h +++ b/Demos/Device/LowLevel/Mouse/Mouse.h @@ -45,6 +45,7 @@ #include #include "Descriptors.h" + #include "Config/AppConfig.h" #include #include diff --git a/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h b/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h new file mode 100644 index 000000000..3b1ca5366 --- /dev/null +++ b/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h @@ -0,0 +1,60 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define CLIENT_IP_ADDRESS { 10, 0, 0, 1} + #define SERVER_IP_ADDRESS { 10, 0, 0, 2} + + #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00} + #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01} + + #define NO_DECODE_ETHERNET + #define NO_DECODE_ARP + #define NO_DECODE_IP + #define NO_DECODE_ICMP + #define NO_DECODE_TCP + #define NO_DECODE_UDP + #define NO_DECODE_DHCP + +#endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/Config/NetworkConfig.h b/Demos/Device/LowLevel/RNDISEthernet/Config/NetworkConfig.h deleted file mode 100644 index e6ac093ad..000000000 --- a/Demos/Device/LowLevel/RNDISEthernet/Config/NetworkConfig.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 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 - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Network Configuration Header File - * - * This header file is used to configure various portions of the - * network stack used by the application. - * - * For information on what each token does, refer to the LUFA - * manual section "Summary of Compile Tokens". - */ - -#ifndef _NETWORK_CONFIG_H_ -#define _NETWORK_CONFIG_H_ - - #define CLIENT_IP_ADDRESS { 10, 0, 0, 1} - #define SERVER_IP_ADDRESS { 10, 0, 0, 2} - - #define NO_DECODE_ETHERNET - #define NO_DECODE_ARP - #define NO_DECODE_IP - #define NO_DECODE_ICMP - #define NO_DECODE_TCP - #define NO_DECODE_UDP - #define NO_DECODE_DHCP - -#endif diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h index 37d482de2..06be68926 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h @@ -50,12 +50,6 @@ #include "IP.h" /* Macros: */ - /** Physical MAC address of the USB RNDIS network adapter. */ - #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00} - - /** Physical MAC address of the virtual server on the network. */ - #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01} - /** Physical MAC address of the network broadcast address. */ #define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h index b878693bd..18c1c812b 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h @@ -43,8 +43,7 @@ #include "EthernetProtocols.h" #include "Ethernet.h" #include "ProtocolDecoders.h" - - #include "Config/NetworkConfig.h" + #include "Config/AppConfig.h" /* Macros: */ /** Protocol IP address of the broadcast address. */ diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h index b3ad1affd..bb640928d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h @@ -45,8 +45,7 @@ #include "EthernetProtocols.h" #include "Ethernet.h" - - #include "Config/NetworkConfig.h" + #include "Config/AppConfig.h" /* Function Prototypes: */ void DecodeEthernetFrameHeader(void* InDataStart); diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt index 08cb05324..a458370da 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt @@ -85,47 +85,57 @@ * * * CLIENT_IP_ADDRESS - * NetworkConfig.h + * AppConfig.h * Configures the IP address given to the client (PC) via the DHCP server. * * - * HOST_IP_ADDRESS - * NetworkConfig.h - * Configures the IP address used in the virtual server for communications to/from the client. + * SERVER_IP_ADDRESS + * AppConfig.h + * Configures the IP address of the virtual server. + * + * + * ADAPTER_MAC_ADDRESS + * AppConfig.h + * Configures the MAC address of the RNDIS adapter on the host (PC) side. + * + * + * SERVER_MAC_ADDRESS + * AppConfig.h + * Configures the MAC address of the virtual server on the network. * * * NO_DECODE_ETHERNET - * NetworkConfig.h + * AppConfig.h * When defined, received Ethernet headers will not be decoded and printed to the device serial port. * * * NO_DECODE_ARP - * NetworkConfig.h + * AppConfig.h * When defined, received ARP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_IP - * NetworkConfig.h + * AppConfig.h * When defined, received IP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_ICMP - * NetworkConfig.h + * AppConfig.h * When defined, received ICMP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_TCP - * NetworkConfig.h + * AppConfig.h * When defined, received TCP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_UDP - * NetworkConfig.h + * AppConfig.h * When defined, received UDP headers will not be decoded and printed to the device serial port. * * * NO_DECODE_DHCP - * NetworkConfig.h + * AppConfig.h * When defined, received DHCP headers will not be decoded and printed to the device serial port. * * diff --git a/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.c b/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.c index 833be1b2c..5f00568f5 100644 --- a/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.c +++ b/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.c @@ -128,6 +128,9 @@ void SetupHardware(void) /* Create a stdio stream for the serial port for stdin and stdout */ Serial_CreateStream(NULL); + + /* Start the ADC conversion in free running mode */ + ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL)); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.h b/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.h index 41a4e9f1d..fa4801bfb 100644 --- a/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.h +++ b/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.h @@ -51,26 +51,16 @@ #include #include #include + + #include "Config/AppConfig.h" /* Macros: */ - /** ADC channel number for the microphone input. */ - #define MIC_IN_ADC_CHANNEL 2 - - /** ADC channel MUX mask for the microphone input. */ - #define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2 - /** Maximum audio sample value for the microphone input. */ #define SAMPLE_MAX_RANGE 0xFFFF /** Maximum ADC range for the microphone input. */ #define ADC_MAX_RANGE 0x3FF - /** Defined to indicate that the microphone input voltage is biased to half the ADC reference voltage. */ - #define MICROPHONE_BIASED_TO_HALF_RAIL - - /** Defined to generate test tone when a button is pressed, rather than use a microphone for audio samples. */ - #define USE_TEST_TONE - /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ #define LEDMASK_USB_NOTREADY LEDS_LED1 diff --git a/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.txt b/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.txt index c28b61e44..b2cd2a8c8 100644 --- a/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.txt +++ b/Demos/Host/ClassDriver/AudioOutputHost/AudioOutputHost.txt @@ -63,14 +63,19 @@ * Description: * * + * MIC_IN_ADC_CHANNEL + * AppConfig.h + * Sets the ADC channel used by the demo for the input audio samples from an attached microphone. + * + * * USE_TEST_TONE - * AudioOutputHost.h + * AppConfig.h * When defined, this alters the demo to produce a square wave test tone when the first board button is pressed * instead of sampling the board microphone. * * * MICROPHONE_BIASED_TO_HALF_RAIL - * AudioOutputHost.h + * AppConfig.h * When defined, this alters the demo so that the half VCC bias of the microphone input is subtracted. * * diff --git a/Demos/Host/ClassDriver/AudioOutputHost/Config/AppConfig.h b/Demos/Host/ClassDriver/AudioOutputHost/Config/AppConfig.h new file mode 100644 index 000000000..7702e259a --- /dev/null +++ b/Demos/Host/ClassDriver/AudioOutputHost/Config/AppConfig.h @@ -0,0 +1,51 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define MIC_IN_ADC_CHANNEL 2 + + #define MICROPHONE_BIASED_TO_HALF_RAIL + #define USE_TEST_TONE + +#endif \ No newline at end of file diff --git a/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.c b/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.c index a1f255f16..eddd38f97 100644 --- a/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.c +++ b/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.c @@ -74,6 +74,9 @@ void SetupHardware(void) /* Create a stdio stream for the serial port for stdin and stdout */ Serial_CreateStream(NULL); + + /* Start the ADC conversion in free running mode */ + ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL)); } /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and diff --git a/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.h b/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.h index 7f980cd8b..2c475821c 100644 --- a/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.h +++ b/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.h @@ -53,26 +53,15 @@ #include #include "ConfigDescriptor.h" + #include "Config/AppConfig.h" /* Macros: */ - /** ADC channel number for the microphone input. */ - #define MIC_IN_ADC_CHANNEL 2 - - /** ADC channel MUX mask for the microphone input. */ - #define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2 - /** Maximum audio sample value for the microphone input. */ #define SAMPLE_MAX_RANGE 0xFFFF /** Maximum ADC range for the microphone input. */ #define ADC_MAX_RANGE 0x3FF - /** Defined to indicate that the microphone input voltage is biased to half the ADC reference voltage. */ - #define MICROPHONE_BIASED_TO_HALF_RAIL - - /** Defined to generate test tone when a button is pressed, rather than use a microphone for audio samples. */ - #define USE_TEST_TONE - /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ #define LEDMASK_USB_NOTREADY LEDS_LED1 diff --git a/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.txt b/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.txt index c28b61e44..b2cd2a8c8 100644 --- a/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.txt +++ b/Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.txt @@ -63,14 +63,19 @@ * Description: * * + * MIC_IN_ADC_CHANNEL + * AppConfig.h + * Sets the ADC channel used by the demo for the input audio samples from an attached microphone. + * + * * USE_TEST_TONE - * AudioOutputHost.h + * AppConfig.h * When defined, this alters the demo to produce a square wave test tone when the first board button is pressed * instead of sampling the board microphone. * * * MICROPHONE_BIASED_TO_HALF_RAIL - * AudioOutputHost.h + * AppConfig.h * When defined, this alters the demo so that the half VCC bias of the microphone input is subtracted. * * diff --git a/Demos/Host/LowLevel/AudioOutputHost/Config/AppConfig.h b/Demos/Host/LowLevel/AudioOutputHost/Config/AppConfig.h new file mode 100644 index 000000000..7702e259a --- /dev/null +++ b/Demos/Host/LowLevel/AudioOutputHost/Config/AppConfig.h @@ -0,0 +1,51 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define MIC_IN_ADC_CHANNEL 2 + + #define MICROPHONE_BIASED_TO_HALF_RAIL + #define USE_TEST_TONE + +#endif \ No newline at end of file diff --git a/LUFA.pnproj b/LUFA.pnproj index e2b9f3948..520063da5 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/Projects/MIDIToneGenerator/Config/AppConfig.h b/Projects/MIDIToneGenerator/Config/AppConfig.h new file mode 100644 index 000000000..381efe089 --- /dev/null +++ b/Projects/MIDIToneGenerator/Config/AppConfig.h @@ -0,0 +1,48 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define MAX_SIMULTANEOUS_NOTES 3 + +#endif \ No newline at end of file diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.h b/Projects/MIDIToneGenerator/MIDIToneGenerator.h index 540c59a17..db11d5e0d 100644 --- a/Projects/MIDIToneGenerator/MIDIToneGenerator.h +++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.h @@ -45,6 +45,7 @@ #include #include "Descriptors.h" + #include "Config/AppConfig.h" #include #include @@ -76,9 +77,6 @@ /** Lowest valid MIDI pitch index */ #define BASE_PITCH_INDEX 21 - /** Maximum number of MIDI notes that can be played simultaneously */ - #define MAX_SIMULTANEOUS_NOTES 3 - /** Number of samples in the virtual sample table (can be expanded to lower maximum frequency, but allow for * more simultaneous notes due to the reduced amount of processing time needed when the samples are spaced out) */ diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.txt b/Projects/MIDIToneGenerator/MIDIToneGenerator.txt index 6332a244e..2650a9c0e 100644 --- a/Projects/MIDIToneGenerator/MIDIToneGenerator.txt +++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.txt @@ -64,7 +64,7 @@ * * * MAX_SIMULTANEOUS_NOTES - * MIDIToneGenerator.h + * AppConfig.h * Sets the maximum number of MIDI notes that can be generated simultaneously. More notes require more processing time, * and thus a value that is too high will cause audiable sound distortion due to insufficient CPU time. * -- cgit v1.2.3