]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
merge t210 chip defs into one
authorAndy <antan@nvidia.com>
Thu, 14 Mar 2019 18:02:52 +0000 (11:02 -0700)
committerAndy <antan@nvidia.com>
Thu, 14 Mar 2019 18:06:39 +0000 (11:06 -0700)
src/adafruit_blinka/board/jetson_tx1.py
src/adafruit_blinka/board/jetson_txx.py
src/adafruit_blinka/microcontroller/tegra/t210/pin.py [moved from src/adafruit_blinka/microcontroller/tegra/t210/x1_pin.py with 86% similarity]
src/adafruit_blinka/microcontroller/tegra/t210/xx_pin.py [deleted file]
src/digitalio.py
src/microcontroller/pin.py

index e5dd8c770712c28b3ca4c263cb11f74b4a9d9bc5..05fc3903092b7a41a9ab845af205f56dc1eef471 100644 (file)
@@ -1,6 +1,6 @@
 """Pin definitions for Jetson TX1."""
 
 """Pin definitions for Jetson TX1."""
 
-from adafruit_blinka.microcontroller.tegra.t210 import x1_pin as pin
+from adafruit_blinka.microcontroller.tegra.t210 import pin
 
 SDA = pin.SDA
 SCL = pin.SCL
 
 SDA = pin.SDA
 SCL = pin.SCL
index 3fc7aa334d605d9df9f33e750b1639c17821b838..18112014079e5f89c5cc565f178ff3b540cc4d2d 100644 (file)
@@ -1,11 +1,11 @@
 """Pin definitions for Jetson TXX."""
 
 """Pin definitions for Jetson TXX."""
 
-from adafruit_blinka.microcontroller.tegra.t210 import xx_pin as pin
+from adafruit_blinka.microcontroller.tegra.t210 import pin
 
 
-SDA = pin.SDA
-SCL = pin.SCL
-SDA_1 = pin.SDA_1
-SCL_1 = pin.SCL_1
+SDA = pin.SDA_1
+SCL = pin.SCL_1
+SDA_1 = pin.SDA
+SCL_1 = pin.SCL
 
 D4 = pin.BB00
 D5 = pin.S05
 
 D4 = pin.BB00
 D5 = pin.S05
similarity index 86%
rename from src/adafruit_blinka/microcontroller/tegra/t210/x1_pin.py
rename to src/adafruit_blinka/microcontroller/tegra/t210/pin.py
index d6c664653b2d0049d549d5a35edebd6e8ccbeb19..3b74b078bd3a875c8c56ffde029c19b8079e3f28 100644 (file)
@@ -73,14 +73,9 @@ SCL = Pin('GEN1_I2C_SCL')
 SDA_1 = Pin('GEN2_I2C_SDA')
 SCL_1 = Pin('GEN2_I2C_SCL')
 
 SDA_1 = Pin('GEN2_I2C_SDA')
 SCL_1 = Pin('GEN2_I2C_SCL')
 
-BB00 = Pin('AUD_MCLK')
+# These pins are native to TX1
 BB03 = Pin('GPIO_X1_AUD')
 X02 = Pin('MOTION_INT')
 BB03 = Pin('GPIO_X1_AUD')
 X02 = Pin('MOTION_INT')
-C04 = Pin('SPI1_CS1')
-C03 = Pin('SPI1_CS0')
-C01 = Pin('SPI1_MISO')
-C00 = Pin('SPI1_MOSI')
-C02 = Pin('SPI1_SCK')
 H07 = Pin('AP_WAKE_NFC')
 E04 = Pin('DMIC3_CLK')
 U03 = Pin('UART1_CTS')
 H07 = Pin('AP_WAKE_NFC')
 E04 = Pin('DMIC3_CLK')
 U03 = Pin('UART1_CTS')
@@ -94,6 +89,31 @@ E05 = Pin('DMIC3_DAT')
 X00 = Pin('MODEM_WAKE_AP')
 P16 = Pin('GPIO_EXP_P16')
 X03 = Pin('ALS_PROX_INT')
 X00 = Pin('MODEM_WAKE_AP')
 P16 = Pin('GPIO_EXP_P16')
 X03 = Pin('ALS_PROX_INT')
