File tree Expand file tree Collapse file tree 6 files changed +10
-11
lines changed
libraries/Bluefruit52Lib/examples/Hardware/adc_vbat Expand file tree Collapse file tree 6 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,6 @@ PIN_A6 LITERAL1
107
107
PIN_A7 LITERAL1
108
108
109
109
PIN_AREF LITERAL1
110
- PIN_DFU LITERAL1
111
110
PIN_NFC1 LITERAL1
112
111
PIN_NFC2 LITERAL1
113
112
Original file line number Diff line number Diff line change
1
+ #include < Arduino.h>
2
+
3
+ uint32_t vbat_pin = PIN_VBAT; // A7 for feather nRF52832, A6 for nRF52840
1
4
2
5
#define VBAT_MV_PER_LSB (0 .73242188F ) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
3
6
4
7
#ifdef NRF52840_XXAA // if this is for nrf52840
5
- #define VBAT_PIN (A6)
6
- #define VBAT_DIVIDER (0 .5F ) // 150K + 150K voltage divider on VBAT
8
+ #define VBAT_DIVIDER (0 .5F ) // 150K + 150K voltage divider on VBAT
7
9
#define VBAT_DIVIDER_COMP (2 .0F ) // Compensation factor for the VBAT divider
8
10
#else
9
- #define VBAT_PIN (A7)
10
11
#define VBAT_DIVIDER (0 .71275837F ) // 2M + 0.806M voltage divider on VBAT = (2M / (0.806M + 2M))
11
12
#define VBAT_DIVIDER_COMP (1 .403F ) // Compensation factor for the VBAT divider
12
13
#endif
@@ -27,7 +28,7 @@ float readVBAT(void) {
27
28
delay (1 );
28
29
29
30
// Get the raw 12-bit, 0..3000mV ADC value
30
- raw = analogRead (VBAT_PIN );
31
+ raw = analogRead (vbat_pin );
31
32
32
33
// Set the ADC back to the default settings
33
34
analogReference (AR_DEFAULT);
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ static const uint8_t A7 = PIN_A7 ;
78
78
79
79
// Other pins
80
80
#define PIN_AREF (24)
81
- #define PIN_DFU (20)
81
+ #define PIN_VBAT PIN_A7
82
82
#define PIN_NFC1 (9)
83
83
#define PIN_NFC2 (10)
84
84
Original file line number Diff line number Diff line change @@ -86,8 +86,8 @@ static const uint8_t A7 = PIN_A7 ;
86
86
#define ADC_RESOLUTION 14
87
87
88
88
// Other pins
89
- #define PIN_AREF ( PIN_A7)
90
- #define PIN_DFU (7)
89
+ #define PIN_AREF PIN_A7
90
+ #define PIN_VBAT PIN_A6
91
91
#define PIN_NFC1 (33)
92
92
#define PIN_NFC2 (2)
93
93
Original file line number Diff line number Diff line change @@ -86,8 +86,8 @@ static const uint8_t A7 = PIN_A7 ;
86
86
#define ADC_RESOLUTION 14
87
87
88
88
// Other pins
89
- #define PIN_AREF ( PIN_A7)
90
- #define PIN_DFU (7)
89
+ #define PIN_AREF PIN_A7
90
+ #define PIN_VBAT PIN_A6
91
91
#define PIN_NFC1 (2)
92
92
#define PIN_NFC2 (51)
93
93
Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ static const uint8_t A7 = PIN_A7 ;
78
78
79
79
// Other pins
80
80
#define PIN_AREF (2)
81
- #define PIN_DFU (11)
82
81
#define PIN_NFC1 (9)
83
82
#define PIN_NFC2 (10)
84
83
You can’t perform that action at this time.
0 commit comments