Skip to content

Commit

Permalink
Merge pull request #830 from sc-bin/main
Browse files Browse the repository at this point in the history
add support for walnutpi-1b board
  • Loading branch information
makermelissa authored Jun 3, 2024
2 parents a21448d + 578fb1f commit 4e66cb7
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 71 deletions.
4 changes: 4 additions & 0 deletions src/adafruit_blinka/board/walnutpi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Board definitions from WalnutPi"""
52 changes: 52 additions & 0 deletions src/adafruit_blinka/board/walnutpi/walnutpi1b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Pin definitions for the Walnut Pi 1b ."""

from adafruit_blinka.microcontroller.allwinner.h616 import pin

PI8 = pin.PI8
SDA1 = pin.PI8
PI7 = pin.PI7
SCL1 = pin.PI7
PC8 = pin.PC8
PC9 = pin.PC9
PC11 = pin.PC11
PI11 = pin.PI11
PH6 = pin.PH6
SCLK = pin.PH6
PH7 = pin.PH7
MOSI = pin.PH7
PH8 = pin.PH8
MISO = pin.PH8
PI10 = pin.PI10
SDA2 = pin.PI10
PI0 = pin.PI0
PI1 = pin.PI1
PI2 = pin.PI2
PI3 = pin.PI3
PI4 = pin.PI4

PI5 = pin.PI5
TX2 = pin.PI5
PI6 = pin.PI6
RX2 = pin.PI6
PC10 = pin.PC10
PI12 = pin.PI12
PC14 = pin.PC14
PC15 = pin.PC15
PH5 = pin.PH5
CS0 = pin.PH5
PH9 = pin.PH9
CS1 = pin.PH9
PI9 = pin.PI9
SCL2 = pin.PI9
PI16 = pin.PI16
PI15 = pin.PI15
PI13 = pin.PI13
TX4 = pin.PI13
PI14 = pin.PI14
RX4 = pin.PI14

KEY = pin.PC12
LED = pin.PC13
149 changes: 78 additions & 71 deletions src/adafruit_blinka/microcontroller/allwinner/h616/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,96 +4,103 @@
"""Allwinner H616 Pin Names"""
from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin

PC0 = Pin((1, 64))
__chip_num = 1
with open("/sys/class/gpio/gpiochip0/label", "r") as f:
label = f.read().strip()
if label == "300b000.pinctrl":
__chip_num = 0


PC0 = Pin((__chip_num, 64))
SPI0_SCLK = PC0
PC1 = Pin((1, 65))
PC2 = Pin((1, 66))
PC1 = Pin((__chip_num, 65))
PC2 = Pin((__chip_num, 66))
SPI0_MOSI = PC2
PC3 = Pin((1, 67))
PC3 = Pin((__chip_num, 67))
SPI0_CS0 = PC3
PC4 = Pin((1, 68))
PC4 = Pin((__chip_num, 68))
SPI0_MISO = PC4
PC5 = Pin((1, 69))
PC6 = Pin((1, 70))
PC7 = Pin((1, 71))
PC8 = Pin((1, 72))
PC9 = Pin((1, 73))
PC10 = Pin((1, 74))
PC11 = Pin((1, 75))
PC12 = Pin((1, 76))
PC13 = Pin((1, 77))
PC14 = Pin((1, 78))
PC15 = Pin((1, 79))
PC5 = Pin((__chip_num, 69))
PC6 = Pin((__chip_num, 70))
PC7 = Pin((__chip_num, 71))
PC8 = Pin((__chip_num, 72))
PC9 = Pin((__chip_num, 73))
PC10 = Pin((__chip_num, 74))
PC11 = Pin((__chip_num, 75))
PC12 = Pin((__chip_num, 76))
PC13 = Pin((__chip_num, 77))
PC14 = Pin((__chip_num, 78))
PC15 = Pin((__chip_num, 79))

PF0 = Pin((1, 160))
PF1 = Pin((1, 161))
PF2 = Pin((1, 162))
PF3 = Pin((1, 163))
PF4 = Pin((1, 164))
PF5 = Pin((1, 165))
PF6 = Pin((1, 166))
PF0 = Pin((__chip_num, 160))
PF1 = Pin((__chip_num, 161))
PF2 = Pin((__chip_num, 162))
PF3 = Pin((__chip_num, 163))
PF4 = Pin((__chip_num, 164))
PF5 = Pin((__chip_num, 165))
PF6 = Pin((__chip_num, 166))

