From 8a237237a3889036e1a612237b0e585fa0713a66 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 4 Sep 2019 15:05:03 +1000 Subject: docs: Rename machine.ADC docs to machine.ADCWiPy. To signify that this ADC documentation is specific to the WiPy, and to make way for a standardised ADC documentation. --- docs/library/index.rst | 1 + docs/library/machine.ADC.rst | 74 ------------------------------------ docs/library/machine.ADCWiPy.rst | 81 ++++++++++++++++++++++++++++++++++++++++ docs/wipy/quickref.rst | 2 +- 4 files changed, 83 insertions(+), 75 deletions(-) delete mode 100644 docs/library/machine.ADC.rst create mode 100644 docs/library/machine.ADCWiPy.rst (limited to 'docs') diff --git a/docs/library/index.rst b/docs/library/index.rst index b464e85fa..4e23e6e01 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -136,6 +136,7 @@ The following libraries and classes are specific to the WiPy. :maxdepth: 2 wipy.rst + machine.ADCWiPy.rst machine.TimerWiPy.rst diff --git a/docs/library/machine.ADC.rst b/docs/library/machine.ADC.rst deleted file mode 100644 index 4c7a04d74..000000000 --- a/docs/library/machine.ADC.rst +++ /dev/null @@ -1,74 +0,0 @@ -.. currentmodule:: machine -.. _machine.ADC: - -class ADC -- analog to digital conversion -========================================= - -Usage:: - - import machine - - adc = machine.ADC() # create an ADC object - apin = adc.channel(pin='GP3') # create an analog pin on GP3 - val = apin() # read an analog value - -Constructors ------------- - -.. class:: ADC(id=0, \*, bits=12) - - Create an ADC object associated with the given pin. - This allows you to then read analog values on that pin. - For more info check the `pinout and alternate functions - table. `_ - - .. warning:: - - ADC pin input range is 0-1.4V (being 1.8V the absolute maximum that it - can withstand). When GP2, GP3, GP4 or GP5 are remapped to the - ADC block, 1.8 V is the maximum. If these pins are used in digital mode, - then the maximum allowed input is 3.6V. - -Methods -------- - -.. method:: ADC.channel(id, \*, pin) - - Create an analog pin. If only channel ID is given, the correct pin will - be selected. Alternatively, only the pin can be passed and the correct - channel will be selected. Examples:: - - # all of these are equivalent and enable ADC channel 1 on GP3 - apin = adc.channel(1) - apin = adc.channel(pin='GP3') - apin = adc.channel(id=1, pin='GP3') - -.. method:: ADC.init() - - Enable the ADC block. - -.. method:: ADC.deinit() - - Disable the ADC block. - -class ADCChannel --- read analog values from internal or external sources -========================================================================= - -ADC channels can be connected to internal points of the MCU or to GPIO pins. -ADC channels are created using the ADC.channel method. - -.. method:: adcchannel() - - Fast method to read the channel value. - -.. method:: adcchannel.value() - - Read the channel value. - -.. method:: adcchannel.init() - - Re-init (and effectively enable) the ADC channel. - -.. method:: adcchannel.deinit() - - Disable the ADC channel. diff --git a/docs/library/machine.ADCWiPy.rst b/docs/library/machine.ADCWiPy.rst new file mode 100644 index 000000000..4a4f0524c --- /dev/null +++ b/docs/library/machine.ADCWiPy.rst @@ -0,0 +1,81 @@ +.. currentmodule:: machine +.. _machine.ADCWiPy: + +class ADCWiPy -- analog to digital conversion +============================================= + +.. note:: + + This class is a non-standard ADC implementation for the WiPy. + It is available simply as ``machine.ADC`` on the WiPy but is named in the + documentation below as ``machine.ADCWiPy`` to distinguish it from the + more general :ref:`machine.ADC ` class. + +Usage:: + + import machine + + adc = machine.ADC() # create an ADC object + apin = adc.channel(pin='GP3') # create an analog pin on GP3 + val = apin() # read an analog value + +Constructors +------------ + +.. class:: ADCWiPy(id=0, \*, bits=12) + + Create an ADC object associated with the given pin. + This allows you to then read analog values on that pin. + For more info check the `pinout and alternate functions + table. `_ + + .. warning:: + + ADC pin input range is 0-1.4V (being 1.8V the absolute maximum that it + can withstand). When GP2, GP3, GP4 or GP5 are remapped to the + ADC block, 1.8 V is the maximum. If these pins are used in digital mode, + then the maximum allowed input is 3.6V. + +Methods +------- + +.. method:: ADCWiPy.channel(id, \*, pin) + + Create an analog pin. If only channel ID is given, the correct pin will + be selected. Alternatively, only the pin can be passed and the correct + channel will be selected. Examples:: + + # all of these are equivalent and enable ADC channel 1 on GP3 + apin = adc.channel(1) + apin = adc.channel(pin='GP3') + apin = adc.channel(id=1, pin='GP3') + +.. method:: ADCWiPy.init() + + Enable the ADC block. + +.. method:: ADCWiPy.deinit() + + Disable the ADC block. + +class ADCChannel --- read analog values from internal or external sources +========================================================================= + +ADC channels can be connected to internal points of the MCU or to GPIO pins. +ADC channels are created using the ADC.channel method. + +.. method:: adcchannel() + + Fast method to read the channel value. + +.. method:: adcchannel.value() + + Read the channel value. + +.. method:: adcchannel.init() + + Re-init (and effectively enable) the ADC channel. + +.. method:: adcchannel.deinit() + + Disable the ADC channel. diff --git a/docs/wipy/quickref.rst b/docs/wipy/quickref.rst index 7aa832fd2..6349676cf 100644 --- a/docs/wipy/quickref.rst +++ b/docs/wipy/quickref.rst @@ -82,7 +82,7 @@ See :ref:`machine.Pin ` and :ref:`machine.Timer `. : ADC (analog to digital conversion) ---------------------------------- -See :ref:`machine.ADC `. :: +See :ref:`machine.ADCWiPy `. :: from machine import ADC -- cgit v1.2.3