# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""STM32MP157 pins"""
from adafruit_blinka.microcontroller.generic_linux.periphery_pin import Pin

PA0 = Pin((0, 0))
PA1 = Pin((0, 1))
PA2 = Pin((0, 2))
PA3 = Pin((0, 3))
PA4 = Pin((0, 4))
PA5 = Pin((0, 5))
PA6 = Pin((0, 6))
PA7 = Pin((0, 7))
PA8 = Pin((0, 8))
PA9 = Pin((0, 9))
PA11 = Pin((0, 11))
PA12 = Pin((0, 12))
PA13 = Pin((0, 13))
PA14 = Pin((0, 14))
PA15 = Pin((0, 15))
PB0 = Pin((1, 0))
PB1 = Pin((1, 1))
PB2 = Pin((1, 2))
PB3 = Pin((1, 3))
PB4 = Pin((1, 4))
PB5 = Pin((1, 5))
PB6 = Pin((1, 6))
PB7 = Pin((1, 7))
PB8 = Pin((1, 8))
PB9 = Pin((1, 9))
PB10 = Pin((1, 10))
PB11 = Pin((1, 11))
PB12 = Pin((1, 12))
PB13 = Pin((1, 13))
PB14 = Pin((1, 14))
PB15 = Pin((1, 15))
PC0 = Pin((2, 0))
PC1 = Pin((2, 1))
PC2 = Pin((2, 2))
PC3 = Pin((2, 3))
PC4 = Pin((2, 4))
PC5 = Pin((2, 5))
PC6 = Pin((2, 6))
PC7 = Pin((2, 7))
PC8 = Pin((2, 8))
PC9 = Pin((2, 9))
PC10 = Pin((2, 10))
PC11 = Pin((2, 11))
PC12 = Pin((2, 12))
PC13 = Pin((2, 13))
PD0 = Pin((3, 0))
PD1 = Pin((3, 1))
PD2 = Pin((3, 2))
PD3 = Pin((3, 3))
PD4 = Pin((3, 4))
PD5 = Pin((3, 5))
PD6 = Pin((3, 6))
PD7 = Pin((3, 7))
PD8 = Pin((3, 8))
PD9 = Pin((3, 9))
PD10 = Pin((3, 10))
PD11 = Pin((3, 11))
PD12 = Pin((3, 12))
PD13 = Pin((3, 13))
PD14 = Pin((3, 14))
PD15 = Pin((3, 15))
PE0 = Pin((4, 0))
PE1 = Pin((4, 1))
PE2 = Pin((4, 2))
PE3 = Pin((4, 3))
PE4 = Pin((4, 4))
PE5 = Pin((4, 5))
PE6 = Pin((4, 6))
PE7 = Pin((4, 7))
PE8 = Pin((4, 8))
PE9 = Pin((4, 9))
PE10 = Pin((4, 10))
PE11 = Pin((4, 11))
PE12 = Pin((4, 12))
PE13 = Pin((4, 13))
PE14 = Pin((4, 14))
PE15 = Pin((4, 15))
PF0 = Pin((5, 0))
PF1 = Pin((5, 1))
PF2 = Pin((5, 2))
PF3 = Pin((5, 3))
PF4 = Pin((5, 4))
PF5 = Pin((5, 5))
PF6 = Pin((5, 6))
PF7 = Pin((5, 7))
PF8 = Pin((5, 8))
PF9 = Pin((5, 9))
PF10 = Pin((5, 10))
PF11 = Pin((5, 11))
PF12 = Pin((5, 12))
PF13 = Pin((5, 13))
PF14 = Pin((5, 14))
PF15 = Pin((5, 15))
PG0 = Pin((6, 0))
PG1 = Pin((6, 1))
PG2 = Pin((6, 2))
PG3 = Pin((6, 3))
PG4 = Pin((6, 4))
PG5 = Pin((6, 5))
PG6 = Pin((6, 6))
PG7 = Pin((6, 7))
PG8 = Pin((6, 8))
PG9 = Pin((6, 9))
PG10 = Pin((6, 10))
PG11 = Pin((6, 11))
PG12 = Pin((6, 12))
PG13 = Pin((6, 13))
PG14 = Pin((6, 14))
PG15 = Pin((6, 15))
PH2 = Pin((7, 2))
PH3 = Pin((7, 3))
PH4 = Pin((7, 4))
PH5 = Pin((7, 5))
PH6 = Pin((7, 6))
PH7 = Pin((7, 7))
PH8 = Pin((7, 8))
PH9 = Pin((7, 9))
PH10 = Pin((7, 10))
PH11 = Pin((7, 11))
PH12 = Pin((7, 12))
PH13 = Pin((7, 13))
PH14 = Pin((7, 14))
PH15 = Pin((7, 15))
PI0 = Pin((8, 0))
PI1 = Pin((8, 1))
PI2 = Pin((8, 2))
PI3 = Pin((8, 3))
PI4 = Pin((8, 4))
PI5 = Pin((8, 5))
PI6 = Pin((8, 6))
PI7 = Pin((8, 7))
PI8 = Pin((8, 8))
PI9 = Pin((8, 9))
PI10 = Pin((8, 10))
PI11 = Pin((8, 11))
PZ0 = Pin((9, 0))
PZ1 = Pin((9, 1))
PZ2 = Pin((9, 2))
PZ3 = Pin((9, 3))
PZ4 = Pin((9, 4))
PZ5 = Pin((9, 5))
PZ6 = Pin((9, 6))
PZ7 = Pin((9, 7))

# ordered as uartId, txId, rxId
UART_PORTS = ((3, PB10, PB12),)

# ordered as i2cId, sclId, sdaId
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),)
