@@ -59,12 +59,12 @@ typedef enum {
5959#define ADC_ATTENUATION_11_DB ADC_ATTENUATION_12_DB
6060
6161/**
62- * @brief Set the attenuation for the ADC line. Default attenuation is 11 dB.
62+ * @brief Set the attenuation for the ADC line. Default attenuation is 12 dB.
6363 *
6464 * For each ADC line, an attenuation of the input signal can be defined
6565 * separately. This results in different full ranges of the measurable voltage
6666 * at the input. The attenuation can be set to 0 dB, 3 dB, 6 dB and 12 dB,
67- * with 11 dB being the standard attenuation. Since an ADC input is measured
67+ * with 12 dB being the standard attenuation. Since an ADC input is measured
6868 * against a reference voltage Vref of 1.1 V, approximately the following
6969 * measurement ranges are given when using a corresponding attenuation:
7070 *
@@ -80,33 +80,51 @@ typedef enum {
8080 * </center>
8181 *
8282 * @note: The reference voltage Vref can vary from ADC unit to ADC unit in
83- * the range of 1.0V and 1.2V. The Vref of a unit can be routed with
84- * function *adc_vref_to_gpio* to a GPIO pin .
83+ * the range of 1.0V and 1.2V. Use function adc_get_vrange to get the voltage
84+ * range of samples for the configured attenuation .
8585 *
8686 * @param line ADC line for which the attenuation is set
87- * @param atten Attenuation, see type definition of * adc_attenuation_t
87+ * @param atten Attenuation, see type definition of adc_attenuation_t
8888 * @return 0 on success
8989 * @return -1 on error
9090 */
9191int adc_set_attenuation (adc_t line , adc_atten_t atten );
9292
93+ /**
94+ * @brief Get the voltage range of samples for configured attenution
95+ *
96+ * After initializing an ADC line or reconfiguring the attenuation of an ADC
97+ * line with adc_set_attenuation, the adc_get_vrange can be used to determine
98+ * the voltage range in which the raw sample values will lie. You can use these
99+ * min and max values to calculate the voltage from the raw sample values.
100+ *
101+ * @param line ADC line
102+ * @param min voltage for a raw sample value of 0
103+ * @param max voltage for the maximum raw sample
104+ */
105+ void adc_get_vrange (adc_t line , int * min , int * max );
106+
93107/**
94108 * @brief Output reference voltage of a ADC line to GPIO n
95109 *
96110 * The Vref of the ADC unit of the given ADC line is routed to a GPIO pin n.
97111 * This allows to measure the Vref used by the ADC unit to adjusted the
98112 * results of the conversions accordingly.
99113 *
114+ * @deprecated The function is not supported any longer, use adc_get_vref to get
115+ * the reference voltage for the configured attenutation.
116+ *
100117 * @note
101118 * - The given GPIO must be a valid ADC channel of ADC2 unit.
102- * - For ESP32 and ESP32C3, the given ADC line has to be a channel of ADC2 unit .
119+ * - For ESP32, only the internal reference voltage of ADC2 is given .
103120 *
104121 * @param line ADC line for which Vref of its ADC unit is routed to the GPIO
105122 * @param gpio GPIO to which Vref is routed (ADC2 channel GPIOs only)
106123 *
107124 * @return 0 on success
108125 * @return -1 on error
109126 */
127+ __attribute__((__deprecated__ ))
110128int adc_line_vref_to_gpio (adc_t line , gpio_t gpio );
111129
112130#if defined(CPU_FAM_ESP32 )
0 commit comments