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.4 2006/09/20 17:32:46 marco
19 *#* Use MOD_* macros instead of DB.
21 *#* Revision 1.3 2006/09/13 18:30:07 bernie
24 *#* Revision 1.2 2006/07/19 12:56:25 bernie
25 *#* Convert to new Doxygen style.
27 *#* Revision 1.1 2005/06/27 21:28:31 bernie
28 *#* Import ADC driver.
34 #include <drv/timer.h>
36 // FIXME: move CPU specific part to adc_CPU.c
39 #include <cfg/debug.h> // ASSERT()
40 #include <cfg/macros.h> // MIN()
41 #include <cfg/compiler.h>
42 #include <cfg/module.h>
45 * Read the ADC channel \a ch.
47 adcread_t adc_read(uint16_t ch)
49 ASSERT(ch <= (uint16_t)ADC_MUX_MAXCH);
50 ch = MIN(ch, (uint16_t)ADC_MUX_MAXCH);
54 return(adc_hw_read());
60 * Initialize the ADC hardware.
65 IRQ_SAVE_DISABLE(flags);