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.1 2005/06/27 21:28:31 bernie
19 *#* Import ADC driver.
25 #include <drv/timer.h>
28 #include <cfg/debug.h>
29 #include <cfg/macros.h>
30 #include <cfg/compiler.h>
32 DB(bool adc_initialized = false;)
35 * Read the ADC channel \a ch.
37 adcread_t adc_read(uint16_t ch)
39 ASSERT(ch <= (uint16_t)ADC_MUX_MAXCH);
40 ch = MIN(ch, (uint16_t)ADC_MUX_MAXCH);
44 return(adc_hw_read());
48 * Initialize the ADC hardware.
53 IRQ_SAVE_DISABLE(flags);
56 DB(adc_initialized = true;)