]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
support the lubancat stm32mp157 board.
authorjc <798025823@qq.com>
Sat, 17 Apr 2021 01:19:35 +0000 (09:19 +0800)
committerjc <798025823@qq.com>
Sat, 17 Apr 2021 01:31:17 +0000 (09:31 +0800)
1\add 'if' block in board.py and analogio.py
2\add board pin description in lubancat_stm32mp157.py
3\add some special pin in stm32mp157/pin.py to support analogio and i2c functions

src/adafruit_blinka/board/lubancat/lubancat_stm32mp157.py [new file with mode: 0644]
src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py
src/analogio.py
src/board.py

diff --git a/src/adafruit_blinka/board/lubancat/lubancat_stm32mp157.py b/src/adafruit_blinka/board/lubancat/lubancat_stm32mp157.py
new file mode 100644 (file)
index 0000000..33dfdcd
--- /dev/null
@@ -0,0 +1,49 @@
+"""Pin definitions for the LubanCat STM32MP157."""
+
+from adafruit_blinka.microcontroller.stm32.stm32mp157 import pin
+
+# Pro board pin header J1 named GPIO_PAx, pin header J2 named GPIO_PBx
+
+# Board pin name [= alias] = RPI name [= alias] = pin name
+
+# connector J1
+GPIO_PA3 = USART1_CTS = PZ3 = pin.PZ3
+GPIO_PA4 = USART1_RTS = PZ5 = pin.PZ5
+GPIO_PA5 = USART1_TX = PZ7 = pin.PZ7
+GPIO_PA6 = USART1_RX = PZ6 = pin.PZ6
+GPIO_PA7 = USART3_TX = PB10 = pin.PB10
+GPIO_PA8 = USART3_RX = PB12 = pin.PB12
+GPIO_PA11 = FDCAN1_TX = PA12 = pin.PA12
+GPIO_PA12 = FDCAN1_RX = PA11 = pin.PA11
+# connector J2
+GPIO_PB7 = UART4_TX = PG11 = pin.PG11
+GPIO_PB8 = UART4_RX = PB2 = pin.PB2
+GPIO_PB11 = QSPI_IO0 = PF8 = pin.PF8
+GPIO_PB12 = QSPI_IO1 = PF9 = pin.PF9
+GPIO_PB13 = QSPI_IO2 = PF7 = pin.PF7
+GPIO_PB14 = QSPI_IO3 = PF6 = pin.PF6
+GPIO_PB15 = QSPI_CLK = PF10 = pin.PF10
+GPIO_PB16 = QSPI_NCS = PB6 = pin.PB6
+
+# general gpio as LED、KEY function
+# LED
+LED_RED = PA13 = pin.PA13
+LED_GREEN = PB5 = pin.PG2
+LED_BLUE = PB5 = pin.PB5
+# KEY
+KEY1 = PB13 = pin.PB13
+KEY2 = PH7 = pin.PH7
+# BEEP
+BEEP = PC13 = pin.PC13
+
+# general gpio as I2C function
+# I2C1
+GPIO_PA13 = I2C1_SCL = SCL1 = SCL = pin.PF14
+GPIO_PA14 = I2C1_SDA = SDA1 = SDA = pin.PF15
+# I2C2
+GPIO_PA15 = I2C2_SCL = SCL2 = pin.PZ0
+GPIO_PA16 = I2C2_SDA = SDA2 = pin.PZ1
+
+# general gpio as analog input function
+GPIO_PB3 = ADC_IN0 = ANA0 = A0 = pin.PAN0
+GPIO_PB4 = ADC_IN1 = ANA1 = A1 = pin.PAN1
index 019698249790627ad7e4fec5441280ab6b66ac0e..e0a540b023f93f8838177ae014bcb9f84355b6da 100755 (executable)
@@ -152,3 +152,17 @@ I2C_PORTS = (
     (1, PD12, PF15),
     (5, PA11, PA12),
 )
+
+# support busio port check
+# 0 - linux system -> i2c-0
+# 1 - linux system -> i2c-1
+i2cPorts = (
+    (0, PF14, PF15),
+    (1, PZ0, PZ1),
+)
+
+# SysFS analog inputs, Ordered as analog analogInId, device, and channel
+# Because stm32mp157 analog io used special port name, it doesn't like gpiod named form, so support analog io in this way
+PAN0 = 0
+PAN1 = 0
+analogIns = ((PAN0, 0, 0),)
index 1db939a3fd93465d4f88cb75bf5ae1c4bc190ef2..7c393c3709526b1bca67c0a7e050e7fcd37c817a 100644 (file)
@@ -25,6 +25,8 @@ elif detector.chip.RK3399:
     from adafruit_blinka.microcontroller.generic_linux.sysfs_analogin import AnalogIn
 elif detector.chip.IMX6ULL:
     from adafruit_blinka.microcontroller.generic_linux.sysfs_analogin import AnalogIn
+elif detector.chip.STM32MP157:
+    from adafruit_blinka.microcontroller.generic_linux.sysfs_analogin import AnalogIn
 elif "sphinx" in sys.modules:
     pass
 else:
index d77722dd34c0b4d6142aa2dcd1a050316645b734..3303bb012d85bd392d774caaf98080999f9abb3c 100755 (executable)
@@ -206,6 +206,9 @@ elif board_id == ap_board.STM32MP157C_DK2:
 elif board_id == ap_board.LUBANCAT_IMX6ULL:
     from adafruit_blinka.board.lubancat.lubancat_imx6ull import *
 
+elif board_id == ap_board.LUBANCAT_STM32MP157:
+    from adafruit_blinka.board.lubancat.lubancat_stm32mp157 import *
+
 elif board_id == ap_board.NANOPI_NEO_AIR:
     from adafruit_blinka.board.nanopi.neoair import *