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.3 2006/09/13 18:30:07 bernie
21 *#* Revision 1.2 2006/07/19 12:56:25 bernie
22 *#* Convert to new Doxygen style.
24 *#* Revision 1.1 2005/06/27 21:28:31 bernie
25 *#* Import ADC driver.
31 #include <drv/timer.h>
33 // FIXME: move CPU specific part to adc_CPU.c
36 #include <cfg/debug.h>
37 #include <cfg/macros.h>
38 #include <cfg/compiler.h>
40 DB(bool adc_initialized = false;)
43 * Read the ADC channel \a ch.
45 adcread_t adc_read(uint16_t ch)
47 ASSERT(ch <= (uint16_t)ADC_MUX_MAXCH);
48 ch = MIN(ch, (uint16_t)ADC_MUX_MAXCH);
52 return(adc_hw_read());
56 * Initialize the ADC hardware.
61 IRQ_SAVE_DISABLE(flags);
64 DB(adc_initialized = true;)