Lines Matching +full:internal +full:- +full:vref +full:- +full:mv
10 * SPDX-License-Identifier: Apache-2.0
17 #include <zephyr/dt-bindings/adc/adc.h>
71 * @retval -EINVAL if the gain could not be interpreted
82 ADC_REF_INTERNAL, /**< Internal. */
104 * Value range is 0-16383 for a given unit.
110 * This value primarily identifies the channel within the ADC API - when
125 * While this API allows identifiers from range 0-31, particular drivers
132 /** Channel type: single-ended or differential. */
185 * #address-cells = <1>;
186 * #size-cells = <0>;
192 * zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20)>;
193 * zephyr,input-positive = <NRF_SAADC_AIN6>;
194 * zephyr,input-negative = <NRF_SAADC_AIN7>;
201 * zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
202 * zephyr,input-positive = <NRF_SAADC_AIN0>;
223 * // .input-negative = NRF_SAADC_AIN7,
267 * used by this io-channel.
271 /** ADC channel identifier used by this io-channel. */
337 * @brief Get ADC io-channel information from devicetree by name.
341 * the "io-channels" property defined.
348 * io-channels = <&adc0 1>, <&adc0 3>;
349 * io-channel-names = "A0", "A1";
354 * #address-cells = <1>;
355 * #size-cells = <0>;
361 * zephyr,vref-mv = <750>;
362 * zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
408 /** @brief Get ADC io-channel information from a DT_DRV_COMPAT devicetree
422 * @brief Get ADC io-channel information from devicetree.
426 * the "io-channels" property defined.
433 * io-channels = <&adc0 1>, <&adc0 3>;
438 * #address-cells = <1>;
439 * #size-cells = <0>;
445 * zephyr,vref-mv = <750>;
446 * zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
494 /** @brief Get ADC io-channel information from a DT_DRV_COMPAT devicetree
563 * @param sampling_index Index (0-65535) of the sampling done.
588 * Optional - set to NULL if it is not needed.
616 * Bit-mask indicating the channels to be included in each sampling
647 * For single-ended channels the sample values are from range:
648 * 0 .. 2^resolution - 1,
650 * - 2^(resolution-1) .. 2^(resolution-1) - 1.
708 uint16_t ref_internal; /* mV */
721 * @retval -EINVAL If a parameter with an invalid value has been provided.
729 return DEVICE_API_GET(adc, dev)->channel_setup(dev, channel_cfg); in z_impl_adc_channel_setup()
737 * @return A value from adc_channel_setup() or -ENOTSUP if information from
743 if (!spec->channel_cfg_dt_node_exists) { in adc_channel_setup_dt()
744 return -ENOTSUP; in adc_channel_setup_dt()
747 return adc_channel_setup(spec->dev, &spec->channel_cfg); in adc_channel_setup_dt()
760 * @retval -EINVAL If a parameter with an invalid value has been provided.
761 * @retval -ENOMEM If the provided buffer is to small to hold the results
763 * @retval -ENOTSUP If the requested mode of operation is not supported.
764 * @retval -EBUSY If another sampling was triggered while the previous one
777 return DEVICE_API_GET(adc, dev)->read(dev, sequence); in z_impl_adc_read()
792 return adc_read(spec->dev, sequence); in adc_read_dt()
825 return DEVICE_API_GET(adc, dev)->read_async(dev, sequence, async); in z_impl_adc_read_async()
830 * @brief Get the internal reference voltage.
840 return DEVICE_API_GET(adc, dev)->ref_internal; in adc_ref_internal()
864 * @retval -EINVAL if the gain is not reversible
890 * @return A value from adc_raw_to_millivolts() or -ENOTSUP if information from
900 if (!spec->channel_cfg_dt_node_exists) { in adc_raw_to_millivolts_dt()
901 return -ENOTSUP; in adc_raw_to_millivolts_dt()
904 if (spec->channel_cfg.reference == ADC_REF_INTERNAL) { in adc_raw_to_millivolts_dt()
905 vref_mv = (int32_t)adc_ref_internal(spec->dev); in adc_raw_to_millivolts_dt()
907 vref_mv = spec->vref_mv; in adc_raw_to_millivolts_dt()
910 resolution = spec->resolution; in adc_raw_to_millivolts_dt()
916 if (spec->channel_cfg.differential) { in adc_raw_to_millivolts_dt()
917 resolution -= 1U; in adc_raw_to_millivolts_dt()
920 return adc_raw_to_millivolts(vref_mv, spec->channel_cfg.gain, in adc_raw_to_millivolts_dt()
930 * - @ref adc_sequence.channels
931 * - @ref adc_sequence.resolution
932 * - @ref adc_sequence.oversampling
940 * @retval -ENOTSUP If @p spec does not have valid channel configuration
945 if (!spec->channel_cfg_dt_node_exists) { in adc_sequence_init_dt()
946 return -ENOTSUP; in adc_sequence_init_dt()
949 seq->channels = BIT(spec->channel_id); in adc_sequence_init_dt()
950 seq->resolution = spec->resolution; in adc_sequence_init_dt()
951 seq->oversampling = spec->oversampling; in adc_sequence_init_dt()
965 return device_is_ready(spec->dev); in adc_is_ready_dt()