hardware: move gpio_export (#29154)
old-commit-hash: eec99436c1c5489e2e49dc0760725f6fc6b9e47d
This commit is contained in:
@@ -25,6 +25,13 @@ def gpio_read(pin: int) -> Optional[bool]:
|
||||
|
||||
return val
|
||||
|
||||
def gpio_export(pin: int):
|
||||
try:
|
||||
with open("/sys/class/gpio/export", 'w') as f:
|
||||
f.write(str(pin))
|
||||
except Exception:
|
||||
print(f"Failed to export gpio {pin}")
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def get_irq_action(irq: int) -> List[str]:
|
||||
try:
|
||||
|
||||
@@ -4,7 +4,7 @@ import time
|
||||
import numpy as np
|
||||
from system.hardware.tici.hardware import Tici
|
||||
from system.hardware.tici.pins import GPIO
|
||||
from common.gpio import gpio_init, gpio_set
|
||||
from common.gpio import gpio_init, gpio_set, gpio_export
|
||||
|
||||
def read_power():
|
||||
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/in1_input") as f:
|
||||
@@ -33,13 +33,6 @@ def read_power_avg():
|
||||
return "total %7.2f mW SOM %7.2f mW" % (power_total, power_som)
|
||||
|
||||
|
||||
def gpio_export(pin):
|
||||
try:
|
||||
with open("/sys/class/gpio/export", 'w') as f:
|
||||
f.write(str(pin))
|
||||
except Exception:
|
||||
print(f"Failed to export gpio {pin}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
gpio_export(GPIO.CAM0_AVDD_EN)
|
||||
gpio_export(GPIO.CAM0_RSTN)
|
||||
|
||||
Reference in New Issue
Block a user