File tree 4 files changed +11
-1
lines changed
4 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -570,13 +570,17 @@ float analogReference() {
570
570
case ADC_VREF_CONTROL_VREFH0_AVSS0:
571
571
// the user must know the voltage he applies from outside
572
572
return NAN;
573
+ #ifdef AR_INTERNAL_VOLTAGE
574
+ case ADC_VREF_CONTROL_IVREF_AVSS0:
575
+ return AR_INTERNAL_VOLTAGE;
576
+ #endif
573
577
default :
574
578
#if defined(AVCC_MEASURE_PIN)
575
579
if (aref == 0 ) {
576
580
analogReference (AR_INTERNAL);
577
581
delayMicroseconds (5 );
578
582
for (int i = 0 ; i < 10 ; i++) {
579
- aref += analogRead (AVCC_MEASURE_PIN) * 1 . 43f * AVCC_MULTIPLY_FACTOR / (1 << _analogRequestedReadResolution);
583
+ aref += analogRead (AVCC_MEASURE_PIN) * AR_INTERNAL_VOLTAGE * AVCC_MULTIPLY_FACTOR / (1 << _analogRequestedReadResolution);
580
584
}
581
585
aref = aref / 10 ;
582
586
analogReference (AR_DEFAULT);
Original file line number Diff line number Diff line change @@ -156,6 +156,8 @@ static const uint8_t SS = PIN_SPI_CS;
156
156
#define AVCC_MEASURE_PIN 20
157
157
#define AVCC_MULTIPLY_FACTOR 8.33
158
158
159
+ #define AR_INTERNAL_VOLTAGE 1.43f
160
+
159
161
#define USB_VID (0x2341)
160
162
#define USB_PID (0x0069)
161
163
#define USB_NAME "UNO R4 Minima"
Original file line number Diff line number Diff line change @@ -207,3 +207,5 @@ static const uint8_t SS = PIN_SPI_CS;
207
207
#define SerialLoRa Serial3
208
208
209
209
#define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_SUBCLK
210
+
211
+ #define AR_INTERNAL_VOLTAGE 1.18f
Original file line number Diff line number Diff line change @@ -158,6 +158,8 @@ static const uint8_t SS = PIN_SPI_CS;
158
158
#define AVCC_MEASURE_PIN 20
159
159
#define AVCC_MULTIPLY_FACTOR 8.33
160
160
161
+ #define AR_INTERNAL_VOLTAGE 1.43f
162
+
161
163
#define USB_VID (0x2341)
162
164
#define USB_PID (0x006D)
163
165
#define USB_NAME "UNO R4 WiFi"
You can’t perform that action at this time.
0 commit comments