aboutsummaryrefslogtreecommitdiff
path: root/LUFA/Drivers/Peripheral
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-01-16 16:13:22 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-01-16 16:13:22 +0000
commit7bbfac48d27aa89d356ef9aee31f2e54de397840 (patch)
treeb7aa3d7301faae4fd138e0b1d95657f41425ea40 /LUFA/Drivers/Peripheral
parentc9021e1d999462f77369f37bdfc7872b0d799652 (diff)
Added new ADC_GET_CHANNEL_MASK() convenience macro to the ADC driver.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1634 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/Peripheral')
-rw-r--r--LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h
index 9d6e91bc..5f4b034e 100644
--- a/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h
+++ b/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h
@@ -90,6 +90,13 @@
#error Do not include this file directly. Include LUFA/Drivers/Peripheral/ADC.h instead.
#endif
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ /* Macros: */
+ #define _ADC_GET_MUX_MASK2(y) ADC_CHANNEL ## y
+ #define _ADC_GET_MUX_MASK(y) _ADC_GET_MUX_MASK2(y)
+ #endif
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** \name ADC Reference Configuration Masks */
@@ -235,6 +242,15 @@
*/
#define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0))
#endif
+
+ /** Retrieves the ADC MUX mask for the given ADC channel number.
+ *
+ * \note This macro will only work correctly on channel numbers that are compile-time
+ * constants defined by the preprocessor.
+ *
+ * \param[in] Channel Index of the ADC channel whose MUX mask is to be retrieved.
+ */
+ #define ADC_GET_CHANNEL_MASK(Channel) _ADC_GET_MUX_MASK(Channel)
//@}
/* Inline Functions: */