1 """Tegra T186 pin names"""
4 import Jetson.GPIO as GPIO
6 GPIO.setmode(GPIO.TEGRA_SOC)
7 GPIO.setwarnings(False) # shh!
11 """Pins dont exist in CPython so...lets make our own!"""
25 def __init__(self, bcm_number):
31 def __eq__(self, other):
32 return self.id == other
34 def init(self, mode=IN, pull=None):
35 """Initialize the Pin"""
39 GPIO.setup(self.id, GPIO.IN)
40 elif mode == self.OUT:
42 GPIO.setup(self.id, GPIO.OUT)
44 raise RuntimeError("Invalid mode for pin: %s" % self.id)
46 if self._mode != self.IN:
47 raise RuntimeError("Cannot set pull resistor on output")
48 if pull == self.PULL_UP:
49 GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_UP)
50 elif pull == self.PULL_DOWN:
51 GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
53 raise RuntimeError("Invalid pull for pin: %s" % self.id)
55 def value(self, val=None):
56 """Set or return the Pin Value"""
60 GPIO.output(self.id, val)
64 GPIO.output(self.id, val)
66 raise RuntimeError("Invalid value for pin")
67 return GPIO.input(self.id)
69 # pylint: disable=no-method-argument
73 print("Exiting... \nCleaning up pins")
76 # pylint: enable=no-method-argument
79 # Cannot be used as GPIO
80 SDA = Pin("GPIO_SEN9")
81 SCL = Pin("GPIO_SEN8")
82 SDA_1 = Pin("GEN1_I2C_SDA")
83 SCL_1 = Pin("GEN1_I2C_SCL")
86 J06 = Pin("GPIO_AUD1")
87 AA02 = Pin("CAN_GPIO2")
88 N06 = Pin("GPIO_CAM7")
89 N04 = Pin("GPIO_CAM5")
90 N05 = Pin("GPIO_CAM6")
91 N03 = Pin("GPIO_CAM4")
92 AA01 = Pin("CAN_GPIO1")
94 T03 = Pin("UART1_CTS")
95 T02 = Pin("UART1_RTS")
96 J00 = Pin("DAP1_SCLK")
99 J01 = Pin("DAP1_DOUT")
100 P17 = Pin("GPIO_EXP_P17")
101 AA00 = Pin("CAN0_GPIO0")
102 Y01 = Pin("GPIO_MDM2")
103 P16 = Pin("GPIO_EXP_P16")
104 I04 = Pin("GPIO_PQ4")
105 J05 = Pin("GPIO_AUD0")
112 # ordered as spiId, sckId, mosiId, misoId
113 spiPorts = ((3, N03, N05, N04),)