4 * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See README.devlib for information.
10 * \brief ADC driver (implementation)
13 * \author Francesco Sacchi <batt@develer.com>
18 *#* Revision 1.2 2006/07/19 12:56:25 bernie
19 *#* Convert to new Doxygen style.
21 *#* Revision 1.1 2005/06/27 21:28:31 bernie
22 *#* Import ADC driver.
28 #include <drv/timer.h>
31 #include <cfg/debug.h>
32 #include <cfg/macros.h>
33 #include <cfg/compiler.h>
35 DB(bool adc_initialized = false;)
38 * Read the ADC channel \a ch.
40 adcread_t adc_read(uint16_t ch)
42 ASSERT(ch <= (uint16_t)ADC_MUX_MAXCH);
43 ch = MIN(ch, (uint16_t)ADC_MUX_MAXCH);
47 return(adc_hw_read());
51 * Initialize the ADC hardware.
56 IRQ_SAVE_DISABLE(flags);
59 DB(adc_initialized = true;)