BeRTOS
adc_sam3.h
Go to the documentation of this file.
00001 
00038 #ifndef DRV_ADC_SAM3_H
00039 #define DRV_ADC_SAM3_H
00040 
00041 #include <hw/hw_cpufreq.h>
00042 
00043 #include "cfg/cfg_adc.h"
00044 
00045 #include <cfg/compiler.h>
00046 
00050 #define ADC_MUX_MAXCH         16 //Max number of channel for ADC.
00051 #define ADC_BITS              12 //Bit resolution for ADC converter.
00052 
00057 #define ADC_PRESCALER    (DIV_ROUNDUP(CPU_FREQ, 2 * CONFIG_ADC_CLOCK) - 1)
00058 #define ADC_CLOCK        (CPU_FREQ / ((ADC_PRESCALER + 1) * 2))
00059 
00060 void adc_hw_select_ch(uint8_t ch);
00061 uint16_t adc_hw_read(void);
00062 void adc_hw_init(void);
00063 
00064 #endif /* DRV_ADC_SAM3_H */