AppConfigHeaders: Move out the last of the demo/app configurations into new AppConfig.h header files.

pull/1469/head
Dean Camera 13 years ago
parent ae6a514929
commit e9e6730d49

@ -49,18 +49,12 @@
#include "Descriptors.h" #include "Descriptors.h"
#include "BootloaderAPI.h" #include "BootloaderAPI.h"
#include "Config/AppConfig.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>
/* Macros: */ /* 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. */ /** Major bootloader version number. */
#define BOOTLOADER_VERSION_MINOR 2 #define BOOTLOADER_VERSION_MINOR 2

@ -140,10 +140,10 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>SECURE_MODE</td> * <td>SECURE_MODE</td>
* <td>BootloaderDFU.h</td> * <td>AppConfig.h</td>
* <td>If defined to \c true, the bootloader will not accept any memory commands other than a chip erase on start-up, until an * <td>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 * 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.</td> * being dumped by unauthorized persons. When false, all memory operations are allowed at any time.</td>
* </tr> * </tr>
* </table> * </table>
*/ */

@ -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

@ -94,7 +94,7 @@ void SetupHardware(void)
USB_Init(); USB_Init();
/* Start the ADC conversion in free running mode */ /* 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. */ /** ISR to handle the reloading of the data endpoint with the next sample. */

@ -49,14 +49,9 @@
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include "Descriptors.h" #include "Descriptors.h"
#include "Config/AppConfig.h"
/* Macros: */ /* 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. */ /** Maximum audio sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF #define SAMPLE_MAX_RANGE 0xFFFF

@ -72,6 +72,11 @@
* <td><b>Description:</b></td> * <td><b>Description:</b></td>
* </tr> * </tr>
* <tr> * <tr>
* <td>MIC_IN_ADC_CHANNEL</td>
* <td>AppConfig.h</td>
* <td>Sets the ADC channel used by the demo for the input audio samples from an attached microphone.</td>
* </tr>
* <tr>
* <td>USE_TEST_TONE</td> * <td>USE_TEST_TONE</td>
* <td>AppConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, this alters the demo to produce a square wave test tone when the first board button is pressed * <td>When defined, this alters the demo to produce a square wave test tone when the first board button is pressed

@ -43,6 +43,8 @@
#ifndef _APP_CONFIG_H_ #ifndef _APP_CONFIG_H_
#define _APP_CONFIG_H_ #define _APP_CONFIG_H_
#define MIC_IN_ADC_CHANNEL 2
#define MICROPHONE_BIASED_TO_HALF_RAIL #define MICROPHONE_BIASED_TO_HALF_RAIL
#define USE_TEST_TONE #define USE_TEST_TONE

@ -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

@ -40,6 +40,8 @@
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include "Config/AppConfig.h"
/* Type Defines: */ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the /** 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. */ /** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 8 #define GENERIC_EPSIZE 8
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE 8
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex, const uint8_t wIndex,

@ -44,7 +44,8 @@
#include <string.h> #include <string.h>
#include "Descriptors.h" #include "Descriptors.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>

@ -67,9 +67,9 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>GENERIC_REPORT_SIZE</td> * <td>GENERIC_REPORT_SIZE</td>
* <td>Descriptors.h</td> * <td>AppConfig.h</td>
* <td>This token defines the size of the device reports, both sent and received. The value must be an * <td>This token defines the size of the device reports, both sent and received (including report ID byte). The value
* integer ranging from 1 to 255.</td> * must be an integer ranging from 1 to 255.</td>
* </tr> * </tr>
* </table> * </table>
*/ */

@ -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

@ -65,6 +65,9 @@
*/ */
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) #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: */ /* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress, const uint32_t BlockAddress,

@ -47,6 +47,7 @@
#include "Lib/SCSI.h" #include "Lib/SCSI.h"
#include "Lib/DataflashManager.h" #include "Lib/DataflashManager.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
@ -68,15 +69,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2 #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: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);

@ -83,10 +83,15 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>TOTAL_LUNS</td> * <td>TOTAL_LUNS</td>
* <td>MassStorage.h</td> * <td>AppConfig.h</td>
* <td>Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive - * <td>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.</td> * this can be set to any positive non-zero amount.</td>
* </tr> * </tr>
* <tr>
* <td>DISK_READ_ONLY</td>
* <td>AppConfig.h</td>
* <td>Configuration define, indicating if the disk should be write protected or not.</td>
* </tr>
* </table> * </table>
*/ */

@ -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

@ -63,6 +63,9 @@
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */ /** 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) #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: */ /* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress, const uint32_t BlockAddress,

@ -50,6 +50,7 @@
#include "Lib/SCSI.h" #include "Lib/SCSI.h"
#include "Lib/DataflashManager.h" #include "Lib/DataflashManager.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/Board/Joystick.h> #include <LUFA/Drivers/Board/Joystick.h>
@ -73,15 +74,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2 #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: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);

@ -84,10 +84,14 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>TOTAL_LUNS</td> * <td>TOTAL_LUNS</td>
* <td>MassStorage.h</td> * <td>AppConfig.h</td>
* <td>Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive - * <td>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.</td> * this can be set to any positive non-zero amount.</td>
* </tr> * </tr>
* </table> * <tr>
* <td>DISK_READ_ONLY</td>
* <td>AppConfig.h</td>
* <td>Configuration define, indicating if the disk should be write protected or not.</td>
* </tr>
*/ */

@ -29,21 +29,26 @@
*/ */
/** \file /** \file
* \brief Network Configuration Header File * \brief Application Configuration Header File
* *
* This header file is used to configure various portions of the * This is a header file which is be used to configure some of
* network stack used by the application. * 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 LUFA * For information on what each token does, refer to the
* manual section "Summary of Compile Tokens". * \ref Sec_Options section of the application documentation.
*/ */
#ifndef _NETWORK_CONFIG_H_ #ifndef _APP_CONFIG_H_
#define _NETWORK_CONFIG_H_ #define _APP_CONFIG_H_
#define CLIENT_IP_ADDRESS { 10, 0, 0, 1} #define CLIENT_IP_ADDRESS { 10, 0, 0, 1}
#define SERVER_IP_ADDRESS { 10, 0, 0, 2} #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_ETHERNET
#define NO_DECODE_ARP #define NO_DECODE_ARP
#define NO_DECODE_IP #define NO_DECODE_IP

@ -52,12 +52,6 @@
#include "IP.h" #include "IP.h"
/* Macros: */ /* 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. */ /** Physical MAC address of the network broadcast address. */
#define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} #define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

@ -43,7 +43,7 @@
#include "EthernetProtocols.h" #include "EthernetProtocols.h"
#include "Ethernet.h" #include "Ethernet.h"
#include "ProtocolDecoders.h" #include "ProtocolDecoders.h"
#include "Config/NetworkConfig.h" #include "Config/AppConfig.h"
/* Macros: */ /* Macros: */
/** Protocol IP address of the broadcast address. */ /** Protocol IP address of the broadcast address. */

@ -45,7 +45,7 @@
#include "EthernetProtocols.h" #include "EthernetProtocols.h"
#include "Ethernet.h" #include "Ethernet.h"
#include "Config/NetworkConfig.h" #include "Config/AppConfig.h"
/* Function Prototypes: */ /* Function Prototypes: */
void DecodeEthernetFrameHeader(void* InDataStart); void DecodeEthernetFrameHeader(void* InDataStart);

@ -84,38 +84,58 @@
* <td><b>Description:</b></td> * <td><b>Description:</b></td>
* </tr> * </tr>
* <tr> * <tr>
* <td>CLIENT_IP_ADDRESS</td>
* <td>AppConfig.h</td>
* <td>Configures the IP address given to the client (PC) via the DHCP server.</td>
* </tr>
* <tr>
* <td>SERVER_IP_ADDRESS</td>
* <td>AppConfig.h</td>
* <td>Configures the IP address of the virtual server.</td>
* </tr>
* <tr>
* <td>ADAPTER_MAC_ADDRESS</td>
* <td>AppConfig.h</td>
* <td>Configures the MAC address of the RNDIS adapter on the host (PC) side.</td>
* </tr>
* <tr>
* <td>SERVER_MAC_ADDRESS</td>
* <td>AppConfig.h</td>
* <td>Configures the MAC address of the virtual server on the network.</td>
* </tr>
* <tr>
* <td>NO_DECODE_ETHERNET</td> * <td>NO_DECODE_ETHERNET</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received Ethernet headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received Ethernet headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_ARP</td> * <td>NO_DECODE_ARP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received ARP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received ARP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_IP</td> * <td>NO_DECODE_IP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received IP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received IP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_ICMP</td> * <td>NO_DECODE_ICMP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received ICMP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received ICMP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_TCP</td> * <td>NO_DECODE_TCP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received TCP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received TCP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_UDP</td> * <td>NO_DECODE_UDP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received UDP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received UDP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_DHCP</td> * <td>NO_DECODE_DHCP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received DHCP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received DHCP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* </table> * </table>

