adc.c

Go to the documentation of this file.
00001 
00039 #include <drv/adc.h>
00040 
00041 #ifndef WIZ_AUTOGEN
00042     #warning Deprecated: now you should include adc_<cpu> directly in the makefile. Remove this line and the following once done.
00043     #include CPU_CSOURCE(adc)
00044 #else
00045     #include CPU_HEADER(adc)
00046 #endif
00047 
00048 #include <cfg/debug.h>     // ASSERT()
00049 #include <cfg/macros.h>    // MIN()
00050 #include <cfg/compiler.h>
00051 #include <cfg/module.h>
00052 
00056 adcread_t adc_read(adc_ch_t ch)
00057 {
00058     ASSERT(ch <= (adc_ch_t)ADC_MUX_MAXCH);
00059     ch = MIN(ch, (adc_ch_t)ADC_MUX_MAXCH);
00060 
00061     adc_hw_select_ch(ch);
00062 
00063     return(adc_hw_read());
00064 }
00065 
00066 MOD_DEFINE(adc);
00067 
00071 void adc_init(void)
00072 {
00073     adc_hw_init();
00074 
00075     MOD_INIT(adc);
00076 }