Skip to content

Commit

Permalink
fix pre-commit check fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Dangku committed Sep 4, 2024
1 parent 64c2db0 commit 3746b1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/adafruit_blinka/microcontroller/allwinner/h618/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import re
from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin


def find_gpiochip_number(target_label):
"""Get correct gpiochip number, legacy kernel and mainline kernel are different"""
try:
with open('/sys/kernel/debug/gpio', 'r') as f:
with open("/sys/kernel/debug/gpio", "r") as f:
lines = f.readlines()
except FileNotFoundError:
print("The file /sys/kernel/debug/gpio does not exist.")
Expand All @@ -17,13 +18,14 @@ def find_gpiochip_number(target_label):
gpiochip_number = None
for line in lines:
if target_label in line:
match = re.search(r'gpiochip(\d+)', line)
match = re.search(r"gpiochip(\d+)", line)
if match:
gpiochip_number = match.group(1)
break

return gpiochip_number


if find_gpiochip_number("300b000.pinctrl"):
__chip_num = 1
else:
Expand Down
14 changes: 4 additions & 10 deletions src/adafruit_blinka/microcontroller/spacemit/k1/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from adafruit_blinka.agnostic import detector
from adafruit_blinka.microcontroller.alias import get_pwm_chipid
from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin

__chip_num = 0

GPIO_0 = Pin((__chip_num, 0))
Expand Down Expand Up @@ -141,9 +141,7 @@
I2C4_SCL = GPIO_51
I2C4_SDA = GPIO_52

i2cPorts = (
(4, I2C4_SCL, I2C4_SDA),
)
i2cPorts = ((4, I2C4_SCL, I2C4_SDA),)

# SPI
SPI3_MISO = GPIO_78
Expand All @@ -152,18 +150,14 @@
SPI3_CS0 = GPIO_76

# ordered as spiId, sckId, mosiId, misoId
spiPorts = (
(3, SPI3_SCLK, SPI3_MOSI, SPI3_MISO),
)
spiPorts = ((3, SPI3_SCLK, SPI3_MOSI, SPI3_MISO),)

# UART
UART0_TX = GPIO_47
UART0_RX = GPIO_48

# ordered as uartId, txId, rxId
uartPorts = (
(0, UART0_TX, UART0_RX),
)
uartPorts = ((0, UART0_TX, UART0_RX),)

# SysFS pwm outputs, pwm channel and pin in first tuple
pwmOuts = []
Expand Down

0 comments on commit 3746b1b

Please sign in to comment.