From d42a301afd2661618e2a1a6a09c668b2f044c3d8 Mon Sep 17 00:00:00 2001 From: Ned Konz Date: Tue, 30 Sep 2025 12:52:25 -0700 Subject: zephyr/machine_adc: Add ADC support. This commit adds support for ADC peripherals in the Zephyr port. As is typical for Zephyr, the ADC channel setup is done in the devicetree (typically using an overlay). This code requires ADC channels to be listed in the io-channels property of the zephyr,user root node. Signed-off-by: Ned Konz --- docs/zephyr/quickref.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'docs/zephyr/quickref.rst') diff --git a/docs/zephyr/quickref.rst b/docs/zephyr/quickref.rst index 0e985c70b..64054bf99 100644 --- a/docs/zephyr/quickref.rst +++ b/docs/zephyr/quickref.rst @@ -119,6 +119,19 @@ Hardware SPI is accessed via the :ref:`machine.SPI ` class:: spi.write_readinto(b'abcd', buf) # write to MOSI and read from MISO into the buffer spi.write_readinto(buf, buf) # write buf to MOSI and read back into the buf +Analog to Digital Converter (ADC) +---------------------------------- + +Use the :ref:`machine.ADC ` class. + +Example of using ADC to read a pin's analog value (the ``zephyr,user`` node must contain +the ``io-channels`` property containing all the ADC channels):: + + from machine import ADC + + adc = ADC(("adc", 0)) + adc.read_uv() + Disk Access ----------- -- cgit v1.2.3