adc.h

Go to the documentation of this file.
00001
00043 #ifndef DRV_ADC_H
00044 #define DRV_ADC_H
00045 
00046 #include <cfg/compiler.h>
00047 #include <cfg/debug.h>
00048 #include <cpu/attr.h>
00049 #include CPU_HEADER(adc)
00050 
00052 typedef uint16_t adcread_t;
00053
00055 typedef uint8_t adc_ch_t;
00056
00057 #define adc_bits() ADC_BITS
00058 
00059 adcread_t adc_read(adc_ch_t ch);
00060 void adc_init(void);
00061
00068 #define ADC_RANGECONV(data, y1, y2) (((((int32_t)(data)) * ((y2) - (y1))) / ((1 << ADC_BITS) - 1)) + (y1))
00069 
00070 #endif /* DRV_ADC_H */