/** * \file * * * \brief ADC driver (implementation) * * \author Francesco Sacchi */ #include #ifndef WIZ_AUTOGEN #warning Deprecated: now you should include adc_ directly in the makefile. Remove this line and the following once done. #include CPU_CSOURCE(adc) #else #include CPU_HEADER(adc) #endif #include // ASSERT() #include // MIN() #include #include /** * Read the ADC channel \a ch. */ adcread_t adc_read(adc_ch_t ch) { ASSERT(ch <= (adc_ch_t)ADC_MUX_MAXCH); ch = MIN(ch, (adc_ch_t)ADC_MUX_MAXCH); adc_hw_select_ch(ch); return(adc_hw_read()); } MOD_DEFINE(adc); /** * Initialize the ADC hardware. */ void adc_init(void) { adc_hw_init(); MOD_INIT(adc); }