Skip to content

Commit 7f19f82

Browse files
committed
Revised doxygen comments and fixed code style inconsistencies
1 parent aeb91c2 commit 7f19f82

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

drivers/AnalogIn.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,19 @@ class AnalogIn {
7272
/** Create an AnalogIn, connected to the specified pin
7373
*
7474
* @param pinmap reference to structure which holds static pinmap.
75+
* @param vref (optional) Reference voltage of this AnalogIn instance (defaults to target.default-adc-vref).
76+
*
77+
* @note An input voltage at or above the given vref value will produce a 1.0 result when `read` is called
7578
*/
7679
AnalogIn(const PinMap &pinmap, float vref = MBED_CONF_TARGET_DEFAULT_ADC_VREF);
7780
AnalogIn(const PinMap &&, float vref = MBED_CONF_TARGET_DEFAULT_ADC_VREF) = delete; // prevent passing of temporary objects
7881

7982
/** Create an AnalogIn, connected to the specified pin
8083
*
8184
* @param pin AnalogIn pin to connect to
85+
* @param vref (optional) Reference voltage of this AnalogIn instance (defaults to target.default-adc-vref).
86+
*
87+
* @note An input voltage at or above the given vref value will produce a 1.0 result when `read` is called
8288
*/
8389
AnalogIn(PinName pin, float vref = MBED_CONF_TARGET_DEFAULT_ADC_VREF);
8490

@@ -98,9 +104,11 @@ class AnalogIn {
98104
/**
99105
* Read the input voltage in volts. The output depends on the target board's
100106
* ADC reference voltage (typically equal to supply voltage). The ADC reference voltage
101-
* sets the maximum voltage the ADC can quantify (ie: Vin == Vref when ADC output == ADC_MAX_VALUE)
107+
* sets the maximum voltage the ADC can quantify (ie: ADC output == ADC_MAX_VALUE when Vin == Vref)
102108
*
103-
* The target's ADC reference voltage can be configured by overriding "target.adc_vref"
109+
* The target's default ADC reference voltage is determined by the configuration
110+
* option target.default-adc_vref. The reference voltage for a particular input
111+
* can be manually specified by either the constructor or `AnalogIn::set_reference_voltage`.
104112
*
105113
* @returns A floating-point value representing the current input voltage, measured in volts.
106114
*/
@@ -109,8 +117,6 @@ class AnalogIn {
109117
/**
110118
* Sets this AnalogIn instance's reference voltage.
111119
*
112-
* Defaults to the configurable MBED_CONF_TARGET_DEFAULT_ADC_VREF setting.
113-
*
114120
* The AnalogIn's reference voltage is used to scale the output when calling AnalogIn::read_volts
115121
*
116122
* @param[in] vref New ADC reference voltage for this AnalogIn instance.
@@ -122,7 +128,7 @@ class AnalogIn {
122128
*
123129
* @returns A floating-point value representing this AnalogIn's reference voltage, measured in volts.
124130
*/
125-
float get_reference_voltage(void);
131+
float get_reference_voltage() const;
126132

127133
/** An operator shorthand for read()
128134
*

drivers/source/AnalogIn.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ unsigned short AnalogIn::read_u16()
5656

5757
float AnalogIn::read_voltage()
5858
{
59-
return (this->read() * this->_vref);
59+
return read() * _vref;
6060
}
6161

6262
void AnalogIn::set_reference_voltage(float vref)
6363
{
64-
this->_vref = vref;
64+
_vref = vref;
6565
}
6666

67-
float AnalogIn::get_reference_voltage(void)
67+
float AnalogIn::get_reference_voltage(void) const
6868
{
69-
return this->_vref;
69+
return _vref;
7070
}
7171

7272
} // namespace mbed

0 commit comments

Comments
 (0)