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