Skip to content

Commit

Permalink
RPi Pins: Add some interfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Sep 25, 2023
1 parent 1260e5a commit d12f746
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions rpipins/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@
__version__ = '1.0.0'

PINOUT = [line.split("|") for line in """
| | |┏━━━┓| | |
|3v3 |1 |┃▣ β—Žβ”ƒ|2 |5v |
|GPIO 2 |3 |β”ƒβ—Ž β—Žβ”ƒ|4 |5v |
|GPIO 3 |5 |β”ƒβ—Ž β—Žβ”ƒ|6 |Ground |
|GPIO 4 |7 |β”ƒβ—Ž β—Žβ”ƒ|8 |GPIO 14|
|Ground |9 |β”ƒβ—Ž β—Žβ”ƒ|9 |GPIO 15|
|GPIO 17|11|β”ƒβ—Ž β—Žβ”ƒ|12|GPIO 18|
|GPIO 27|13|β”ƒβ—Ž β—Žβ”ƒ|14|Ground |
|GPIO 22|15|β”ƒβ—Ž β—Žβ”ƒ|16|GPIO 23|
|3v3 |17|β”ƒβ—Ž β—Žβ”ƒ|18|GPIO 24|
|GPIO 10|19|β”ƒβ—Ž β—Žβ”ƒ|20|Ground |
|GPIO 9 |21|β”ƒβ—Ž β—Žβ”ƒ|22|GPIO 25|
|GPIO 11|23|β”ƒβ—Ž β—Žβ”ƒ|24|GPIO 8 |
|Ground |25|β”ƒβ—Ž β—Žβ”ƒ|26|GPIO 7 |
|GPIO 0 |27|β”ƒβ—Ž β—Žβ”ƒ|28|GPIO 1 |
|GPIO 5 |29|β”ƒβ—Ž β—Žβ”ƒ|30|Ground |
|GPIO 6 |31|β”ƒβ—Ž β—Žβ”ƒ|32|GPIO 12|
|GPIO 13|33|β”ƒβ—Ž β—Žβ”ƒ|34|Ground |
|GPIO 19|35|β”ƒβ—Ž β—Žβ”ƒ|36|GPIO 16|
|GPIO 26|37|β”ƒβ—Ž β—Žβ”ƒ|38|GPIO 20|
|Ground |39|β”ƒβ—Ž β—Žβ”ƒ|40|GPIO 21|
| | |┗━━━┛| | |
| | | |┏━━━┓| | | |
| |3v3 |1 |┃▣ β—Žβ”ƒ|2 |5v | |
|I2C1 SDA |GPIO 2 |3 |β”ƒβ—Ž β—Žβ”ƒ|4 |5v | |
|I2C1 SCL |GPIO 3 |5 |β”ƒβ—Ž β—Žβ”ƒ|6 |Ground | |
| |GPIO 4 |7 |β”ƒβ—Ž β—Žβ”ƒ|8 |GPIO 14| |
| |Ground |9 |β”ƒβ—Ž β—Žβ”ƒ|9 |GPIO 15| |
SPI1 CE1 | |GPIO 17|11|β”ƒβ—Ž β—Žβ”ƒ|12|GPIO 18| |SPI1 CE0
| |GPIO 27|13|β”ƒβ—Ž β—Žβ”ƒ|14|Ground | |
| |GPIO 22|15|β”ƒβ—Ž β—Žβ”ƒ|16|GPIO 23| |
| |3v3 |17|β”ƒβ—Ž β—Žβ”ƒ|18|GPIO 24| |
SPI0 MISO| |GPIO 10|19|β”ƒβ—Ž β—Žβ”ƒ|20|Ground | |
SPI0 MOSI| |GPIO 9 |21|β”ƒβ—Ž β—Žβ”ƒ|22|GPIO 25| |
SPI0 SCLK| |GPIO 11|23|β”ƒβ—Ž β—Žβ”ƒ|24|GPIO 8 | |SPI0 CE0
| |Ground |25|β”ƒβ—Ž β—Žβ”ƒ|26|GPIO 7 | |SPI0 CE1
|EEPROM SDA|GPIO 0 |27|β”ƒβ—Ž β—Žβ”ƒ|28|GPIO 1 |EEPROM SCL|
| |GPIO 5 |29|β”ƒβ—Ž β—Žβ”ƒ|30|Ground | |
| |GPIO 6 |31|β”ƒβ—Ž β—Žβ”ƒ|32|GPIO 12| |
| |GPIO 13|33|β”ƒβ—Ž β—Žβ”ƒ|34|Ground | |
SPI1 MISO| |GPIO 19|35|β”ƒβ—Ž β—Žβ”ƒ|36|GPIO 16| |SPI1 CE2
| |GPIO 26|37|β”ƒβ—Ž β—Žβ”ƒ|38|GPIO 20| |SPI1 MOSI
| |Ground |39|β”ƒβ—Ž β—Žβ”ƒ|40|GPIO 21| |SPI1 SCLK
| | | |┗━━━┛| | | |
""".splitlines()[1:]]

NUM_COLS = len(PINOUT[0])
Expand All @@ -57,15 +57,14 @@
RIGHT_PINS = [[col.strip() for col in row[RIGHT_COLS_START:]] for row in PINOUT]
DIAGRAM = [row[LEFT_COLS_END] for row in PINOUT]

COLS = ["pins", "gpio"]
COLS = ["pins", "gpio", "i2c", "spi"]
DEBUG_COLS = ["consumer", "mode", "drive", "pull", "state"]
NUM_DEBUG_COLS = len(DEBUG_COLS)


# Add empty slots for the GPIO debug data
for n in range(len(LEFT_PINS)):
LEFT_PINS[n].pop()
LEFT_PINS[n] += [""] * NUM_DEBUG_COLS
RIGHT_PINS[n].pop()
RIGHT_PINS[n] += [""] * NUM_DEBUG_COLS


Expand Down Expand Up @@ -150,8 +149,8 @@ def usage(error=None):
eg: rpipins i2c - show GPIO and I2C labels
rpipins - basic GPIO pinout
rpipins --all --find "PWM3 A" - highlight any "PWM3 A" labels
rpipins --all --find "PWM.* A" - highlight any PWM A channels
rpipins --all --find "I2C1" - highlight any "I2C1" labels
rpipins --all --find "SPI* SCLK" - highlight any SPI clock pins
web: https://pinout.xyz
bugs: https://github.com/pinout-xyz/rpipins
Expand Down

0 comments on commit d12f746

Please sign in to comment.