Skip to content

Commit

Permalink
docs: vmc pinout diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Apr 19, 2024
1 parent 04b6708 commit 0b57c8f
Show file tree
Hide file tree
Showing 11 changed files with 428 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ trim_trailing_whitespace = false
[*.py]
max_line_length = 88

[*.svg]
max_line_length = 120

[Makefile]
indent_style = tab
7 changes: 7 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ Specifications

bom/parts

.. toctree::
:caption: Reference
:maxdepth: 1
:hidden:

reference/vmc-header

.. toctree::
:caption: End matter
:maxdepth: 1
Expand Down
10 changes: 10 additions & 0 deletions docs/reference/vmc-header.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
==================================
Vehicle management computer pinout
==================================

GPIO configuration
------------------

.. osr:pinout-diagram:: vmc_header
Raspberry Pi header interface configuration and peripheral connection.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
description = "Quarter-scale Mars rover based on the NASA Mars 2020 Mission Perseverance Rover"
packages = [
{include = "osr_common", from = "src"},
{include = "osr_elec", from = "src"},
{include = "osr_mechanical", from = "src"},
{include = "osr_sphinx", from = "src"},
{include = "osr_warehouse", from = "src"},
Expand Down Expand Up @@ -108,7 +109,7 @@ ignore_errors = true
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pinout.manager"
module = "pinout.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
Expand Down
1 change: 1 addition & 0 deletions src/osr_elec/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""OSR electrical design."""
1 change: 1 addition & 0 deletions src/osr_elec/pinout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""OSR pinout diagrams."""
1 change: 1 addition & 0 deletions src/osr_elec/pinout/vmc_header/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Vehicle Management Computer GPIO header pinout diagram."""
185 changes: 185 additions & 0 deletions src/osr_elec/pinout/vmc_header/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
"""Data for Vehicle Management Computer GPIO header pinout diagram."""

legend = [
("Pin №", "pin"),
("Power 5V", "pwr5v"),
("Power 3V3", "pwr3v3"),
("Ground", "gnd"),
("Interface", "interface"),
("Peripheral", "peri"),
("No connection", "nc"),
]

pin_body = {"body": {"width": 40}}
peripheral_body = {"body": {"width": 100}}

odd_pins = [
[
("1", "pin", pin_body),
("3V3", "pwr3v3"),
],
[
("3", "pin", pin_body),
("NC", "nc"),
],
[
("5", "pin", pin_body),
("NC", "nc"),
],
[
("7", "pin", pin_body),
("GPIO4 DO", "interface"),
("RSL", "peri", peripheral_body),
],
[
("9", "pin", pin_body),
("GND", "gnd"),
],
[
("11", "pin", pin_body),
("NC", "nc"),
],
[
("13", "pin", pin_body),
("NC", "nc"),
],
[
("15", "pin", pin_body),
("NC", "nc"),
],
[
("17", "pin", pin_body),
("3V3", "pwr3v3"),
],
[
("19", "pin", pin_body),
("NC", "nc"),
],
[
("21", "pin", pin_body),
("NC", "nc"),
],
[
("23", "pin", pin_body),
("NC", "nc"),
],
[
("25", "pin", pin_body),
("GND", "gnd"),
],
[
("27", "pin", pin_body),
("I2C ID_SD", "interface"),
("ID EEPROM", "peri", peripheral_body),
],
[
("29", "pin", pin_body),
("NC", "nc"),
],
[
("31", "pin", pin_body),
("NC", "nc"),
],
[
("33", "pin", pin_body),
("NC", "nc"),
],
[
("35", "pin", pin_body),
("NC", "nc"),
],
[
("37", "pin", pin_body),
("NC", "nc"),
],
[
("39", "pin", pin_body),
("GND", "gnd"),
],
]

even_pins = [
[
("2", "pin", pin_body),
("5V", "pwr5v"),
],
[
("4", "pin", pin_body),
("5V", "pwr5v"),
],
[
("6", "pin", pin_body),
("GND", "gnd"),
],
[
("8", "pin", pin_body),
("UART TXD", "interface"),
("UART", "peri", peripheral_body),
],
[
("10", "pin", pin_body),
("UART RXD", "interface"),
("UART", "peri", peripheral_body),
],
[
("12", "pin", pin_body),
("NC", "nc"),
],
[
("14", "pin", pin_body),
("GND", "gnd"),
],
[
("16", "pin", pin_body),
("NC", "nc"),
],
[
("18", "pin", pin_body),
("NC", "nc"),
],
[
("20", "pin", pin_body),
("GND", "gnd"),
],
[
("22", "pin", pin_body),
("NC", "nc"),
],
[
("24", "pin", pin_body),
("NC", "nc"),
],
[
("26", "pin", pin_body),
("NC", "nc"),
],
[
("28", "pin", pin_body),
("I2C ID_SC", "interface"),
("ID EEPROM", "peri", peripheral_body),
],
[
("30", "pin", pin_body),
("GND", "gnd"),
],
[
("32", "pin", pin_body),
("NC", "nc"),
],
[
("34", "pin", pin_body),
("GND", "gnd"),
],
[
("36", "pin", pin_body),
("NC", "nc"),
],
[
("38", "pin", pin_body),
("NC", "nc"),
],
[
("40", "pin", pin_body),
("NC", "nc"),
],
]
54 changes: 54 additions & 0 deletions src/osr_elec/pinout/vmc_header/diagram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Vehicle Management Computer GPIO header pinout diagram."""

from pinout.components.layout import Diagram_2Rows
from pinout.components.legend import Legend
from pinout.components.pinlabel import PinLabelGroup
from pinout.core import Group, Image

# this is a collection of definition files rather than a Python module
import data # type: ignore[import-not-found] # isort: skip

diagram = Diagram_2Rows(685, 730, 650, "diagram")
diagram.add_stylesheet("styles.css", embed=True)

graphic = diagram.panel_01.add(Group(310, 30))

hardware = graphic.add(Image("pin-header-2x20-p2.54mm-vertical.svg", embed=True))
hardware.add_coord("pin_1", 60, 15)
hardware.add_coord("pin_2", 0, 15)
hardware.add_coord("pin_pitch_v", 0, 30)
hardware.add_coord("pin_pitch_h", 30, 0)

# labels for even pins
graphic.add(
PinLabelGroup(
x=hardware.coord("pin_1").x,
y=hardware.coord("pin_1").y,
pin_pitch=hardware.coord("pin_pitch_v", raw=True),
label_start=(60, 0),
label_pitch=(0, 30),
labels=data.even_pins,
)
)

# labels for odd pins
graphic.add(
PinLabelGroup(
x=hardware.coord("pin_2").x,
y=hardware.coord("pin_2").y,
pin_pitch=hardware.coord("pin_pitch_v", raw=True),
label_start=(60, 0),
label_pitch=(0, 30),
scale=(-1, 1),
labels=data.odd_pins,
)
)

legend = diagram.panel_02.add(
Legend(
data.legend,
x=8,
y=8,
max_height=80,
)
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0b57c8f

Please sign in to comment.