43 #define ADC_BASE (0x8000D000)
61 uint16_t BAT_COMP_OVER;
62 uint16_t BAT_COMP_UNDER;
100 uint16_t SOFT_RESET:1;
101 uint16_t AD1_FREFHL_EN:1;
102 uint16_t AD2_VREFHL_EN:1;
104 uint16_t COMPARE_IRQ_MASK:1;
105 uint16_t SEQ1_IRQ_MASK:1;
106 uint16_t SEQ2_IRQ_MASK:1;
107 uint16_t FIFO_IRQ_MASK:1;
114 uint16_t FIFO_CONTROL;
116 uint16_t FIFO_STATUS;
117 struct ADC_FIFO_STATUS {
124 uint16_t reserved2[5];
130 uint16_t CONVERT_TIME;
131 uint16_t CLOCK_DIVIDER;
135 struct ADC_OVERRIDE {
149 static volatile struct ADC_struct *
const ADC = (
void *) (ADC_BASE);
151 #define NUM_ADC_CHAN 9
153 #define adc_enable() (ADC->CONTROLbits.ON = 1)
154 #define adc_disable() (ADC->CONTROLbits.ON = 0)
155 #define adc_select_channels(chans) (ADC->SEQ_1 = (ADC->SEQ_1 & 0xFE00) | chans)
157 extern uint16_t adc_reading[NUM_ADC_CHAN];
158 void ADC_flush(
void);
159 uint16_t ADC_READ(
void);
160 void read_scanners(
void);
162 void adc_service(
void);