From: jc <798025823@qq.com> Date: Sat, 17 Apr 2021 01:19:35 +0000 (+0800) Subject: support the lubancat stm32mp157 board. X-Git-Tag: 6.5.0^2~1 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/9a10db06d304126b95f9ca7a706fe202eeb5a1d2 support the lubancat stm32mp157 board. 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 --- diff --git a/src/adafruit_blinka/board/lubancat/lubancat_stm32mp157.py b/src/adafruit_blinka/board/lubancat/lubancat_stm32mp157.py new file mode 100644 index 0000000..33dfdcd --- /dev/null +++ b/src/adafruit_blinka/board/lubancat/lubancat_stm32mp157.py @@ -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 diff --git a/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py b/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py index 0196982..e0a540b 100755 --- a/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py +++ b/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py @@ -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),) diff --git a/src/analogio.py b/src/analogio.py index 1db939a..7c393c3 100644 --- a/src/analogio.py +++ b/src/analogio.py @@ -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: diff --git a/src/board.py b/src/board.py index d77722d..3303bb0 100755 --- a/src/board.py +++ b/src/board.py @@ -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 *