adc_at91.h

Go to the documentation of this file.
00001 
00041 #ifndef DRV_ADC_AT91_H
00042 #define DRV_ADC_AT91_H
00043 
00044 #include <cfg/compiler.h>
00045 
00046 #include "hw_cpu.h"
00047 #include "appconfig.h"
00048 
00052 #define ADC_MUX_MAXCH          8 //Max number of channel for ADC.
00053 #define ADC_BITS              10 //Bit resolution for ADC converter.
00054 
00059 #define ADC_COMPUTED_PRESCALER    ((CLOCK_FREQ/(2 * CONFIG_ADC_CLOCK)) - 1)
00060 #define ADC_COMPUTED_STARTUPTIME  (((CONFIG_ADC_STARTUP_TIME * CONFIG_ADC_CLOCK)/ 8000000UL) - 1)
00061 #define ADC_COMPUTED_SHTIME       (((CONFIG_ADC_SHTIME * CONFIG_ADC_CLOCK)/1000000000UL) - 1)
00062 
00071 #if CPU_ARM_AT91SAM7X256
00072     #define ADC_PIO_DISABLE           PIOB_PDR
00073     #define ADC_PIO_EN_FUNC           PIOB_ASR
00074 
00075 #elif CPU_ARM_AT91SAM7S256
00076     #define ADC_PIO_DISABLE           PIOA_PDR
00077     #define ADC_PIO_EN_FUNC           PIOA_BSR
00078 
00079 #else
00080     #error No ADC pins name definitions for selected ARM CPU
00081 #endif
00082 /*\}*/
00083 
00088 #define ADC_INIT_PINS() \
00089     do { \
00090     } while (0)
00091 
00092 
00093 #endif /* DRV_ADC_AT91_H */