]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/adafruit_blinka/microcontroller/rockchip/rk3399_t/pin.py
Radxa Rock Pi 4 C Plus compatibility, fixes to wrong mapping in Rock Pi 4: see https...
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / rockchip / rk3399_t / pin.py
diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3399_t/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3399_t/pin.py
new file mode 100644 (file)
index 0000000..f0cadcd
--- /dev/null
@@ -0,0 +1,81 @@
+# SPDX-FileCopyrightText: 2023 Wouter Groeneveld
+# See https://wiki.radxa.com/Rock4/hardware/gpio (click EXPAND for the Pi 4C, chip RK3399_T)
+#
+# SPDX-License-Identifier: MIT
+"""A Pin class for use with Rockchip RK3399_T."""
+
+from adafruit_blinka.microcontroller.generic_linux.sysfs_pin import Pin
+
+GPIO1_A1 = Pin(33)
+GPIO1_A4 = Pin(36)
+GPIO1_A7 = Pin(39)
+GPIO1_B0 = Pin(40)
+GPIO1_B1 = Pin(41)
+GPIO1_B2 = Pin(42)
+GPIO1_C4 = Pin(52)
+GPIO2_A0 = Pin(64)
+GPIO2_A1 = Pin(65)
+GPIO2_A7 = Pin(71)
+GPIO2_B0 = Pin(72)
+GPIO2_B1 = Pin(73)
+GPIO2_B2 = Pin(74)
+GPIO2_B3 = Pin(75)
+GPIO2_B4 = Pin(76)
+GPIO2_D3 = Pin(91)
+GPIO2_D4 = Pin(92)
+GPIO3_C0 = Pin(112)
+GPIO4_A5 = Pin(133)
+GPIO4_C2 = Pin(146)
+GPIO4_C3 = Pin(147)
+GPIO4_C4 = Pin(148)
+GPIO4_C5 = Pin(149)
+GPIO4_C6 = Pin(150)
+GPIO4_D2 = Pin(154)
+GPIO4_D4 = Pin(156)
+GPIO4_D5 = Pin(157)
+GPIO4_D6 = Pin(158)
+ADC_IN0 = 1
+
+# I2C
+I2C2_SDA = GPIO2_A0
+I2C2_SCL = GPIO2_A1
+I2C6_SDA = GPIO2_B1
+I2C6_SCL = GPIO2_B2
+I2C7_SDA = GPIO2_A7
+I2C7_SCL = GPIO2_B0
+
+# SPI
+SPI1_CS = GPIO1_B2
+SPI1_SCLK = GPIO1_B1
+SPI1_MISO = GPIO1_B0
+SPI1_MOSI = GPIO1_A7
+SPI2_CS = GPIO2_B4
+SPI2_SCLK = GPIO2_B3
+SPI2_MISO = GPIO2_B1
+SPI2_MOSI = GPIO2_B2
+
+# UART
+UART0_TX = GPIO4_C4
+UART0_RX = GPIO4_C3
+
+# PWM
+PWM0 = GPIO4_C2
+
+# ordered as i2cId, SCL, SDA
+i2cPorts = (
+    (0, I2C2_SCL, I2C2_SDA),
+    (1, I2C6_SCL, I2C6_SDA),
+    (7, I2C7_SCL, I2C7_SDA),
+)
+
+# ordered as spiId, sckId, mosiId, misoId
+spiPorts = ((1, SPI1_SCLK, SPI1_MOSI, SPI1_MISO),)
+
+# SysFS pwm outputs, pwm channel and pin in first tuple
+pwmOuts = (
+    ((0, 0), PWM0),
+    ((1, 0), PWM1),
+)
+
+# SysFS analog inputs, Ordered as analog analogInId, device, and channel
+analogIns = ((ADC_IN0, 0, 0),)