From: Melissa LeBlanc-Williams Date: Wed, 13 Sep 2023 17:05:59 +0000 (-0700) Subject: Merge branch 'main' of https://github.com/adafruit/Adafruit_Blinka into i2c-freq... X-Git-Tag: 8.22.2^2~1 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/131089ed0fd1ade7fa3e5980e9c2982b9a3dc193?hp=754ff2c7e244625735e19c91ed5a8be0e885df33 Merge branch 'main' of https://github.com/adafruit/Adafruit_Blinka into i2c-freq-message --- diff --git a/README.rst b/README.rst index 3e21f93..30c64ed 100755 --- a/README.rst +++ b/README.rst @@ -77,15 +77,27 @@ To install in a virtual environment in your current project: Usage Example ============= -At the time of writing (`git:7fc1f8ab `_), -the following sequence runs through some basic testing of the digitalio compatibility layer... +The pin names may vary by board, so you may need to change the pin names in the code. This +example runs on the Raspberry Pi boards to blink an LED connected to GPIO 18 (Pin 12): .. code-block:: python - from testing import test_module_name - test_module_name("testing.universal.digitalio") + import time + import board + import digitalio -An example log from running the suites is `here `_ . + PIN = board.D18 + + print("hello blinky!") + + led = digitalio.DigitalInOut(PIN) + led.direction = digitalio.Direction.OUTPUT + + while True: + led.value = True + time.sleep(0.5) + led.value = False + time.sleep(0.5) Contributing ============ diff --git a/src/adafruit_blinka/microcontroller/amlogic/meson_g12_common/pin.py b/src/adafruit_blinka/microcontroller/amlogic/meson_g12_common/pin.py index 87f4571..1f9fa3c 100644 --- a/src/adafruit_blinka/microcontroller/amlogic/meson_g12_common/pin.py +++ b/src/adafruit_blinka/microcontroller/amlogic/meson_g12_common/pin.py @@ -30,15 +30,24 @@ else: chip0 = gpiod.chip("0") chip1 = gpiod.chip("1") +if callable(chip0.num_lines): + chip0lines = chip0.num_lines() +else: + chip0lines = chip0.num_lines + +if callable(chip1.num_lines): + chip1lines = chip1.num_lines() +else: + chip1lines = chip1.num_lines -if chip0.num_lines < 20: +if chip0lines < 20: aobus = 0 periphs = 1 - periphs_offset = chip1.num_lines - 85 + periphs_offset = chip1lines - 85 else: aobus = 1 periphs = 0 - periphs_offset = chip0.num_lines - 85 + periphs_offset = chip0lines - 85 del chip0 del chip1