PG0 = Pin((1, 192))
PG1 = Pin((1, 193))
PG2 = Pin((1, 194))
PG3 = Pin((1, 195))
PG4 = Pin((1, 196))
PG5 = Pin((1, 197))
PG6 = Pin((1, 198))
PG7 = Pin((1, 199))
PG8 = Pin((1, 200))
PG9 = Pin((1, 201))
PG10 = Pin((1, 202))
PG11 = Pin((1, 203))
PG12 = Pin((1, 204))
PG13 = Pin((1, 205))
PG14 = Pin((1, 206))
PG15 = Pin((1, 207))
PG16 = Pin((1, 208))
PG17 = Pin((1, 209))
PG18 = Pin((1, 210))
PG19 = Pin((1, 211))
PG0 = Pin((__chip_num, 192))
PG1 = Pin((__chip_num, 193))
PG2 = Pin((__chip_num, 194))
PG3 = Pin((__chip_num, 195))
PG4 = Pin((__chip_num, 196))
PG5 = Pin((__chip_num, 197))
PG6 = Pin((__chip_num, 198))
PG7 = Pin((__chip_num, 199))
PG8 = Pin((__chip_num, 200))
PG9 = Pin((__chip_num, 201))
PG10 = Pin((__chip_num, 202))
PG11 = Pin((__chip_num, 203))
PG12 = Pin((__chip_num, 204))
PG13 = Pin((__chip_num, 205))
PG14 = Pin((__chip_num, 206))
PG15 = Pin((__chip_num, 207))
PG16 = Pin((__chip_num, 208))
PG17 = Pin((__chip_num, 209))
PG18 = Pin((__chip_num, 210))
PG19 = Pin((__chip_num, 211))

PH0 = Pin((1, 224))
PH1 = Pin((1, 225))
PH2 = Pin((1, 226))
PH0 = Pin((__chip_num, 224))
PH1 = Pin((__chip_num, 225))
PH2 = Pin((__chip_num, 226))
UART5_TX = PH2
PH3 = Pin((1, 227))
PH3 = Pin((__chip_num, 227))
UART5_RX = PH3
PH4 = Pin((1, 228))
PH4 = Pin((__chip_num, 228))
TWI3_SCL = PH4
PH5 = Pin((1, 229))
PH5 = Pin((__chip_num, 229))
UART2_TX = PH5
TWI3_SDA = PH5
SPI1_CS0 = PH5
PH6 = Pin((1, 230))
PH6 = Pin((__chip_num, 230))
UART2_RX = PH6
SPI1_SCLK = PH6
PH7 = Pin((1, 231))
PH7 = Pin((__chip_num, 231))
SPI1_MOSI = PH7
PH8 = Pin((1, 232))
PH8 = Pin((__chip_num, 232))
SPI1_MISO = PH8
PH9 = Pin((1, 233))
PH9 = Pin((__chip_num, 233))
SPI1_CS1 = PH9
PH10 = Pin((1, 234))
PH10 = Pin((__chip_num, 234))

PI0 = Pin((1, 256))
PI1 = Pin((1, 257))
PI2 = Pin((1, 258))
PI3 = Pin((1, 259))
PI4 = Pin((1, 260))
PI5 = Pin((1, 261))
PI6 = Pin((1, 262))
PI7 = Pin((1, 263))
PI8 = Pin((1, 264))
PI9 = Pin((1, 265))
PI10 = Pin((1, 266))
PI11 = Pin((1, 267))
PI12 = Pin((1, 268))
PI13 = Pin((1, 269))
PI14 = Pin((1, 270))
PI15 = Pin((1, 271))
PI16 = Pin((1, 272))
PI0 = Pin((__chip_num, 256))
PI1 = Pin((__chip_num, 257))
PI2 = Pin((__chip_num, 258))
PI3 = Pin((__chip_num, 259))
PI4 = Pin((__chip_num, 260))
PI5 = Pin((__chip_num, 261))
PI6 = Pin((__chip_num, 262))
PI7 = Pin((__chip_num, 263))
PI8 = Pin((__chip_num, 264))
PI9 = Pin((__chip_num, 265))
PI10 = Pin((__chip_num, 266))
PI11 = Pin((__chip_num, 267))
PI12 = Pin((__chip_num, 268))
PI13 = Pin((__chip_num, 269))
PI14 = Pin((__chip_num, 270))
PI15 = Pin((__chip_num, 271))
PI16 = Pin((__chip_num, 272))

i2cPorts = ((3, TWI3_SCL, TWI3_SDA),)
# ordered as spiId, sckId, mosiId, misoId
Expand Down
3 changes: 3 additions & 0 deletions src/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@
elif board_id == ap_board.MILKV_DUO:
from adafruit_blinka.board.milkv_duo import *

elif board_id == ap_board.WALNUT_PI_1B:
from adafruit_blinka.board.walnutpi.walnutpi1b import *

elif board_id == ap_board.OS_AGNOSTIC_BOARD:
from adafruit_blinka.board.generic_agnostic_board import *

Expand Down

0 comments on commit 4e66cb7

Please sign in to comment.