Changed default ADC vref configuration from driver-level to target-level

pull/12471/head
George Beckstein 2020-04-03 04:25:29 -04:00
parent 5d3d633566
commit 746f2f5fb5
4 changed files with 9 additions and 9 deletions

View File

@ -98,7 +98,7 @@ public:
* ADC reference voltage (typically equal to supply voltage). The ADC reference voltage
* sets the maximum voltage the ADC can quantify (ie: Vin == Vref when ADC output == ADC_MAX_VALUE)
*
* The target's ADC reference voltage can be configured by overriding "drivers.adc_vref"
* The target's ADC reference voltage can be configured by overriding "target.adc_vref"
*
* @returns A floating-point value representing the current input voltage, measured in volts.
*/
@ -107,7 +107,7 @@ public:
/**
* Sets this AnalogIn instance's reference voltage.
*
* Defaults to the configurable MBED_CONF_DRIVERS_DEFAULT_ADC_VREF setting.
* Defaults to the configurable MBED_CONF_TARGET_DEFAULT_ADC_VREF setting.
*
* The AnalogIn's reference voltage is used to scale the output when calling AnalogIn::read_volts
*

View File

@ -41,10 +41,6 @@
"qspi_csn": {
"help": "QSPI chip select pin",
"value": "QSPI_FLASH1_CSN"
},
"default-adc-vref": {
"help": "Default reference voltage for ADC (float)",
"value": "3.3f"
}
}
}
}

View File

@ -23,14 +23,14 @@ namespace mbed {
SingletonPtr<PlatformMutex> AnalogIn::_mutex;
AnalogIn::AnalogIn(PinName pin) : vref(MBED_CONF_DRIVERS_DEFAULT_ADC_VREF)
AnalogIn::AnalogIn(PinName pin) : vref(MBED_CONF_TARGET_DEFAULT_ADC_VREF)
{
lock();
analogin_init(&_adc, pin);
unlock();
}
AnalogIn::AnalogIn(const PinMap &pinmap) : vref(MBED_CONF_DRIVERS_DEFAULT_ADC_VREF)
AnalogIn::AnalogIn(const PinMap &pinmap) : vref(MBED_CONF_TARGET_DEFAULT_ADC_VREF)
{
lock();
analogin_init_direct(&_adc, &pinmap);

View File

@ -80,6 +80,10 @@
"xip-enable": {
"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",
"value": false
},
"default-adc-vref": {
"help": "Default reference voltage for ADC (float)",
"value": "3.3f"
}
}
},