#endif\r
\r
/* Public Interface - May be used in end-application: */\r
- /* Macros: */\r
- /** Initializes the ADC, ready for conversions. This must be called before any other ADC operations.\r
- * The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and\r
- * prescaler masks.\r
- */\r
- #define ADC_Init(mode) MACROS{ ADCSRA = ((1 << ADEN) | mode); }MACROE\r
-\r
- /** Turns off the ADC. If this is called, any further ADC operations will require a call to the\r
- * ADC_Init() macro before the ADC can be used again.\r
- */\r
- #define ADC_Off() MACROS{ ADCSRA = 0; }MACROE\r
- \r
- /** Indicates if the ADC is enabled. This macro will return boolean true if the ADC subsystem is\r
- * currently enabled, or false otherwise.\r
- */\r
- #define ADC_GetStatus() ((ADCSRA & (1 << ADEN)) ? true : false)\r
-\r
- /** Indicates if the current ADC conversion is completed, or still in progress. This returns boolean\r
- * false if the reading is still taking place, or true if the conversion is complete and ready to be\r
- * read out with ADC_GetResult().\r
- */\r
- #define ADC_IsReadingComplete() (!(ADCSRA & (1 << ADSC)))\r
- \r
- /** Returns the result of the last conversion, as a 16-bit wide integer. */\r
- #define ADC_GetResult() ADC\r
- \r
+ /* Macros: */ \r
/** Reference mask, for using the voltage present at the AVR's AREF pin for the ADC reference. */\r
#define ADC_REFERENCE_AREF 0\r
\r
/** Sets the ADC input clock to prescale by a factor of 128 the AVR's system clock. */\r
#define ADC_PRESCALE_128 ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0))\r
\r
+ /* Pseudo-Function Macros: */\r
+ #if defined(__DOXYGEN__)\r
+ /** Initializes the ADC, ready for conversions. This must be called before any other ADC operations.\r
+ * The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and\r
+ * prescaler masks.\r
+ *\r
+ * \param Mode Mask of ADC settings, including adjustment, prescale, mode and reference\r
+ */\r
+ static inline void ADC_Init(uint8_t Mode);\r
+ \r
+ /** Turns off the ADC. If this is called, any further ADC operations will require a call to\r
+ * \ref ADC_Init() before the ADC can be used again.\r
+ */\r
+ static inline void ADC_Off(void);\r
+ \r
+ /** Indicates if the ADC is currently enabled.\r
+ *\r
+ * \return Boolean true if the ADC subsystem is currently enabled, false otherwise.\r
+ */\r
+ static inline bool ADC_GetStatus(void);\r
+ \r
+ /** Indicates if the current ADC conversion is completed, or still in progress.\r
+ *\r
+ * \return Boolean false if the reading is still taking place, or true if the conversion is\r
+ * complete and ready to be read out with \ref ADC_GetResult()\r
+ */\r
+ static inline bool ADC_IsReadingComplete(void);\r
+ \r
+ /** Retrieves the conversion value of the last completed ADC conversion.\r
+ *\r
+ * \return The result of the last ADC conversion\r
+ */\r
+ static inline uint16_t ADC_GetResult(void);\r
+ #else\r
+ #define ADC_Init(mode) MACROS{ ADCSRA = ((1 << ADEN) | mode); }MACROE\r
+\r
+ #define ADC_Off() MACROS{ ADCSRA = 0; }MACROE\r
+ \r
+ #define ADC_GetStatus() ((ADCSRA & (1 << ADEN)) ? true : false)\r
+\r
+ #define ADC_IsReadingComplete() (!(ADCSRA & (1 << ADSC)))\r
+ \r
+ #define ADC_GetResult() ADC \r
+ #endif\r
+ \r
/* Inline Functions: */\r
/** Configures the given ADC channel, ready for ADC conversions. This function sets the\r
* associated port pin as an input and disables the digital portion of the I/O to reduce\r
}\r
\r
/** Starts the reading of the given channel, but does not wait until the conversion has completed.\r
- * Once executed, the conversion status can be determined via the ADC_IsReadingComplete() macro and\r
- * the result read via the ADC_GetResult() macro.\r
+ * Once executed, the conversion status can be determined via the \ref ADC_IsReadingComplete() macro and\r
+ * the result read via the \ref ADC_GetResult() macro.\r
*\r
* \param MUXMask Mask comprising of an ADC channel number, reference mask and adjustment mask\r
*/\r