Skip to content

Commit b64cdae

Browse files
author
Martin O'Hanlon
committed
issue fix plus pinout
1 parent c72c733 commit b64cdae

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

docs/examples/print_pinout.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from picozero import pinout
2+
3+
pinout()

docs/recipes.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,38 @@ Using the :obj:`pico_led` is equivalent to::
4848

4949
You can use :obj:`pico_led` in the same way as external LEDs created using :class:`LED`.
5050

51+
Pin out
52+
-------
53+
54+
You can output a *diagram* of the Raspberry Pi Pico which displays its pins and their numbers.
55+
56+
.. literalinclude:: examples/print_pinout.py
57+
58+
::
59+
60+
---usb---
61+
GP0 1 |o o| -1 VBUS
62+
GP1 2 |o o| -2 VSYS
63+
GND 3 |o o| -3 GND
64+
GP2 4 |o o| -4 3V3_EN
65+
GP3 5 |o o| -5 3V3(OUT)
66+
GP4 6 |o o| -6 ADC_VREF
67+
GP5 7 |o o| -7 GP28 ADC2
68+
GND 8 |o o| -8 GND AGND
69+
GP6 9 |o o| -9 GP27 ADC1
70+
GP7 10 |o o| -10 GP26 ADC0
71+
GP8 11 |o o| -11 RUN
72+
GP9 12 |o o| -12 GP22
73+
GND 13 |o o| -13 GND
74+
GP10 14 |o o| -14 GP21
75+
GP11 15 |o o| -15 GP20
76+
GP12 16 |o o| -16 GP19
77+
GP13 17 |o o| -17 GP18
78+
GND 18 |o o| -18 GND
79+
GP14 19 |o o| -19 GP17
80+
GP15 20 |o o| -20 GP16
81+
---------
82+
5183
LEDs
5284
------
5385

picozero/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
PWMChannelAlreadyInUse,
88
EventFailedScheduleQueueFull,
99

10+
pinout,
11+
1012
DigitalOutputDevice,
1113
DigitalLED,
1214
Buzzer,

picozero/picozero.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,30 @@ class EventFailedScheduleQueueFull(Exception):
1818

1919
def clamp(n, low, high): return max(low, min(n, high))
2020

21+
def pinout():
22+
print(""" ---usb---
23+
GP0 1 |o o| -1 VBUS
24+
GP1 2 |o o| -2 VSYS
25+
GND 3 |o o| -3 GND
26+
GP2 4 |o o| -4 3V3_EN
27+
GP3 5 |o o| -5 3V3(OUT)
28+
GP4 6 |o o| -6 ADC_VREF
29+
GP5 7 |o o| -7 GP28 ADC2
30+
GND 8 |o o| -8 GND AGND
31+
GP6 9 |o o| -9 GP27 ADC1
32+
GP7 10 |o o| -10 GP26 ADC0
33+
GP8 11 |o o| -11 RUN
34+
GP9 12 |o o| -12 GP22
35+
GND 13 |o o| -13 GND
36+
GP10 14 |o o| -14 GP21
37+
GP11 15 |o o| -15 GP20
38+
GP12 16 |o o| -16 GP19
39+
GP13 17 |o o| -17 GP18
40+
GND 18 |o o| -18 GND
41+
GP14 19 |o o| -19 GP17
42+
GP15 20 |o o| -20 GP16
43+
---------""")
44+
2145
class PinMixin:
2246
"""
2347
Mixin used by devices that have a single pin number.
@@ -1630,7 +1654,7 @@ def when_deactivated(self):
16301654
"""
16311655
return self._when_deactivated
16321656

1633-
@when_activated.setter
1657+
@when_deactivated.setter
16341658
def when_deactivated(self, value):
16351659
self._when_deactivated = value
16361660

0 commit comments

Comments
 (0)