+
+# These pins are native to TXX
+S05 = Pin('CAM_AF_EN')
+Z00 = Pin('GPIO_PZ0')
+V00 = Pin('LCD_BL_PW')
+G03 = Pin('UART2_CTS')
+G02 = Pin('UART2_RTS')
+J07 = Pin('DAP4_SCLK')
+J04 = Pin('DAP4_FS')
+J05 = Pin('DAP4_DIN')
+J06 = Pin('DAP4_DOUT')
+Y02 = Pin('LCD_TE')
+DD00 = Pin('SPI2_CS1')
+B07 = Pin('SPI2_CS0')
+B05 = Pin('SPI2_MISO')
+B04 = Pin('SPI2_MOSI')
+B06 = Pin('SPI2_SCK')
+
+# These pins are shared across T210
+BB00 = Pin('AUD_MCLK')
+C04 = Pin('SPI1_CS1')
+C03 = Pin('SPI1_CS0')
+C01 = Pin('SPI1_MISO')
+C00 = Pin('SPI1_MOSI')
+C02 = Pin('SPI1_SCK')
 E06 = Pin('GPIO_PE6')
 
 i2cPorts = (
 E06 = Pin('GPIO_PE6')
 
 i2cPorts = (
diff --git a/src/adafruit_blinka/microcontroller/tegra/t210/xx_pin.py b/src/adafruit_blinka/microcontroller/tegra/t210/xx_pin.py
deleted file mode 100644 (file)
index 5261a50..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-import sys
-import atexit
-sys.path.append("/opt/nvidia/jetson-gpio/lib/python")
-sys.path.append("/opt/nvidia/jetson-gpio/lib/python/Jetson/GPIO")
-import Jetson.GPIO as GPIO
-GPIO.setmode(GPIO.TEGRA_SOC)
-GPIO.setwarnings(False)   # shh!
-
-# Pins dont exist in CPython so...lets make our own!
-class Pin:
-    IN = 0
-    OUT = 1
-    LOW = 0
-    HIGH = 1
-    PULL_NONE = 0
-    PULL_UP = 1
-    PULL_DOWN = 2
-
-    id = None
-    _value = LOW
-    _mode = IN
-
-    def __init__(self, bcm_number):
-        self.id = bcm_number
-
-    def __repr__(self):
-        return str(self.id)
-
-    def __eq__(self, other):
-        return self.id == other
-
-    def init(self, mode=IN, pull=None):
-        if mode != None:
-            if mode == self.IN:
-                self._mode = self.IN
-                GPIO.setup(self.id, GPIO.IN)
-            elif mode == self.OUT:
-                self._mode = self.OUT
-                GPIO.setup(self.id, GPIO.OUT)
-            else:
-                raise RuntimeError("Invalid mode for pin: %s" % self.id)
-        if pull != None:
-            if self._mode != self.IN:
-                raise RuntimeError("Cannot set pull resistor on output")
-            if pull == self.PULL_UP:
-                GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_UP)
-            elif pull == self.PULL_DOWN:
-                GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
-            else:
-                raise RuntimeError("Invalid pull for pin: %s" % self.id)
-
-    def value(self, val=None):
-        if val != None:
-            if val == self.LOW:
-                self._value = val
-                GPIO.output(self.id, val)
-            elif val == self.HIGH:
-                self._value = val
-                GPIO.output(self.id, val)
-            else:
-                raise RuntimeError("Invalid value for pin")
-        else:
-            return GPIO.input(self.id)
-
-    @atexit.register
-    def cleanup():
-        print("Exiting... \nCleaning up pins")
-        GPIO.cleanup()
-
-# Cannot be used as GPIO
-SDA = Pin('GEN2_I2C_SDA')
-SCL = Pin('GEN2_I2C_SCL')
-SDA_1 = Pin('GEN1_I2C_SDA')
-SCL_1 = Pin('GEN1_I2C_SCL')
-
-BB00 = Pin('AUD_MCLK')
-S05 = Pin('CAM_AF_EN')
-Z00 = Pin('GPIO_PZ0')
-C04 = Pin('SPI1_CS1')
-C03 = Pin('SPI1_CS0')
-C01 = Pin('SPI1_MISO')
-C00 = Pin('SPI1_MOSI')
-C02 = Pin('SPI1_SCK')
-V00 = Pin('LCD_BL_PW')
-E06 = Pin('GPIO_PE6')
-G03 = Pin('UART2_CTS')
-G02 = Pin('UART2_RTS')
-J07 = Pin('DAP4_SCLK')
-J04 = Pin('DAP4_FS')
-J05 = Pin('DAP4_DIN')
-J06 = Pin('DAP4_DOUT')
-Y02 = Pin('LCD_TE')
-DD00 = Pin('SPI2_CS1')
-B07 = Pin('SPI2_CS0')
-B05 = Pin('SPI2_MISO')
-B04 = Pin('SPI2_MOSI')
-B06 = Pin('SPI2_SCK')
-
-i2cPorts = (
-    (1, SCL, SDA), (0, SCL_1, SDA_1),
-)
index f129c47faf7d4d524aae818c0f7ded2806337074..29536925c85029b3a5267b7518171f2118708335 100755 (executable)
@@ -20,10 +20,7 @@ elif detector.chip.SUN8I:
 elif detector.chip.SAMA5:
     from adafruit_blinka.microcontroller.sama5.pin import Pin
 elif detector.chip.T210:
 elif detector.chip.SAMA5:
     from adafruit_blinka.microcontroller.sama5.pin import Pin
 elif detector.chip.T210:
-    if detector.board.JETSON_TX1:
-        from adafruit_blinka.microcontroller.tegra.t210.x1_pin import Pin
-    elif detector.board.JETSON_TXX:
-        from adafruit_blinka.microcontroller.tegra.t210.xx_pin import Pin
+    from adafruit_blinka.microcontroller.tegra.t210.pin import Pin
 elif detector.chip.T186:
     from adafruit_blinka.microcontroller.tegra.t186.pin import Pin
 elif detector.chip.T194:
 elif detector.chip.T186:
     from adafruit_blinka.microcontroller.tegra.t186.pin import Pin
 elif detector.chip.T194:
index 7aa57c166ce7001b5c1177f3379ccc79283e8f03..65e3a508d086fa25b49ae5b620aeaff0c998b3a8 100755 (executable)
@@ -1,7 +1,7 @@
 """Pins named after their chip name."""
 
 """Pins named after their chip name."""
 
-from adafruit_platformdetect import chip as ap_chip, board as ap_board
-from adafruit_blinka.agnostic import chip_id, board_id
+import adafruit_platformdetect.chip as ap_chip
+from adafruit_blinka.agnostic import chip_id
 
 # We intentionally are patching into this namespace so skip the wildcard check.
 # pylint: disable=unused-wildcard-import,wildcard-import,ungrouped-imports
 
 # We intentionally are patching into this namespace so skip the wildcard check.
 # pylint: disable=unused-wildcard-import,wildcard-import,ungrouped-imports
@@ -19,10 +19,7 @@ elif chip_id == ap_chip.SUN8I:
 elif chip_id == ap_chip.SAMA5:
     from adafruit_blinka.microcontroller.sama5.pin import *
 elif chip_id == ap_chip.T210:
 elif chip_id == ap_chip.SAMA5:
     from adafruit_blinka.microcontroller.sama5.pin import *
 elif chip_id == ap_chip.T210:
-    if board_id == ap_board.JETSON_TX1:
-        from adafruit_blinka.microcontroller.tegra.t210.x1_pin import *
-    elif board_id == ap_board.JETSON_TXX:
-        from adafruit_blinka.microcontroller.tegra.t210.xx_pin import *
+    from adafruit_blinka.microcontroller.tegra.t210.pin import *
 elif chip_id == ap_chip.T186:
     from adafruit_blinka.microcontroller.tegra.t186.pin import *
 elif chip_id == ap_chip.T194:
 elif chip_id == ap_chip.T186:
     from adafruit_blinka.microcontroller.tegra.t186.pin import *
 elif chip_id == ap_chip.T194: