diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 91aa6feb22..639e6c7c2d 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -39,6 +39,7 @@ * - Added new AudioInputHost Host LowLevel demo * - Added new AudioOutputHost Host LowLevel demo * - Added new "checksource" target to all library project makefiles + * - Added new VTARGET_USE_INTERNAL_REF configuration option to the AVRISP-MKII clone project (thanks to Volker Bosch) * * Changed: * - Core: diff --git a/LUFA/ManPages/CompileTimeTokens.txt b/LUFA/ManPages/CompileTimeTokens.txt index 22acb7b7d8..e96f7c1634 100644 --- a/LUFA/ManPages/CompileTimeTokens.txt +++ b/LUFA/ManPages/CompileTimeTokens.txt @@ -117,7 +117,7 @@ * can be accurately set and the \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events manually raised by the RAISE_EVENT macro. * When defined, this token disables the library's auto-detection of the connection state by the aforementioned suspension and wake up events. * - * NO_SOF_EVENTS - (\ref Group_Events) - AVR8, UC3 \n + * NO_SOF_EVENTS - (\ref Group_Events) - All Architectures \n * By default, there exists a LUFA application event for the start of each USB frame while the USB bus is not suspended in either host or device mode. * This event can be selectively enabled or disabled by calling the appropriate device or host mode function. When this compile time token is defined, * the ability to receive USB Start of Frame events via the \ref EVENT_USB_Device_StartOfFrame() or \ref EVENT_USB_Host_StartOfFrame() events is removed, @@ -167,7 +167,7 @@ * is through control endpoint requests. Defining this token will remove several features related to the selection and control of device * endpoints internally, saving space. Generally, this is usually only useful in (some) bootloaders and is best avoided. * - * INTERRUPT_CONTROL_ENDPOINT - (\ref Group_USBManagement) - AVR8 Only \n + * INTERRUPT_CONTROL_ENDPOINT - (\ref Group_USBManagement) - All Architectures \n * Some applications prefer to not call the USB_USBTask() management task regularly while in device mode, as it can complicate code significantly. * Instead, when device mode is used this token can be passed to the library via the -D switch to allow the library to manage the USB control * endpoint entirely via USB controller interrupts asynchronously to the user application. When defined, USB_USBTask() does not need to be called diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.txt b/Projects/AVRISP-MKII/AVRISP-MKII.txt index fb6411b58f..ab355bfacd 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.txt +++ b/Projects/AVRISP-MKII/AVRISP-MKII.txt @@ -267,6 +267,12 @@ * to the ADC. Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined. * * + * VTARGET_USE_INTERNAL_REF + * Makefile LUFA_OPTS + * Selects the internal 2.56V ADC reference voltage, instead of using the AVR's VREF pin. When enabled, this option will + * override the VTARGET_REF_VOLTS configuration option. + * + * * VTARGET_SCALE_FACTOR * Makefile LUFA_OPTS * Indicates the target's supply voltage scale factor when applied to the ADC. A simple resistive divider can be used on the diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.c b/Projects/AVRISP-MKII/Lib/V2Protocol.c index 4c8f0585a0..65e34fad90 100644 --- a/Projects/AVRISP-MKII/Lib/V2Protocol.c +++ b/Projects/AVRISP-MKII/Lib/V2Protocol.c @@ -57,7 +57,7 @@ void V2Protocol_Init(void) /* Initialize the ADC converter for VTARGET level detection on supported AVR models */ ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128); ADC_SetupChannel(VTARGET_ADC_CHANNEL); - ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK); + ADC_StartReading(VTARGET_REF_MASK | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK); #endif V2Params_LoadNonVolatileParamValues(); diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.h b/Projects/AVRISP-MKII/Lib/V2Protocol.h index 8e9e6ff38f..2511571f9d 100644 --- a/Projects/AVRISP-MKII/Lib/V2Protocol.h +++ b/Projects/AVRISP-MKII/Lib/V2Protocol.h @@ -61,6 +61,15 @@ #if defined(USB_SERIES_4_AVR) && ((VTARGET_ADC_CHANNEL == 2) || (VTARGET_ADC_CHANNEL == 3)) #error The U4 AVR chips do not contain ADC channels 2 or 3. Please change VTARGET_ADC_CHANNEL or define NO_VTARGET_DETECT in the makefile. #endif + + #if defined(VTARGET_USE_INTERNAL_REF) + #undef VTARGET_REF_VOLTS + #define VTARGET_REF_VOLTS 2.56 + + #define VTARGET_REF_MASK ADC_REFERENCE_INT2560MV + #else + #define VTARGET_REF_MASK ADC_REFERENCE_AVCC + #endif /* Macros: */ /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing. */ diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile index 0675242c09..36c6c893e8 100644 --- a/Projects/AVRISP-MKII/makefile +++ b/Projects/AVRISP-MKII/makefile @@ -140,6 +140,7 @@ LUFA_OPTS += -D ENABLE_XPROG_PROTOCOL LUFA_OPTS += -D VTARGET_ADC_CHANNEL=2 LUFA_OPTS += -D VTARGET_REF_VOLTS=5 LUFA_OPTS += -D VTARGET_SCALE_FACTOR=1 +#LUFA_OPTS += -D VTARGET_USE_INTERNAL_REF #LUFA_OPTS += -D NO_VTARGET_DETECT #LUFA_OPTS += -D LIBUSB_DRIVER_COMPAT #LUFA_OPTS += -D XCK_RESCUE_CLOCK_ENABLE