sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
adc.h
Go to the documentation of this file.
1 #ifndef ADC_H
2 #define ADC_H
3 
4 #include "dev_data.h"
5 #include "features.h"
6 
7 #if defined(N_ADC)
8 
9 typedef struct {
10  uint8_t flags;
11  uint16_t value;
12  uint16_t lower;
13  uint16_t upper;
14 } adc_t;
15 extern adc_t adcs[];
16 
17 // the first two bits are used for adc_out_t, i.e. PO_* constants. Hardcoded.
18 #define ADC_MASK ((1<<3)-1)
19 #define ADC_VBG 0x01
20 #define ADC_VGND 0x02
21 #define ADC_VTEMP 0x03
22 #define ADC_ALT (1<<3) // use Vbg et al, not analog inputs 0-7
23 #define ADC_REF (1<<4) // use Vbg as reference, not Vdd
24 #define ADC_ALERT (1<<5) // trigger an alarm when stepping over boundary
25 #define ADC_IS_ALERT_L (1<<6) // alarm triggered (low)?
26 #define ADC_IS_ALERT_H (1<<7) // alarm triggered (high)?
27 
28 #ifdef CONDITIONAL_SEARCH
29 extern uint8_t adc_changed_cache;
30 #endif
31 
32 #endif // any inputs or outputs at all
33 #endif // adc_h