From de0ccb3d0905390f70f6c326d31222069c775225 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 13 Feb 2010 03:21:28 +0000 Subject: [PATCH] Add NO_VTARGET_DETECT compile time option to the AVRISP-MKII clone project, to disable VTARGET detection on AVR models with an on-chip ADC. --- Projects/AVRISP-MKII/AVRISP.txt | 8 +++++++- Projects/AVRISP-MKII/Lib/V2ProtocolParams.c | 2 +- Projects/AVRISP-MKII/makefile | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Projects/AVRISP-MKII/AVRISP.txt b/Projects/AVRISP-MKII/AVRISP.txt index cff8d7dff4..feccfcabea 100644 --- a/Projects/AVRISP-MKII/AVRISP.txt +++ b/Projects/AVRISP-MKII/AVRISP.txt @@ -247,7 +247,7 @@ * * VTARGET_ADC_CHANNEL * Makefile CDEFS - * ADC channel number (on supported AVRs) to use for VTARGET level detection. + * ADC channel number (on supported AVRs) to use for VTARGET level detection, if NO_VTARGET_DETECT is not defined. * * * ENABLE_ISP_PROTOCOL @@ -267,5 +267,11 @@ * seperate ISP, PDI, and TPI programming headers) but increases programming speed dramatically. * Ignored when compiled for the XPLAIN board. * + * + * NO_VTARGET_DETECT + * Makefile CDEFS + * Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer + * to report a fixed 5V target voltage to the host regardless of the real target voltage. + * * */ diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c index 00788515dd..a4709f8f50 100644 --- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c +++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c @@ -97,7 +97,7 @@ void V2Params_LoadNonVolatileParamValues(void) */ void V2Params_UpdateParamValues(void) { - #if defined(ADC) + #if (defined(ADC) && !defined(NO_VTARGET_DETECT)) /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */ V2Params_GetParamFromTable(PARAM_VTARGET)->ParamValue = ((5 * 10 * ADC_GetResult()) / 1024); #endif diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile index 2698de881b..b0b26c24c1 100644 --- a/Projects/AVRISP-MKII/makefile +++ b/Projects/AVRISP-MKII/makefile @@ -198,6 +198,7 @@ CDEFS += -DVTARGET_ADC_CHANNEL=2 CDEFS += -DENABLE_ISP_PROTOCOL CDEFS += -DENABLE_XPROG_PROTOCOL #CDEFS += -DXPROG_VIA_HARDWARE_USART +#CDEFS += -DNO_VTARGET_DETECT # Place -D or -U options here for ASM sources