diff options
| author | Ned Konz <ned@metamagix.tech> | 2025-09-30 12:52:25 -0700 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-10-13 11:39:59 +1100 |
| commit | d42a301afd2661618e2a1a6a09c668b2f044c3d8 (patch) | |
| tree | 8d88673746448b06c9cb7b40033f3db62e188e8e /docs/zephyr | |
| parent | c9a16e862caed343a55d6d192c833def3910d53a (diff) | |
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 <ned@metamagix.tech>
Diffstat (limited to 'docs/zephyr')
| -rw-r--r-- | docs/zephyr/quickref.rst | 13 |
1 files changed, 13 insertions, 0 deletions
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 <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 <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 ----------- |
