From: twa127 <46624596+twa127@users.noreply.github.com> Date: Wed, 3 Mar 2021 11:10:17 +0000 (+0000) Subject: Merge pull request #5 from adafruit/master X-Git-Tag: 6.3.1^2~1 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/ce97c72c75bd10d7f38fe409fd0f2b72d80c5413?hp=15565f635510291b1df98719378cc85d4e375cfa Merge pull request #5 from adafruit/master Merge --- diff --git a/.pylintrc b/.pylintrc index 2c83b5a..35b40b5 100644 --- a/.pylintrc +++ b/.pylintrc @@ -18,8 +18,8 @@ ignore-patterns= #init-hook= # Use multiple processes to speed up Pylint. -# jobs=1 -jobs=2 +jobs=1 +# jobs=2 # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. @@ -249,7 +249,7 @@ ignore-docstrings=yes ignore-imports=no # Minimum lines number of a similarity. -min-similarity-lines=4 +min-similarity-lines=80 [BASIC] diff --git a/requirements.txt b/requirements.txt index b6336c5..59a7ee9 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Adafruit-PlatformDetect>=3.0.0 +Adafruit-PlatformDetect>=3.1.0 Adafruit-PureIO>=1.1.7 Jetson.GPIO; platform_machine=='aarch64' RPi.GPIO; platform_machine=='armv7l' or platform_machine=='armv6l' diff --git a/setup.py b/setup.py index a3ebaca..7e92596 100755 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ if os.path.exists("/proc/device-tree/compatible"): or b"brcm,bcm2836" in compat or b"brcm,bcm2837" in compat or b"brcm,bcm2838" in compat + or b"brcm,bcm2711" in compat ): board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0", "sysv_ipc>=1.1.0"] @@ -61,7 +62,7 @@ setup( "adafruit_blinka.microcontroller.bcm283x.pulseio": ["libgpiod_pulsein"] }, install_requires=[ - "Adafruit-PlatformDetect>=2.18.1", + "Adafruit-PlatformDetect>=3.1.0", "Adafruit-PureIO>=1.1.7", "pyftdi>=0.40.0", ] diff --git a/src/adafruit_blinka/board/nvidia/jetson_tx2_nx.py b/src/adafruit_blinka/board/nvidia/jetson_tx2_nx.py new file mode 100644 index 0000000..ff5c154 --- /dev/null +++ b/src/adafruit_blinka/board/nvidia/jetson_tx2_nx.py @@ -0,0 +1,38 @@ +"""Pin definitions for Jetson TX2 NX.""" + +from adafruit_blinka.microcontroller.tegra.t186 import pin + +SDA = pin.SDA +SCL = pin.SCL +SDA_1 = pin.SDA_1 +SCL_1 = pin.SCL_1 + +D4 = pin.J04 +D5 = pin.N01 +D6 = pin.EE02 +D7 = pin.Y03 +D8 = pin.H03 +D9 = pin.H01 +D10 = pin.H02 +D11 = pin.H00 +D12 = pin.U00 +D13 = pin.U05 +D16 = pin.W05 +D17 = pin.W04 +D18 = pin.J00 +D19 = pin.J03 +D20 = pin.J02 +D21 = pin.J01 +D22 = pin.C02 +D23 = pin.C03 +D24 = pin.V04 +D25 = pin.V02 +D26 = pin.V03 +D27 = pin.V01 + +CE1 = D7 +CE0 = D8 +MISO = D9 +MOSI = D10 +SCLK = D11 +SCK = D11 diff --git a/src/adafruit_blinka/microcontroller/ft232h/pin.py b/src/adafruit_blinka/microcontroller/ft232h/pin.py index 94b8e14..42ae5ab 100644 --- a/src/adafruit_blinka/microcontroller/ft232h/pin.py +++ b/src/adafruit_blinka/microcontroller/ft232h/pin.py @@ -8,6 +8,9 @@ class Pin: OUT = 1 LOW = 0 HIGH = 1 + PULL_NONE = 0 + PULL_UP = 1 + PULL_DOWN = 2 ft232h_gpio = None @@ -36,7 +39,7 @@ class Pin: raise RuntimeError("Can not init a None type pin.") # FT232H does't have configurable internal pulls? if pull: - raise ValueError("Internal pull up/down not currently supported.") + raise NotImplementedError("Internal pull up/down not currently supported.") pin_mask = Pin.ft232h_gpio.pins | 1 << self.id current = Pin.ft232h_gpio.direction if mode == self.OUT: diff --git a/src/adafruit_blinka/microcontroller/ft232h/spi.py b/src/adafruit_blinka/microcontroller/ft232h/spi.py index 81797b3..c768eaf 100644 --- a/src/adafruit_blinka/microcontroller/ft232h/spi.py +++ b/src/adafruit_blinka/microcontroller/ft232h/spi.py @@ -67,7 +67,8 @@ class SPI: def readinto(self, buf, start=0, end=None, write_value=0): """Read data from SPI and into the buffer""" end = end if end else len(buf) - result = self._port.read(end - start) + buffer_out = [write_value] * (end - start) + result = self._port.exchange(buffer_out, end - start, duplex=True) for i, b in enumerate(result): buf[start + i] = b diff --git a/src/adafruit_blinka/microcontroller/nxp_lpc4330/spi.py b/src/adafruit_blinka/microcontroller/nxp_lpc4330/spi.py index 17859a4..28b4fd2 100644 --- a/src/adafruit_blinka/microcontroller/nxp_lpc4330/spi.py +++ b/src/adafruit_blinka/microcontroller/nxp_lpc4330/spi.py @@ -93,7 +93,7 @@ class SPI: def readinto(self, buf, start=0, end=None, write_value=0): """Read data from SPI and into the buffer""" end = end if end else len(buf) - result = self._transmit([], end - start) + result = self._transmit([write_value] * (end - start), end - start) for i, b in enumerate(result): buf[start + i] = b diff --git a/src/adafruit_blinka/microcontroller/tegra/t186/pin.py b/src/adafruit_blinka/microcontroller/tegra/t186/pin.py index ba06449..f728a40 100644 --- a/src/adafruit_blinka/microcontroller/tegra/t186/pin.py +++ b/src/adafruit_blinka/microcontroller/tegra/t186/pin.py @@ -82,7 +82,7 @@ SCL = Pin("GPIO_SEN8") SDA_1 = Pin("GEN1_I2C_SDA") SCL_1 = Pin("GEN1_I2C_SCL") -J04 = Pin("AUD_MCLK") +# Jetson TX2 specific J06 = Pin("GPIO_AUD1") AA02 = Pin("CAN_GPIO2") N06 = Pin("GPIO_CAM7") @@ -93,10 +93,6 @@ AA01 = Pin("CAN_GPIO1") I05 = Pin("GPIO_PQ5") T03 = Pin("UART1_CTS") T02 = Pin("UART1_RTS") -J00 = Pin("DAP1_SCLK") -J03 = Pin("DAP1_FS") -J02 = Pin("DAP1_DIN") -J01 = Pin("DAP1_DOUT") P17 = Pin("GPIO_EXP_P17") AA00 = Pin("CAN0_GPIO0") Y01 = Pin("GPIO_MDM2") @@ -104,6 +100,32 @@ P16 = Pin("GPIO_EXP_P16") I04 = Pin("GPIO_PQ4") J05 = Pin("GPIO_AUD0") +# Jetson TX2 NX specific +W04 = Pin("UART3_RTS") +V01 = Pin("GPIO_SEN1") +C02 = Pin("DAP2_DOUT") +C03 = Pin("DAP2_DIN") +V04 = Pin("GPIO_SEN4") +H02 = Pin("GPIO_WAN7") +H01 = Pin("GPIO_WAN6") +V02 = Pin("GPIO_SEN2") +H00 = Pin("GPIO_WAN5") +H03 = Pin("GPIO_WAN8") +Y03 = Pin("GPIO_MDM4") +N01 = Pin("GPIO_CAM2") +EE02 = Pin("TOUCH_CLK") +U00 = Pin("GPIO_DIS0") +U05 = Pin("GPIO_DIS5") +W05 = Pin("UART3_CTS") +V03 = Pin("GPIO_SEN3") + +# Shared pin +J03 = Pin("DAP1_FS") +J02 = Pin("DAP1_DIN") +J01 = Pin("DAP1_DOUT") +J00 = Pin("DAP1_SCLK") +J04 = Pin("AUD_MCLK") + i2cPorts = ( (1, SCL, SDA), (0, SCL_1, SDA_1), diff --git a/src/board.py b/src/board.py index ceb99f4..cf2076a 100755 --- a/src/board.py +++ b/src/board.py @@ -122,6 +122,9 @@ elif board_id == ap_board.JETSON_TX1: elif board_id == ap_board.JETSON_TX2: from adafruit_blinka.board.nvidia.jetson_tx2 import * +elif board_id == ap_board.JETSON_TX2_NX: + from adafruit_blinka.board.nvidia.jetson_tx2_nx import * + elif board_id == ap_board.JETSON_XAVIER: from adafruit_blinka.board.nvidia.jetson_xavier import * diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index df91de4..4597e94 100755 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -13,7 +13,7 @@ class Pin(Enum): self._id = pin_id def __repr__(self): - # pylint: disable=import-outside-toplevel + # pylint: disable=import-outside-toplevel, cyclic-import import board for key in dir(board): @@ -21,7 +21,7 @@ class Pin(Enum): return "board.{}".format(key) import microcontroller.pin as pin - # pylint: enable=import-outside-toplevel + # pylint: enable=import-outside-toplevel, cyclic-import for key in dir(pin): if getattr(pin, key) is self: