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