@ -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

@ -65,6 +65,9 @@
*/ */
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE) #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: */ /* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo, void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress, const uint32_t BlockAddress,

@ -47,6 +47,7 @@
#include "Lib/SCSI.h" #include "Lib/SCSI.h"
#include "Lib/DataflashManager.h" #include "Lib/DataflashManager.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
@ -69,15 +70,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2 #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: */ /* Function Prototypes: */
void SetupHardware(void); void SetupHardware(void);
void CheckJoystickMovement(void); void CheckJoystickMovement(void);

@ -77,10 +77,14 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>TOTAL_LUNS</td> * <td>TOTAL_LUNS</td>
* <td>MassStorage.h</td> * <td>AppConfig.h</td>
* <td>Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive - * <td>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.</td> * this can be set to any positive non-zero amount.</td>
* </tr> * </tr>
* </table> * <tr>
* <td>DISK_READ_ONLY</td>
* <td>AppConfig.h</td>
* <td>Configuration define, indicating if the disk should be write protected or not.</td>
* </tr>
*/ */

@ -77,7 +77,7 @@ void SetupHardware(void)
USB_Init(); USB_Init();
/* Start the ADC conversion in free running mode */ /* 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 /** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and

@ -52,12 +52,6 @@
#include <LUFA/Drivers/Peripheral/ADC.h> #include <LUFA/Drivers/Peripheral/ADC.h>
/* Macros: */ /* 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. */ /** Maximum audio sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF #define SAMPLE_MAX_RANGE 0xFFFF

@ -43,6 +43,8 @@
#ifndef _APP_CONFIG_H_ #ifndef _APP_CONFIG_H_
#define _APP_CONFIG_H_ #define _APP_CONFIG_H_
#define MIC_IN_ADC_CHANNEL 2
#define MICROPHONE_BIASED_TO_HALF_RAIL #define MICROPHONE_BIASED_TO_HALF_RAIL
#define USE_TEST_TONE #define USE_TEST_TONE

@ -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

@ -41,6 +41,8 @@
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include "Config/AppConfig.h"
/* Type Defines: */ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the /** 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 * application code, as the configuration descriptor contains several sub-descriptors which
@ -67,9 +69,6 @@
/** Size in bytes of the Generic HID reporting endpoint. */ /** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 8 #define GENERIC_EPSIZE 8
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE 8
/* Function Prototypes: */ /* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex, const uint8_t wIndex,

@ -45,7 +45,8 @@
#include <string.h> #include <string.h>
#include "Descriptors.h" #include "Descriptors.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.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>

@ -67,9 +67,9 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>GENERIC_REPORT_SIZE</td> * <td>GENERIC_REPORT_SIZE</td>
* <td>Descriptors.h</td> * <td>AppConfig.h</td>
* <td>This token defines the size of the device reports, both sent and received. The value must be an * <td>This token defines the size of the device reports, both sent and received (including report ID byte). The value
* integer ranging from 1 to 255.</td> * must be an integer ranging from 1 to 255.</td>
* </tr> * </tr>
* </table> * </table>
*/ */

@ -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

@ -45,7 +45,7 @@
#include <LUFA/Common/Common.h> #include <LUFA/Common/Common.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/Dataflash.h> #include <LUFA/Drivers/Board/Dataflash.h>
/* Preprocessor Checks: */ /* Preprocessor Checks: */
#if (DATAFLASH_PAGE_SIZE % 16) #if (DATAFLASH_PAGE_SIZE % 16)
#error Dataflash page size must be a multiple of 16 bytes. #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) #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. */ /** 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)

@ -46,6 +46,7 @@
#include "Lib/SCSI.h" #include "Lib/SCSI.h"
#include "Lib/DataflashManager.h" #include "Lib/DataflashManager.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
@ -68,9 +69,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2 #define LEDMASK_USB_BUSY LEDS_LED2
/** Indicates if the disk is write protected or not. */
#define DISK_READ_ONLY false
/* Global Variables: */ /* Global Variables: */
extern MS_CommandBlockWrapper_t CommandBlock; extern MS_CommandBlockWrapper_t CommandBlock;
extern MS_CommandStatusWrapper_t CommandStatus; extern MS_CommandStatusWrapper_t CommandStatus;

