Centre images in the Atmel Studio help, apply text formatting styles recursively.
[pub/USBasp.git] / LUFA / Drivers / Peripheral / AVR8 / ADC_AVR8.h
index 06162f2..02abbc7 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2012.
+     Copyright (C) Dean Camera, 2013.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
  *  \code
  *      // Initialize the ADC driver before first use
  *      ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32);
  *  \code
  *      // Initialize the ADC driver before first use
  *      ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32);
- *      
+ *
  *      // Must setup the ADC channel to read beforehand
  *      ADC_SetupChannel(1);
  *      // Must setup the ADC channel to read beforehand
  *      ADC_SetupChannel(1);
- *      
+ *
  *      // Perform a single conversion of the ADC channel 1
  *      ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_CHANNEL1);
  *      printf("Conversion Result: %d\r\n", ADC_GetResult());
  *      // Perform a single conversion of the ADC channel 1
  *      ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_CHANNEL1);
  *      printf("Conversion Result: %d\r\n", ADC_GetResult());
- *      
+ *
  *      // Start reading ADC channel 1 in free running (continuous conversion) mode
  *      ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_CHANNEL1);
  *      for (;;)
  *      // Start reading ADC channel 1 in free running (continuous conversion) mode
  *      ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_CHANNEL1);
  *      for (;;)
 
                #if !(defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
                      defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
 
                #if !(defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
                      defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
-                         defined(__AVR_ATmega16U4__)  || defined(__AVR_ATmega32U4__) || \
-                         defined(__AVR_ATmega32U6__))
+                         defined(__AVR_ATmega16U4__)  || defined(__AVR_ATmega32U4__))
                        #error The ADC peripheral driver is not currently available for your selected microcontroller model.
                #endif
 
                        #error The ADC peripheral driver is not currently available for your selected microcontroller model.
                #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 */
        /* Public Interface - May be used in end-application: */
                /* Macros: */
                        /** \name ADC Reference Configuration Masks */
                         *
                         *  \param[in] Channel  Index of the ADC channel whose MUX mask is to be retrieved.
                         */
                         *
                         *  \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)
+                       #define ADC_GET_CHANNEL_MASK(Channel)   CONCAT_EXPANDED(ADC_CHANNEL, Channel)
                        //@}
 
                /* Inline Functions: */
                        //@}
 
                /* Inline Functions: */
                        static inline void ADC_SetupChannel(const uint8_t ChannelIndex)
                        {
                                #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
                        static inline void ADC_SetupChannel(const uint8_t ChannelIndex)
                        {
                                #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
-                                        defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
-                                        defined(__AVR_ATmega32U6__))
+                                        defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__))
                                DDRF  &= ~(1 << ChannelIndex);
                                DIDR0 |=  (1 << ChannelIndex);
                                #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
                                DDRF  &= ~(1 << ChannelIndex);
                                DIDR0 |=  (1 << ChannelIndex);
                                #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
                        static inline void ADC_DisableChannel(const uint8_t ChannelIndex)
                        {
                                #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
                        static inline void ADC_DisableChannel(const uint8_t ChannelIndex)
                        {
                                #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
-                                        defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
-                                        defined(__AVR_ATmega32U6__))
+                                        defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__))
                                DDRF  &= ~(1 << ChannelIndex);
                                DIDR0 &= ~(1 << ChannelIndex);
                                #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
                                DDRF  &= ~(1 << ChannelIndex);
                                DIDR0 &= ~(1 << ChannelIndex);
                                #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
 
                        /** Indicates if the current ADC conversion is completed, or still in progress.
                         *
 
                        /** Indicates if the current ADC conversion is completed, or still in progress.
                         *
-                        *  \return Boolean false if the reading is still taking place, or true if the conversion is
+                        *  \return Boolean \c false if the reading is still taking place, or true if the conversion is
                         *          complete and ready to be read out with \ref ADC_GetResult().
                         */
                        static inline bool ADC_IsReadingComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
                         *          complete and ready to be read out with \ref ADC_GetResult().
                         */
                        static inline bool ADC_IsReadingComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;