diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-27 10:36:21 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-27 10:36:21 +0000 |
commit | 3b95b8dedced6c118cfb2cd7fc72c696c076119e (patch) | |
tree | 7e1f25f5fa95b9e295d490a61ab6e040588b7649 /Projects/AVRISP-MKII | |
parent | 8d993afc5388c5f3d0ff568c607f7fed6bb7390e (diff) | |
download | lufa-3b95b8dedced6c118cfb2cd7fc72c696c076119e.tar.gz lufa-3b95b8dedced6c118cfb2cd7fc72c696c076119e.tar.bz2 lufa-3b95b8dedced6c118cfb2cd7fc72c696c076119e.zip |
Added new VTARGET_REF_VOLTS and VTARGET_SCALE_FACTOR compile time defines to the AVRISP-MKII programmer project to set the VTARGET reference voltage and scale factor.
Fixed XPLAINBridge project not correctly reading the XMEGA's supply voltage when reporting back to the host.
Diffstat (limited to 'Projects/AVRISP-MKII')
-rw-r--r-- | Projects/AVRISP-MKII/AVRISP.c | 1 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/AVRISP.txt | 15 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/Lib/V2ProtocolParams.c | 2 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/makefile | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/Projects/AVRISP-MKII/AVRISP.c b/Projects/AVRISP-MKII/AVRISP.c index e26d16c4c..81c1385c9 100644 --- a/Projects/AVRISP-MKII/AVRISP.c +++ b/Projects/AVRISP-MKII/AVRISP.c @@ -49,7 +49,6 @@ int main(void) for (;;) { Process_AVRISP_Commands(); - V2Params_UpdateParamValues(); USB_USBTask(); diff --git a/Projects/AVRISP-MKII/AVRISP.txt b/Projects/AVRISP-MKII/AVRISP.txt index ab4472d9c..de08d5f37 100644 --- a/Projects/AVRISP-MKII/AVRISP.txt +++ b/Projects/AVRISP-MKII/AVRISP.txt @@ -262,6 +262,21 @@ * targets lacking an ADC.</i></td> * </tr> * <tr> + * <td>VTARGET_REF_VOLTS</td> + * <td>Makefile CDEFS</td> + * <td>Indicates the programmer AVR's AVCC reference voltage when measuring the target's supply voltage. Note that the supply + * voltage should never exceed the reference voltage on the programmer AVR without some form of protection to prevent damage + * 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_SCALE_FACTOR</td> + * <td>Makefile CDEFS</td> + * <td>Indicates the target's supply voltage scale factor when applied to the ADC. A simple resistive divider can be used on the + * ADC pin for measuring the target's supply voltage, so that voltages above the programmer AVR's AVCC reference voltage can be + * measured. This should be the reciprocal of the division performed - e.g. if the VTARGET voltage is halved, this should be set + * to 2. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td> + * </tr> + * <tr> * <td>LIBUSB_DRIVER_COMPAT</td> * <td>Makefile CDEFS</td> * <td>Define to switch to a non-standard endpoint scheme, breaking compatibility with AVRStudio under Windows but making diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c index de21f0ff2..bc3ed18e0 100644 --- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c +++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c @@ -98,7 +98,7 @@ void V2Params_UpdateParamValues(void) { #if (defined(ADC) && !defined(NO_VTARGET_DETECT)) /* Update VTARGET parameter with the latest ADC conversion of VTARGET on supported AVR models */ - V2Params_SetParameterValue(PARAM_VTARGET, ((5 * 10 * ADC_GetResult()) / 1024)); + V2Params_GetParamFromTable(PARAM_VTARGET)->ParamValue = (((uint16_t)(VTARGET_REF_VOLTS * 10 * VTARGET_SCALE_FACTOR) * ADC_GetResult()) / 1024); #endif } diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile index 9cba8730a..c6b64dfe1 100644 --- a/Projects/AVRISP-MKII/makefile +++ b/Projects/AVRISP-MKII/makefile @@ -197,6 +197,8 @@ CDEFS += -DAUX_LINE_MASK="(1 << 4)" CDEFS += -DVTARGET_ADC_CHANNEL=2 CDEFS += -DENABLE_ISP_PROTOCOL CDEFS += -DENABLE_XPROG_PROTOCOL +CDEFS += -DVTARGET_REF_VOLTS=5 +CDEFS += -DVTARGET_SCALE_FACTOR=1 #CDEFS += -DNO_VTARGET_DETECT #CDEFS += -DLIBUSB_DRIVER_COMPAT |