+ /* 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
+ * 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 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