From d46899626e93b35de549edd6d8954527398a8036 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 5 Apr 2017 12:09:36 +0300 Subject: docs/machine.Pin: Move wipy-specific details to its own docs. --- docs/library/machine.Pin.rst | 52 -------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index 952131f09..d3aa37b45 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -38,58 +38,6 @@ Usage Model:: # configure an irq callback p0.irq(lambda p:print(p)) -.. only:: port_wipy - - On the WiPy board the pins are identified by their string id:: - - from machine import Pin - g = machine.Pin('GP9', mode=Pin.OUT, pull=None, drive=Pin.MED_POWER, alt=-1) - - You can also configure the Pin to generate interrupts. For instance:: - - from machine import Pin - - def pincb(pin): - print(pin.id()) - - pin_int = Pin('GP10', mode=Pin.IN, pull=Pin.PULL_DOWN) - pin_int.irq(trigger=Pin.IRQ_RISING, handler=pincb) - # the callback can be triggered manually - pin_int.irq()() - # to disable the callback - pin_int.irq().disable() - - Now every time a falling edge is seen on the gpio pin, the callback will be - executed. Caution: mechanical push buttons have "bounce" and pushing or - releasing a switch will often generate multiple edges. - See: http://www.eng.utah.edu/~cs5780/debouncing.pdf for a detailed - explanation, along with various techniques for debouncing. - - All pin objects go through the pin mapper to come up with one of the - gpio pins. - - For the ``drive`` parameter the strengths are: - - - ``Pin.LOW_POWER`` - 2mA drive capability. - - ``Pin.MED_POWER`` - 4mA drive capability. - - ``Pin.HIGH_POWER`` - 6mA drive capability. - - For the ``alt`` parameter please refer to the pinout and alternate functions - table at `_ - for the specific alternate functions that each pin supports. - - For interrupts, the ``priority`` can take values in the range 1-7. And the - ``wake`` parameter has the following properties: - - - If ``wake_from=machine.Sleep.ACTIVE`` any pin can wake the board. - - If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``, - ``GP11``, GP17`` or ``GP24`` can wake the board. Note that only 1 - of this pins can be enabled as a wake source at the same time, so, only - the last enabled pin as a ``machine.Sleep.SUSPENDED`` wake source will have effect. - - If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``, - ``GP11``, ``GP17`` and ``GP24`` can wake the board. In this case all of the - 6 pins can be enabled as a ``machine.Sleep.HIBERNATE`` wake source at the same time. - Constructors ------------ -- cgit v1.2.3 From 390d5a3bf101eba5952c3f757f27b82ff0bdfed1 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 5 Apr 2017 13:05:04 +0300 Subject: docs/machine.Pin: Move wipy-specific methods to its docs. --- docs/library/machine.Pin.rst | 10 ---------- docs/wipy/general.rst | 7 +++++++ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index d3aa37b45..216ebcb2a 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -225,16 +225,6 @@ Methods This method returns a callback object. -.. only:: port_wipy - - .. method:: Pin.alt_list() - - Returns a list of the alternate functions supported by the pin. List items are - a tuple of the form: ``('ALT_FUN_NAME', ALT_FUN_INDEX)`` - - Availability: WiPy. - - Attributes ---------- diff --git a/docs/wipy/general.rst b/docs/wipy/general.rst index 0d0327f4b..d7b35cc4e 100644 --- a/docs/wipy/general.rst +++ b/docs/wipy/general.rst @@ -232,3 +232,10 @@ For interrupts, the ``priority`` can take values in the range 1-7. And the - If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``, ``GP11``, ``GP17`` and ``GP24`` can wake the board. In this case all of the 6 pins can be enabled as a ``machine.Sleep.HIBERNATE`` wake source at the same time. + +Additional Pin methods: + +.. method:: machine.Pin.alt_list() + + Returns a list of the alternate functions supported by the pin. List items are + a tuple of the form: ``('ALT_FUN_NAME', ALT_FUN_INDEX)`` -- cgit v1.2.3 From d4675e7674788546420ac6a89a42f8afda191488 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 18 Apr 2017 15:27:37 +1000 Subject: docs/library/machine.*: Add cross-reference label to individual classes. --- docs/library/machine.ADC.rst | 1 + docs/library/machine.I2C.rst | 1 + docs/library/machine.Pin.rst | 1 + docs/library/machine.RTC.rst | 1 + docs/library/machine.SD.rst | 1 + docs/library/machine.SPI.rst | 1 + docs/library/machine.Timer.rst | 1 + docs/library/machine.UART.rst | 1 + docs/library/machine.WDT.rst | 1 + 9 files changed, 9 insertions(+) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.ADC.rst b/docs/library/machine.ADC.rst index 2752878ff..4c7a04d74 100644 --- a/docs/library/machine.ADC.rst +++ b/docs/library/machine.ADC.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.ADC: class ADC -- analog to digital conversion ========================================= diff --git a/docs/library/machine.I2C.rst b/docs/library/machine.I2C.rst index e62d465e0..e2eb62ca3 100644 --- a/docs/library/machine.I2C.rst +++ b/docs/library/machine.I2C.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.I2C: class I2C -- a two-wire serial protocol ======================================= diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index 216ebcb2a..369c08f44 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.Pin: class Pin -- control I/O pins ============================= diff --git a/docs/library/machine.RTC.rst b/docs/library/machine.RTC.rst index 6dc8b3e9a..2a53b9146 100644 --- a/docs/library/machine.RTC.rst +++ b/docs/library/machine.RTC.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.RTC: class RTC -- real time clock ============================ diff --git a/docs/library/machine.SD.rst b/docs/library/machine.SD.rst index 21c28aa20..0eb024602 100644 --- a/docs/library/machine.SD.rst +++ b/docs/library/machine.SD.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.SD: class SD -- secure digital memory card ====================================== diff --git a/docs/library/machine.SPI.rst b/docs/library/machine.SPI.rst index 82858629f..fbb44d038 100644 --- a/docs/library/machine.SPI.rst +++ b/docs/library/machine.SPI.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.SPI: class SPI -- a Serial Peripheral Interface bus protocol (master side) ===================================================================== diff --git a/docs/library/machine.Timer.rst b/docs/library/machine.Timer.rst index eddb2ce78..ef46f9dd7 100644 --- a/docs/library/machine.Timer.rst +++ b/docs/library/machine.Timer.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.Timer: class Timer -- control hardware timers ====================================== diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index c29d079b7..0b2ebbd0b 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.UART: class UART -- duplex serial communication bus ============================================= diff --git a/docs/library/machine.WDT.rst b/docs/library/machine.WDT.rst index 1d79b4c4e..5ca6dce45 100644 --- a/docs/library/machine.WDT.rst +++ b/docs/library/machine.WDT.rst @@ -1,4 +1,5 @@ .. currentmodule:: machine +.. _machine.WDT: class WDT -- watchdog timer =========================== -- cgit v1.2.3 From c19f07bd52aeb59ac8bdfa1e575e2323f6a14c6e Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 14 May 2017 22:52:16 +0300 Subject: docs/machine.Pin: There's no toggle() method in MicroPython hardware API. May be a port-specific method, not portable, not part of the official specification. --- docs/library/machine.Pin.rst | 9 --------- 1 file changed, 9 deletions(-) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index 369c08f44..6d6ba7bfd 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -158,15 +158,6 @@ Methods and get the value of the pin. It is equivalent to Pin.value([x]). See :meth:`Pin.value` for more details. -.. method:: Pin.toggle() - - Toggle the output value of the pin. Equivalent to ``pin.value(not pin.out_value())``. - Returns ``None``. - - Not all ports implement this method. - - Availability: WiPy. - .. method:: Pin.id() Get the pin identifier. This may return the ``id`` as specified in the -- cgit v1.2.3 From 3ebd67fc099161b43b61fd18e8e98b8274ebe9b4 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 21 May 2017 15:50:16 +0300 Subject: library/machine.Pin: Remove .id() method and .board class attr. Both aren't part of generic Hardware API: It's impossible to implement .id() method in a generic case (e.g., when Pin is instantiated by the underlying OS/RTOS). .board attribute is an obvious space hog which instead can be implemented on Python level if needed. --- docs/library/machine.Pin.rst | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index 6d6ba7bfd..2efd84688 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -158,11 +158,6 @@ Methods and get the value of the pin. It is equivalent to Pin.value([x]). See :meth:`Pin.value` for more details. -.. method:: Pin.id() - - Get the pin identifier. This may return the ``id`` as specified in the - constructor. Or it may return a canonical software-specific pin id. - .. method:: Pin.mode([mode]) Get or set the pin mode. @@ -217,19 +212,6 @@ Methods This method returns a callback object. -Attributes ----------- - -.. class:: Pin.board - - Contains all ``Pin`` objects supported by the board. Examples:: - - Pin.board.GP25 - led = Pin(Pin.board.GP25, mode=Pin.OUT) - Pin.board.GP2.alt_list() - - Availability: WiPy. - Constants --------- -- cgit v1.2.3 From 3496d9e4bd39452484d8a99e991ef7c0a92d5b51 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 29 May 2017 20:51:30 +0300 Subject: docs/machine.Pin: Remove out_value() method. This method isn't implemented in any port. It seemed to have originated in cc3200 port, but actually never was implemented there either. In general case, it's impossible to implement this method (for example, for a perfect GPO, which has only output latch without any feedback look into a CPU). --- docs/library/machine.Pin.rst | 6 ------ 1 file changed, 6 deletions(-) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index 2efd84688..e7f314154 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -146,12 +146,6 @@ Methods When setting the value this method returns ``None``. -.. method:: Pin.out_value() - - Return the value stored in the output buffer of a pin, regardless of its mode. - - Not all ports implement this method. - .. method:: Pin.__call__([x]) Pin objects are callable. The call method provides a (fast) shortcut to set -- cgit v1.2.3 From d5b8825d5f5c6110f9cf3bd39848cfe94137d291 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 29 May 2017 20:56:13 +0300 Subject: docs/machine.Pin: Add on() and off() methods. --- docs/library/machine.Pin.rst | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs/library/machine.Pin.rst') diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index e7f314154..05ceb4ad3 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -152,6 +152,14 @@ Methods and get the value of the pin. It is equivalent to Pin.value([x]). See :meth:`Pin.value` for more details. +.. method:: Pin.on() + + Set pin to "1" output level. + +.. method:: Pin.off() + + Set pin to "0" output level. + .. method:: Pin.mode([mode]) Get or set the pin mode. -- cgit v1.2.3