aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/AVRISP-MKII/Lib')
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.c2
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.h14
2 files changed, 12 insertions, 4 deletions
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.c b/Projects/AVRISP-MKII/Lib/V2Protocol.c
index d6de77404..8d8f2003f 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(VTARGET_ADC_CHANNEL | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);
+ ADC_StartReading(VTARGET_ADC_CHANNEL_MASK | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);
#endif
/* Millisecond timer initialization for managing the command timeout counter */
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.h b/Projects/AVRISP-MKII/Lib/V2Protocol.h
index 862ea48ef..5af9fe9bf 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.h
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.h
@@ -56,14 +56,22 @@
#endif
/* Macros: */
+ #if !defined(__DOXYGEN__)
+ #define _GETADCMUXMASK2(x, y) x ## y
+ #define _GETADCMUXMASK(x, y) _GETADCMUXMASK2(x, y)
+ #endif
+
/** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
- #define PROGRAMMER_ID "AVRISP_MK2"
+ #define PROGRAMMER_ID "AVRISP_MK2"
/** Timeout period for each issued command from the host before it is aborted */
- #define COMMAND_TIMEOUT_MS 200
+ #define COMMAND_TIMEOUT_MS 200
/** Command timeout counter register, GPIOR for speed */
- #define TimeoutMSRemaining GPIOR0
+ #define TimeoutMSRemaining GPIOR0
+
+ /** MUX mask for the VTARGET ADC channel number */
+ #define VTARGET_ADC_CHANNEL_MASK _GETADCMUXMASK(ADC_CHANNEL, VTARGET_ADC_CHANNEL)
/* External Variables: */
extern uint32_t CurrentAddress;