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