@ -83,10 +83,15 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>TOTAL_LUNS</td> * <td>TOTAL_LUNS</td>
* <td>MassStorage.h</td> * <td>AppConfig.h</td>
* <td>Total number of Logical Units (drives) in the device. The total device capacity is shared equally between each drive * <td>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.</td> * - this can be set to any positive non-zero amount.</td>
* </tr> * </tr>
* <tr>
* <td>DISK_READ_ONLY</td>
* <td>AppConfig.h</td>
* <td>Indicates if the disk should be write protected or not.</td>
* </tr>
* </table> * </table>
*/ */

@ -45,6 +45,7 @@
#include <string.h> #include <string.h>
#include "Descriptors.h" #include "Descriptors.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>

@ -29,21 +29,26 @@
*/ */
/** \file /** \file
* \brief Network Configuration Header File * \brief Application Configuration Header File
* *
* This header file is used to configure various portions of the * This is a header file which is be used to configure some of
* network stack used by the application. * 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 LUFA * For information on what each token does, refer to the
* manual section "Summary of Compile Tokens". * \ref Sec_Options section of the application documentation.
*/ */
#ifndef _NETWORK_CONFIG_H_ #ifndef _APP_CONFIG_H_
#define _NETWORK_CONFIG_H_ #define _APP_CONFIG_H_
#define CLIENT_IP_ADDRESS { 10, 0, 0, 1} #define CLIENT_IP_ADDRESS { 10, 0, 0, 1}
#define SERVER_IP_ADDRESS { 10, 0, 0, 2} #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_ETHERNET
#define NO_DECODE_ARP #define NO_DECODE_ARP
#define NO_DECODE_IP #define NO_DECODE_IP

@ -50,12 +50,6 @@
#include "IP.h" #include "IP.h"
/* Macros: */ /* 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. */ /** Physical MAC address of the network broadcast address. */
#define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} #define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

@ -43,8 +43,7 @@
#include "EthernetProtocols.h" #include "EthernetProtocols.h"
#include "Ethernet.h" #include "Ethernet.h"
#include "ProtocolDecoders.h" #include "ProtocolDecoders.h"
#include "Config/AppConfig.h"
#include "Config/NetworkConfig.h"
/* Macros: */ /* Macros: */
/** Protocol IP address of the broadcast address. */ /** Protocol IP address of the broadcast address. */

@ -45,8 +45,7 @@
#include "EthernetProtocols.h" #include "EthernetProtocols.h"
#include "Ethernet.h" #include "Ethernet.h"
#include "Config/AppConfig.h"
#include "Config/NetworkConfig.h"
/* Function Prototypes: */ /* Function Prototypes: */
void DecodeEthernetFrameHeader(void* InDataStart); void DecodeEthernetFrameHeader(void* InDataStart);

@ -85,47 +85,57 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>CLIENT_IP_ADDRESS</td> * <td>CLIENT_IP_ADDRESS</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>Configures the IP address given to the client (PC) via the DHCP server.</td> * <td>Configures the IP address given to the client (PC) via the DHCP server.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>HOST_IP_ADDRESS</td> * <td>SERVER_IP_ADDRESS</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>Configures the IP address used in the virtual server for communications to/from the client.</td> * <td>Configures the IP address of the virtual server.</td>
* </tr>
* <tr>
* <td>ADAPTER_MAC_ADDRESS</td>
* <td>AppConfig.h</td>
* <td>Configures the MAC address of the RNDIS adapter on the host (PC) side.</td>
* </tr>
* <tr>
* <td>SERVER_MAC_ADDRESS</td>
* <td>AppConfig.h</td>
* <td>Configures the MAC address of the virtual server on the network.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_ETHERNET</td> * <td>NO_DECODE_ETHERNET</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received Ethernet headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received Ethernet headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_ARP</td> * <td>NO_DECODE_ARP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received ARP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received ARP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_IP</td> * <td>NO_DECODE_IP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received IP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received IP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_ICMP</td> * <td>NO_DECODE_ICMP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received ICMP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received ICMP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_TCP</td> * <td>NO_DECODE_TCP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received TCP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received TCP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_UDP</td> * <td>NO_DECODE_UDP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received UDP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received UDP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>NO_DECODE_DHCP</td> * <td>NO_DECODE_DHCP</td>
* <td>NetworkConfig.h</td> * <td>AppConfig.h</td>
* <td>When defined, received DHCP headers will not be decoded and printed to the device serial port.</td> * <td>When defined, received DHCP headers will not be decoded and printed to the device serial port.</td>
* </tr> * </tr>
* </table> * </table>

