diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 91aa6feb229295fc823985b5804213281ef6934f..639e6c7c2da47b87fa2a1eaff83ae066ac4474d6 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) * * <b>Changed:</b> * - Core: diff --git a/LUFA/ManPages/CompileTimeTokens.txt b/LUFA/ManPages/CompileTimeTokens.txt index 22acb7b7d8daf600d28cdc7013368ffd45e02689..e96f7c163474a26ba8c507300cf2f56aa88c7b11 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. * - * <b>NO_SOF_EVENTS</b> - (\ref Group_Events) - <i>AVR8, UC3</i> \n + * <b>NO_SOF_EVENTS</b> - (\ref Group_Events) - <i>All Architectures</i> \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. * - * <b>INTERRUPT_CONTROL_ENDPOINT</b> - (\ref Group_USBManagement) - <i>AVR8 Only</i> \n + * <b>INTERRUPT_CONTROL_ENDPOINT</b> - (\ref Group_USBManagement) - <i>All Architectures</i> \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 fb6411b58fdb2f5f24b1e42f2c0f09b77293780b..ab355bfacd65d856ee477d627d9454385c9c79fe 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.txt +++ b/Projects/AVRISP-MKII/AVRISP-MKII.txt @@ -267,6 +267,12 @@ * to the ADC. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td> * </tr> * <tr> + * <td>VTARGET_USE_INTERNAL_REF</td> + * <td>Makefile LUFA_OPTS</td> + * <td>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.</i></td> + * </tr> + * <tr> * <td>VTARGET_SCALE_FACTOR</td> * <td>Makefile LUFA_OPTS</td> * <td>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 4c8f0585a0137ae559e332b31e8a62a623b93cc0..65e34fad9037325dcc8c3f586f4cf9075b16a2e4 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 8e9e6ff38ff9e84deab193413b0d6deb2912afbe..2511571f9dfce4a8b0838c4ed6a2c00e2028d757 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 0675242c09d33ccd36a24672e34c5fbb9b1aa1b5..36c6c893e88f2763e3456e8a61a8ef5209bdd47d 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