Skip to content

Commit 5810160

Browse files
committed
Changed default ADC vref configuration from driver-level to target-level
1 parent aa9131f commit 5810160

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

drivers/AnalogIn.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class AnalogIn {
9898
* ADC reference voltage (typically equal to supply voltage). The ADC reference voltage
9999
* sets the maximum voltage the ADC can quantify (ie: Vin == Vref when ADC output == ADC_MAX_VALUE)
100100
*
101-
* The target's ADC reference voltage can be configured by overriding "drivers.adc_vref"
101+
* The target's ADC reference voltage can be configured by overriding "target.adc_vref"
102102
*
103103
* @returns A floating-point value representing the current input voltage, measured in volts.
104104
*/
@@ -107,7 +107,7 @@ class AnalogIn {
107107
/**
108108
* Sets this AnalogIn instance's reference voltage.
109109
*
110-
* Defaults to the configurable MBED_CONF_DRIVERS_DEFAULT_ADC_VREF setting.
110+
* Defaults to the configurable MBED_CONF_TARGET_DEFAULT_ADC_VREF setting.
111111
*
112112
* The AnalogIn's reference voltage is used to scale the output when calling AnalogIn::read_volts
113113
*

drivers/mbed_lib.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
"qspi_csn": {
4242
"help": "QSPI chip select pin",
4343
"value": "QSPI_FLASH1_CSN"
44-
},
45-
"default-adc-vref": {
46-
"help": "Default reference voltage for ADC (float)",
47-
"value": "3.3f"
48-
}
44+
}
4945
}
5046
}

drivers/source/AnalogIn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ namespace mbed {
2323

2424
SingletonPtr<PlatformMutex> AnalogIn::_mutex;
2525

26-
AnalogIn::AnalogIn(PinName pin) : vref(MBED_CONF_DRIVERS_DEFAULT_ADC_VREF)
26+
AnalogIn::AnalogIn(PinName pin) : vref(MBED_CONF_TARGET_DEFAULT_ADC_VREF)
2727
{
2828
lock();
2929
analogin_init(&_adc, pin);
3030
unlock();
3131
}
3232

33-
AnalogIn::AnalogIn(const PinMap &pinmap) : vref(MBED_CONF_DRIVERS_DEFAULT_ADC_VREF)
33+
AnalogIn::AnalogIn(const PinMap &pinmap) : vref(MBED_CONF_TARGET_DEFAULT_ADC_VREF)
3434
{
3535
lock();
3636
analogin_init_direct(&_adc, &pinmap);

targets/targets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
"xip-enable": {
8181
"help": "Enable Execute In Place (XIP) on this target. Value is only significant if the board has executable external storage such as QSPIF. If this is enabled, customize the linker file to choose what text segments are placed on external storage",
8282
"value": false
83+
},
84+
"default-adc-vref": {
85+
"help": "Default reference voltage for ADC (float)",
86+
"value": "3.3f"
8387
}
8488
}
8589
},

0 commit comments

Comments
 (0)