Skip to content

Commit d468996

Browse files
committed
docs/machine.Pin: Move wipy-specific details to its own docs.
1 parent 9a38b7a commit d468996

2 files changed

Lines changed: 53 additions & 52 deletions

File tree

docs/library/machine.Pin.rst

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -38,58 +38,6 @@ Usage Model::
3838
# configure an irq callback
3939
p0.irq(lambda p:print(p))
4040

41-
.. only:: port_wipy
42-
43-
On the WiPy board the pins are identified by their string id::
44-
45-
from machine import Pin
46-
g = machine.Pin('GP9', mode=Pin.OUT, pull=None, drive=Pin.MED_POWER, alt=-1)
47-
48-
You can also configure the Pin to generate interrupts. For instance::
49-
50-
from machine import Pin
51-
52-
def pincb(pin):
53-
print(pin.id())
54-
55-
pin_int = Pin('GP10', mode=Pin.IN, pull=Pin.PULL_DOWN)
56-
pin_int.irq(trigger=Pin.IRQ_RISING, handler=pincb)
57-
# the callback can be triggered manually
58-
pin_int.irq()()
59-
# to disable the callback
60-
pin_int.irq().disable()
61-
62-
Now every time a falling edge is seen on the gpio pin, the callback will be
63-
executed. Caution: mechanical push buttons have "bounce" and pushing or
64-
releasing a switch will often generate multiple edges.
65-
See: http://www.eng.utah.edu/~cs5780/debouncing.pdf for a detailed
66-
explanation, along with various techniques for debouncing.
67-
68-
All pin objects go through the pin mapper to come up with one of the
69-
gpio pins.
70-
71-
For the ``drive`` parameter the strengths are:
72-
73-
- ``Pin.LOW_POWER`` - 2mA drive capability.
74-
- ``Pin.MED_POWER`` - 4mA drive capability.
75-
- ``Pin.HIGH_POWER`` - 6mA drive capability.
76-
77-
For the ``alt`` parameter please refer to the pinout and alternate functions
78-
table at <https://raw.githubusercontent.com/wipy/wipy/master/docs/PinOUT.png>`_
79-
for the specific alternate functions that each pin supports.
80-
81-
For interrupts, the ``priority`` can take values in the range 1-7. And the
82-
``wake`` parameter has the following properties:
83-
84-
- If ``wake_from=machine.Sleep.ACTIVE`` any pin can wake the board.
85-
- If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``,
86-
``GP11``, GP17`` or ``GP24`` can wake the board. Note that only 1
87-
of this pins can be enabled as a wake source at the same time, so, only
88-
the last enabled pin as a ``machine.Sleep.SUSPENDED`` wake source will have effect.
89-
- If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``,
90-
``GP11``, ``GP17`` and ``GP24`` can wake the board. In this case all of the
91-
6 pins can be enabled as a ``machine.Sleep.HIBERNATE`` wake source at the same time.
92-
9341
Constructors
9442
------------
9543

docs/wipy/general.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,56 @@ Details on sleep modes
179179
* ``machine.sleep()``: 950uA (in WLAN STA mode). Wake sources are ``Pin``, ``RTC``
180180
and ``WLAN``
181181
* ``machine.deepsleep()``: ~350uA. Wake sources are ``Pin`` and ``RTC``.
182+
183+
Additional details for machine.Pin
184+
----------------------------------
185+
186+
On the WiPy board the pins are identified by their string id::
187+
188+
from machine import Pin
189+
g = machine.Pin('GP9', mode=Pin.OUT, pull=None, drive=Pin.MED_POWER, alt=-1)
190+
191+
You can also configure the Pin to generate interrupts. For instance::
192+
193+
from machine import Pin
194+
195+
def pincb(pin):
196+
print(pin.id())
197+
198+
pin_int = Pin('GP10', mode=Pin.IN, pull=Pin.PULL_DOWN)
199+
pin_int.irq(trigger=Pin.IRQ_RISING, handler=pincb)
200+
# the callback can be triggered manually
201+
pin_int.irq()()
202+
# to disable the callback
203+
pin_int.irq().disable()
204+
205+
Now every time a falling edge is seen on the gpio pin, the callback will be
206+
executed. Caution: mechanical push buttons have "bounce" and pushing or
207+
releasing a switch will often generate multiple edges.
208+
See: http://www.eng.utah.edu/~cs5780/debouncing.pdf for a detailed
209+
explanation, along with various techniques for debouncing.
210+
211+
All pin objects go through the pin mapper to come up with one of the
212+
gpio pins.
213+
214+
For the ``drive`` parameter the strengths are:
215+
216+
- ``Pin.LOW_POWER`` - 2mA drive capability.
217+
- ``Pin.MED_POWER`` - 4mA drive capability.
218+
- ``Pin.HIGH_POWER`` - 6mA drive capability.
219+
220+
For the ``alt`` parameter please refer to the pinout and alternate functions
221+
table at <https://raw.githubusercontent.com/wipy/wipy/master/docs/PinOUT.png>`_
222+
for the specific alternate functions that each pin supports.
223+
224+
For interrupts, the ``priority`` can take values in the range 1-7. And the
225+
``wake`` parameter has the following properties:
226+
227+
- If ``wake_from=machine.Sleep.ACTIVE`` any pin can wake the board.
228+
- If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``,
229+
``GP11``, GP17`` or ``GP24`` can wake the board. Note that only 1
230+
of this pins can be enabled as a wake source at the same time, so, only
231+
the last enabled pin as a ``machine.Sleep.SUSPENDED`` wake source will have effect.
232+
- If ``wake_from=machine.Sleep.SUSPENDED`` pins ``GP2``, ``GP4``, ``GP10``,
233+
``GP11``, ``GP17`` and ``GP24`` can wake the board. In this case all of the
234+
6 pins can be enabled as a ``machine.Sleep.HIBERNATE`` wake source at the same time.

0 commit comments

Comments
 (0)