@ -128,6 +128,9 @@ void SetupHardware(void)
/* 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);
/* 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 /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and

@ -51,26 +51,16 @@
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h> #include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include "Config/AppConfig.h"
/* Macros: */ /* 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. */ /** Maximum audio sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF #define SAMPLE_MAX_RANGE 0xFFFF
/** Maximum ADC range for the microphone input. */ /** Maximum ADC range for the microphone input. */
#define ADC_MAX_RANGE 0x3FF #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. */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1

@ -63,14 +63,19 @@
* <td><b>Description:</b></td> * <td><b>Description:</b></td>
* </tr> * </tr>
* <tr> * <tr>
* <td>MIC_IN_ADC_CHANNEL</td>
* <td>AppConfig.h</td>
* <td>Sets the ADC channel used by the demo for the input audio samples from an attached microphone.</td>
* </tr>
* <tr>
* <td>USE_TEST_TONE</td> * <td>USE_TEST_TONE</td>
* <td>AudioOutputHost.h</td> * <td>AppConfig.h</td>
* <td>When defined, this alters the demo to produce a square wave test tone when the first board button is pressed * <td>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.</td> * instead of sampling the board microphone.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>MICROPHONE_BIASED_TO_HALF_RAIL</td> * <td>MICROPHONE_BIASED_TO_HALF_RAIL</td>
* <td>AudioOutputHost.h</td> * <td>AppConfig.h</td>
* <td>When defined, this alters the demo so that the half VCC bias of the microphone input is subtracted.</td> * <td>When defined, this alters the demo so that the half VCC bias of the microphone input is subtracted.</td>
* </tr> * </tr>
* </table> * </table>

@ -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

@ -74,6 +74,9 @@ void SetupHardware(void)
/* 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);
/* 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 /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and

@ -53,26 +53,15 @@
#include <LUFA/Drivers/Board/Buttons.h> #include <LUFA/Drivers/Board/Buttons.h>
#include "ConfigDescriptor.h" #include "ConfigDescriptor.h"
#include "Config/AppConfig.h"
/* Macros: */ /* 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. */ /** Maximum audio sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF #define SAMPLE_MAX_RANGE 0xFFFF
/** Maximum ADC range for the microphone input. */ /** Maximum ADC range for the microphone input. */
#define ADC_MAX_RANGE 0x3FF #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. */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1

@ -63,14 +63,19 @@
* <td><b>Description:</b></td> * <td><b>Description:</b></td>
* </tr> * </tr>
* <tr> * <tr>
* <td>MIC_IN_ADC_CHANNEL</td>
* <td>AppConfig.h</td>
* <td>Sets the ADC channel used by the demo for the input audio samples from an attached microphone.</td>
* </tr>
* <tr>
* <td>USE_TEST_TONE</td> * <td>USE_TEST_TONE</td>
* <td>AudioOutputHost.h</td> * <td>AppConfig.h</td>
* <td>When defined, this alters the demo to produce a square wave test tone when the first board button is pressed * <td>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.</td> * instead of sampling the board microphone.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>MICROPHONE_BIASED_TO_HALF_RAIL</td> * <td>MICROPHONE_BIASED_TO_HALF_RAIL</td>
* <td>AudioOutputHost.h</td> * <td>AppConfig.h</td>
* <td>When defined, this alters the demo so that the half VCC bias of the microphone input is subtracted.</td> * <td>When defined, this alters the demo so that the half VCC bias of the microphone input is subtracted.</td>
* </tr> * </tr>
* </table> * </table>

@ -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

File diff suppressed because one or more lines are too long

@ -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

@ -45,6 +45,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "Descriptors.h" #include "Descriptors.h"
#include "Config/AppConfig.h"
#include <LUFA/Version.h> #include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
@ -76,9 +77,6 @@
/** Lowest valid MIDI pitch index */ /** Lowest valid MIDI pitch index */
#define BASE_PITCH_INDEX 21 #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 /** 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) * more simultaneous notes due to the reduced amount of processing time needed when the samples are spaced out)
*/ */

@ -64,7 +64,7 @@
* </tr> * </tr>
* <tr> * <tr>
* <td>MAX_SIMULTANEOUS_NOTES</td> * <td>MAX_SIMULTANEOUS_NOTES</td>
* <td>MIDIToneGenerator.h</td> * <td>AppConfig.h</td>
* <td>Sets the maximum number of MIDI notes that can be generated simultaneously. More notes require more processing time, * <td>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.</td> * and thus a value that is too high will cause audiable sound distortion due to insufficient CPU time.</td>
* </tr> * </tr>

Loading…
Cancel
Save