From: Melissa LeBlanc-Williams Date: Wed, 30 Mar 2022 16:29:20 +0000 (-0700) Subject: Merge pull request #566 from BytEvil/main X-Git-Tag: 7.2.0 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/c4d26d1a2f3d037a20aa5ae55936baa265258edb?hp=c17ce9555550b8d7a3d052a2382c5077a3fd7e14 Merge pull request #566 from BytEvil/main Add Khadas VIM3 board. --- diff --git a/src/adafruit_blinka/board/khadas/__init__.py b/src/adafruit_blinka/board/khadas/__init__.py new file mode 100644 index 0000000..77cd5cb --- /dev/null +++ b/src/adafruit_blinka/board/khadas/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Boards definition from Khadas""" diff --git a/src/adafruit_blinka/board/khadas/khadasvim3.py b/src/adafruit_blinka/board/khadas/khadasvim3.py new file mode 100644 index 0000000..0380367 --- /dev/null +++ b/src/adafruit_blinka/board/khadas/khadasvim3.py @@ -0,0 +1,140 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Khadas VIM3.""" + +from adafruit_blinka.microcontroller.amlogic.a311d import pin + +GPIOAO_0 = pin.GPIO496 +GPIOAO_1 = pin.GPIO497 +GPIOAO_2 = pin.GPIO498 +GPIOAO_3 = pin.GPIO499 +GPIOAO_4 = pin.GPIO500 +GPIOAO_5 = pin.GPIO501 +GPIOAO_6 = pin.GPIO502 +GPIOAO_7 = pin.GPIO503 +GPIOAO_8 = pin.GPIO504 +GPIOAO_9 = pin.GPIO505 +GPIOAO_10 = pin.GPIO506 +GPIOAO_11 = pin.GPIO507 + +GPIOE_0 = pin.GPIO508 +GPIOE_1 = pin.GPIO509 +GPIOE_2 = pin.GPIO510 + +GPIOZ_0 = pin.GPIO427 +GPIOZ_1 = pin.GPIO428 +GPIOZ_2 = pin.GPIO429 +GPIOZ_3 = pin.GPIO430 +GPIOZ_4 = pin.GPIO431 +GPIOZ_5 = pin.GPIO432 +GPIOZ_6 = pin.GPIO433 +GPIOZ_7 = pin.GPIO434 +GPIOZ_8 = pin.GPIO435 +GPIOZ_9 = pin.GPIO436 +GPIOZ_10 = pin.GPIO437 +GPIOZ_11 = pin.GPIO438 +GPIOZ_12 = pin.GPIO439 +GPIOZ_13 = pin.GPIO440 +GPIOZ_14 = pin.GPIO441 +GPIOZ_15 = pin.GPIO442 + +GPIOH_0 = pin.GPIO443 +GPIOH_1 = pin.GPIO444 +GPIOH_2 = pin.GPIO445 +GPIOH_3 = pin.GPIO446 +GPIOH_4 = pin.GPIO447 +GPIOH_5 = pin.GPIO448 +GPIOH_6 = pin.GPIO449 +GPIOH_7 = pin.GPIO450 +GPIOH_8 = pin.GPIO451 + +BOOT_0 = pin.GPIO452 +BOOT_1 = pin.GPIO453 +BOOT_2 = pin.GPIO454 +BOOT_3 = pin.GPIO455 +BOOT_4 = pin.GPIO456 +BOOT_5 = pin.GPIO457 +BOOT_6 = pin.GPIO458 +BOOT_7 = pin.GPIO459 +BOOT_8 = pin.GPIO460 +BOOT_9 = pin.GPIO461 +BOOT_10 = pin.GPIO462 +BOOT_11 = pin.GPIO463 +BOOT_12 = pin.GPIO464 +BOOT_13 = pin.GPIO465 +BOOT_14 = pin.GPIO466 +BOOT_15 = pin.GPIO467 + +GPIOC_0 = pin.GPIO468 +GPIOC_1 = pin.GPIO469 +GPIOC_2 = pin.GPIO470 +GPIOC_3 = pin.GPIO471 +GPIOC_4 = pin.GPIO472 +GPIOC_5 = pin.GPIO473 +GPIOC_6 = pin.GPIO474 +GPIOC_7 = pin.GPIO475 + +GPIOA_0 = pin.GPIO460 +GPIOA_1 = pin.GPIO461 +GPIOA_2 = pin.GPIO462 +GPIOA_3 = pin.GPIO463 +GPIOA_4 = pin.GPIO464 +GPIOA_5 = pin.GPIO465 +GPIOA_6 = pin.GPIO466 +GPIOA_7 = pin.GPIO467 +GPIOA_8 = pin.GPIO468 +GPIOA_9 = pin.GPIO469 +GPIOA_10 = pin.GPIO470 +GPIOA_11 = pin.GPIO471 +GPIOA_12 = pin.GPIO472 +GPIOA_13 = pin.GPIO473 +GPIOA_14 = pin.GPIO474 +GPIOA_15 = pin.GPIO475 + +GPIOX_0 = pin.GPIO476 +GPIOX_1 = pin.GPIO477 +GPIOX_2 = pin.GPIO478 +GPIOX_3 = pin.GPIO479 +GPIOX_4 = pin.GPIO480 +GPIOX_5 = pin.GPIO481 +GPIOX_6 = pin.GPIO482 +GPIOX_7 = pin.GPIO483 +GPIOX_8 = pin.GPIO484 +GPIOX_9 = pin.GPIO485 +GPIOX_10 = pin.GPIO486 +GPIOX_11 = pin.GPIO487 +GPIOX_12 = pin.GPIO488 +GPIOX_13 = pin.GPIO489 +GPIOX_14 = pin.GPIO490 +GPIOX_15 = pin.GPIO491 +GPIOX_16 = pin.GPIO492 +GPIOX_17 = pin.GPIO493 +GPIOX_18 = pin.GPIO494 +GPIOX_19 = pin.GPIO495 + +SCL = pin.GPIOX_18 +SDA = pin.GPIOX_17 + +SCLK = pin.SPI0_SCLK +MCLK0 = pin.SPI0_MCLK0 +MISO = pin.SPI0_SDO +MOSI = pin.SPI0_SDI + +D0 = GPIOAO_10 # PIN_13 +D1 = GPIOH_6 # PIN_15 +D2 = GPIOH_7 # PIN_16 +D3 = GPIOAO_1 # PIN_18 +D4 = GPIOAO_2 # PIN_19 +D5 = GPIOA_15 # PIN_22 +D6 = GPIOA_14 # PIN_23 +D7 = GPIOAO_2 # PIN_25 +D8 = GPIOAO_3 # PIN_26 +D9 = GPIOA_1 # PIN_29 +D10 = GPIOA_0 # PIN_30 +D11 = GPIOA_3 # PIN_31 +D12 = GPIOA_2 # PIN_32 +D13 = GPIOA_4 # PIN_33 +D14 = GPIOH_5 # PIN_35 +D15 = GPIOH_4 # PIN_37 +D16 = GPIOZ_15 # PIN_39 diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/__init__.py b/src/adafruit_blinka/microcontroller/amlogic/a311d/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pin.py b/src/adafruit_blinka/microcontroller/amlogic/a311d/pin.py new file mode 100644 index 0000000..94b06ca --- /dev/null +++ b/src/adafruit_blinka/microcontroller/amlogic/a311d/pin.py @@ -0,0 +1,179 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +""" +G12A, G12B, and SM1 Common Definitions +Ref: +Linux kernel 4.9.y (hardkernel) + linux/include/dt-bindings/gpio/meson-g12a-gpio.h +Linux kernel 5.4.y (mainline) + linux/include/dt-bindings/gpio/meson-g12a-gpio.h + linux/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +""" + +import re +import gpiod +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + +chip0 = gpiod.Chip("0") +chip1 = gpiod.Chip("1") + +if chip0.num_lines() < 20: + aobus = 0 + periphs = 1 + periphs_offset = chip1.num_lines() - 85 +else: + aobus = 1 + periphs = 0 + periphs_offset = chip0.num_lines() - 85 + +chip0.close() +chip1.close() + +GPIOAO_0 = GPIO496 = Pin((aobus, 0)) +GPIOAO_1 = GPIO497 = Pin((aobus, 1)) +GPIOAO_2 = GPIO498 = Pin((aobus, 2)) +GPIOAO_3 = GPIO499 = Pin((aobus, 3)) +GPIOAO_4 = GPIO500 = Pin((aobus, 4)) +GPIOAO_5 = GPIO501 = Pin((aobus, 5)) +GPIOAO_6 = GPIO502 = Pin((aobus, 6)) +GPIOAO_7 = GPIO503 = Pin((aobus, 7)) +GPIOAO_8 = GPIO504 = Pin((aobus, 8)) +GPIOAO_9 = GPIO505 = Pin((aobus, 9)) +GPIOAO_10 = GPIO506 = Pin((aobus, 10)) +GPIOAO_11 = GPIO507 = Pin((aobus, 11)) + +GPIOE_0 = GPIO508 = Pin((aobus, 12)) +GPIOE_1 = GPIO509 = Pin((aobus, 13)) +GPIOE_2 = GPIO510 = Pin((aobus, 14)) + +GPIOZ_0 = GPIO427 = Pin((periphs, 0 + periphs_offset)) +GPIOZ_1 = GPIO428 = Pin((periphs, 1 + periphs_offset)) +GPIOZ_2 = GPIO429 = Pin((periphs, 2 + periphs_offset)) +GPIOZ_3 = GPIO430 = Pin((periphs, 3 + periphs_offset)) +GPIOZ_4 = GPIO431 = Pin((periphs, 4 + periphs_offset)) +GPIOZ_5 = GPIO432 = Pin((periphs, 5 + periphs_offset)) +GPIOZ_6 = GPIO433 = Pin((periphs, 6 + periphs_offset)) +GPIOZ_7 = GPIO434 = Pin((periphs, 7 + periphs_offset)) +GPIOZ_8 = GPIO435 = Pin((periphs, 8 + periphs_offset)) +GPIOZ_9 = GPIO436 = Pin((periphs, 9 + periphs_offset)) +GPIOZ_10 = GPIO437 = Pin((periphs, 10 + periphs_offset)) +GPIOZ_11 = GPIO438 = Pin((periphs, 11 + periphs_offset)) +GPIOZ_12 = GPIO439 = Pin((periphs, 12 + periphs_offset)) +GPIOZ_13 = GPIO440 = Pin((periphs, 13 + periphs_offset)) +GPIOZ_14 = GPIO441 = Pin((periphs, 14 + periphs_offset)) +GPIOZ_15 = GPIO442 = Pin((periphs, 15 + periphs_offset)) + +GPIOH_0 = GPIO443 = Pin((periphs, 16 + periphs_offset)) +GPIOH_1 = GPIO444 = Pin((periphs, 17 + periphs_offset)) +GPIOH_2 = GPIO445 = Pin((periphs, 18 + periphs_offset)) +GPIOH_3 = GPIO446 = Pin((periphs, 19 + periphs_offset)) +GPIOH_4 = GPIO447 = Pin((periphs, 20 + periphs_offset)) +GPIOH_5 = GPIO448 = Pin((periphs, 21 + periphs_offset)) +GPIOH_6 = GPIO449 = Pin((periphs, 22 + periphs_offset)) +GPIOH_7 = GPIO450 = Pin((periphs, 23 + periphs_offset)) +GPIOH_8 = GPIO451 = Pin((periphs, 24 + periphs_offset)) + +BOOT_0 = GPIO452 = Pin((periphs, 25 + periphs_offset)) +BOOT_1 = GPIO453 = Pin((periphs, 26 + periphs_offset)) +BOOT_2 = GPIO454 = Pin((periphs, 27 + periphs_offset)) +BOOT_3 = GPIO455 = Pin((periphs, 28 + periphs_offset)) +BOOT_4 = GPIO456 = Pin((periphs, 29 + periphs_offset)) +BOOT_5 = GPIO457 = Pin((periphs, 30 + periphs_offset)) +BOOT_6 = GPIO458 = Pin((periphs, 31 + periphs_offset)) +BOOT_7 = GPIO459 = Pin((periphs, 32 + periphs_offset)) +BOOT_8 = GPIO460 = Pin((periphs, 33 + periphs_offset)) +BOOT_9 = GPIO461 = Pin((periphs, 34 + periphs_offset)) +BOOT_10 = GPIO462 = Pin((periphs, 35 + periphs_offset)) +BOOT_11 = GPIO463 = Pin((periphs, 36 + periphs_offset)) +BOOT_12 = GPIO464 = Pin((periphs, 37 + periphs_offset)) +BOOT_13 = GPIO465 = Pin((periphs, 38 + periphs_offset)) +BOOT_14 = GPIO466 = Pin((periphs, 39 + periphs_offset)) +BOOT_15 = GPIO467 = Pin((periphs, 40 + periphs_offset)) + +GPIOC_0 = GPIO468 = Pin((periphs, 41 + periphs_offset)) +GPIOC_1 = GPIO469 = Pin((periphs, 42 + periphs_offset)) +GPIOC_2 = GPIO470 = Pin((periphs, 43 + periphs_offset)) +GPIOC_3 = GPIO471 = Pin((periphs, 44 + periphs_offset)) +GPIOC_4 = GPIO472 = Pin((periphs, 45 + periphs_offset)) +GPIOC_5 = GPIO473 = Pin((periphs, 46 + periphs_offset)) +GPIOC_6 = GPIO474 = Pin((periphs, 47 + periphs_offset)) +GPIOC_7 = GPIO475 = Pin((periphs, 48 + periphs_offset)) + +GPIOA_0 = GPIO460 = Pin((periphs, 49 + periphs_offset)) +GPIOA_1 = GPIO461 = Pin((periphs, 50 + periphs_offset)) +GPIOA_2 = GPIO462 = Pin((periphs, 51 + periphs_offset)) +GPIOA_3 = GPIO463 = Pin((periphs, 52 + periphs_offset)) +GPIOA_4 = GPIO464 = Pin((periphs, 53 + periphs_offset)) +GPIOA_5 = GPIO465 = Pin((periphs, 54 + periphs_offset)) +GPIOA_6 = GPIO466 = Pin((periphs, 55 + periphs_offset)) +GPIOA_7 = GPIO467 = Pin((periphs, 56 + periphs_offset)) +GPIOA_8 = GPIO468 = Pin((periphs, 57 + periphs_offset)) +GPIOA_9 = GPIO469 = Pin((periphs, 58 + periphs_offset)) +GPIOA_10 = GPIO470 = Pin((periphs, 59 + periphs_offset)) +GPIOA_11 = GPIO471 = Pin((periphs, 60 + periphs_offset)) +GPIOA_12 = GPIO472 = Pin((periphs, 61 + periphs_offset)) +GPIOA_13 = GPIO473 = Pin((periphs, 62 + periphs_offset)) +GPIOA_14 = GPIO474 = Pin((periphs, 63 + periphs_offset)) +GPIOA_15 = GPIO475 = Pin((periphs, 64 + periphs_offset)) + +GPIOX_0 = GPIO476 = Pin((periphs, 65 + periphs_offset)) +GPIOX_1 = GPIO477 = Pin((periphs, 66 + periphs_offset)) +GPIOX_2 = GPIO478 = Pin((periphs, 67 + periphs_offset)) +GPIOX_3 = GPIO479 = Pin((periphs, 68 + periphs_offset)) +GPIOX_4 = GPIO480 = Pin((periphs, 69 + periphs_offset)) +GPIOX_5 = GPIO481 = Pin((periphs, 70 + periphs_offset)) +GPIOX_6 = GPIO482 = Pin((periphs, 71 + periphs_offset)) +GPIOX_7 = GPIO483 = Pin((periphs, 72 + periphs_offset)) +GPIOX_8 = GPIO484 = Pin((periphs, 73 + periphs_offset)) +GPIOX_9 = GPIO485 = Pin((periphs, 74 + periphs_offset)) +GPIOX_10 = GPIO486 = Pin((periphs, 75 + periphs_offset)) +GPIOX_11 = GPIO487 = Pin((periphs, 76 + periphs_offset)) +GPIOX_12 = GPIO488 = Pin((periphs, 77 + periphs_offset)) +GPIOX_13 = GPIO489 = Pin((periphs, 78 + periphs_offset)) +GPIOX_14 = GPIO490 = Pin((periphs, 79 + periphs_offset)) +GPIOX_15 = GPIO491 = Pin((periphs, 80 + periphs_offset)) +GPIOX_16 = GPIO492 = Pin((periphs, 81 + periphs_offset)) +GPIOX_17 = GPIO493 = Pin((periphs, 82 + periphs_offset)) +GPIOX_18 = GPIO494 = Pin((periphs, 83 + periphs_offset)) +GPIOX_19 = GPIO495 = Pin((periphs, 84 + periphs_offset)) + +SPI0_SCLK = GPIOA_1 +SPI0_MCLK0 = GPIOA_0 +SPI0_SDO = GPIOA_3 +SPI0_SDI = GPIOA_4 + +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ((0, SPI0_SCLK, SPI0_MCLK0, SPI0_SDO, SPI0_SDI),) + +UART1_TX = GPIOH_7 +UART1_RX = GPIOH_6 + +# ordered as uartId, txId, rxId +uartPorts = ((1, UART1_TX, UART1_RX),) + + +def get_dts_alias(device: str) -> str: + """Get the Device Tree Alias""" + uevent_path = "/sys/bus/platform/devices/" + device + "/uevent" + with open(uevent_path, "r", encoding="utf-8") as fd: + pattern = r"^OF_ALIAS_0=(.*)$" + uevent = fd.read().split("\n") + for line in uevent: + match = re.search(pattern, line) + if match: + return match.group(1).upper() + + return None + + +# ordered as i2cId, sclId, sdaId +i2cPorts = [] + +alias = get_dts_alias("ff805000.i2c") +if alias is not None: + globals()[alias + "_SCL"] = GPIOX_18 + globals()[alias + "_SDA"] = GPIOX_17 + i2cPorts.append((int(alias[3]), GPIOX_18, GPIOX_17)) + +i2cPorts = tuple(i2cPorts) diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/PulseIn.py b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/PulseIn.py new file mode 100644 index 0000000..caf0d62 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/PulseIn.py @@ -0,0 +1,181 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Custom PulseIn Class to read PWM signals""" +import time +import subprocess +import os +import atexit +import random +import struct +import sysv_ipc + +DEBUG = False +queues = [] +procs = [] + +# The message queues live outside of python space, and must be formally cleaned! +def final(): + """In case the program is cancelled or quit, we need to clean up the PulseIn + helper process and also the message queue, this is called at exit to do so""" + if DEBUG: + print("Cleaning up message queues", queues) + print("Cleaning up processes", procs) + for q in queues: + q.remove() + for proc in procs: + proc.terminate() + + +atexit.register(final) + +# pylint: disable=c-extension-no-member +class PulseIn: + """PulseIn Class to read PWM signals""" + + def __init__(self, pin, maxlen=2, idle_state=False): + """Create a PulseIn object associated with the given pin. + The object acts as a read-only sequence of pulse lengths with + a given max length. When it is active, new pulse lengths are + added to the end of the list. When there is no more room + (len() == maxlen) the oldest pulse length is removed to make room.""" + self._pin = pin + self._maxlen = maxlen + self._idle_state = idle_state + self._queue_key = random.randint(1, 9999) + try: + self._mq = sysv_ipc.MessageQueue(None, flags=sysv_ipc.IPC_CREX) + if DEBUG: + print("Message Queue Key: ", self._mq.key) + queues.append(self._mq) + except sysv_ipc.ExistentialError: + raise RuntimeError( + "Message queue creation failed" + ) from sysv_ipc.ExistentialError + + # Check if OS is 64-bit + if struct.calcsize("P") * 8 == 64: # pylint: disable=no-member + libgpiod_filename = "libgpiod_pulsein64" + else: + libgpiod_filename = "libgpiod_pulsein" + + dir_path = os.path.dirname(os.path.realpath(__file__)) + cmd = [ + dir_path + "/" + libgpiod_filename, + "--pulses", + str(maxlen), + "--queue", + str(self._mq.key), + ] + if idle_state: + cmd.append("-i") + cmd.append("gpiochip0") + cmd.append(str(pin)) + if DEBUG: + print(cmd) + + self._process = subprocess.Popen(cmd) # pylint: disable=consider-using-with + procs.append(self._process) + + # wait for it to start up + if DEBUG: + print("Waiting for startup success message from subprocess") + message = self._wait_receive_msg(timeout=0.25) + if message[0] != b"!": + raise RuntimeError("Could not establish message queue with subprocess") + self._paused = False + + # pylint: disable=redefined-builtin + def _wait_receive_msg(self, timeout=0, type=2): + """Internal helper that will wait for new messages of a given type, + and throw an exception on timeout""" + if timeout > 0: + stamp = time.monotonic() + while (time.monotonic() - stamp) < timeout: + try: + message = self._mq.receive(block=False, type=type) + return message + except sysv_ipc.BusyError: + time.sleep(0.001) # wait a bit then retry! + # uh-oh timed out + raise RuntimeError( + "Timed out waiting for PulseIn message. Make sure libgpiod is installed." + ) + message = self._mq.receive(block=True, type=type) + return message + + # pylint: enable=redefined-builtin + + def deinit(self): + """Deinitialises the PulseIn and releases any hardware and software + resources for reuse.""" + # Clean up after ourselves + self._process.terminate() + procs.remove(self._process) + self._mq.remove() + queues.remove(self._mq) + + def __enter__(self): + """No-op used by Context Managers.""" + return self + + def __exit__(self, exc_type, exc_value, tb): + """Automatically deinitializes the hardware when exiting a context.""" + self.deinit() + + def resume(self, trigger_duration=0): + """Resumes pulse capture after an optional trigger pulse.""" + if trigger_duration != 0: + self._mq.send("t%d" % trigger_duration, True, type=1) + else: + self._mq.send("r", True, type=1) + self._paused = False + + def pause(self): + """Pause pulse capture""" + self._mq.send("p", True, type=1) + self._paused = True + + @property + def paused(self): + """True when pulse capture is paused as a result of pause() or + an error during capture such as a signal that is too fast.""" + return self._paused + + @property + def maxlen(self): + """The maximum length of the PulseIn. When len() is equal to maxlen, + it is unclear which pulses are active and which are idle.""" + return self._maxlen + + def clear(self): + """Clears all captured pulses""" + self._mq.send("c", True, type=1) + + def popleft(self): + """Removes and returns the oldest read pulse.""" + self._mq.send("^", True, type=1) + message = self._wait_receive_msg() + reply = int(message[0].decode("utf-8")) + # print(reply) + if reply == -1: + raise IndexError("pop from empty list") + return reply + + def __len__(self): + """Returns the current pulse length""" + self._mq.send("l", True, type=1) + message = self._wait_receive_msg() + return int(message[0].decode("utf-8")) + + # pylint: disable=redefined-builtin + def __getitem__(self, index, type=None): + """Returns the value at the given index or values in slice.""" + self._mq.send("i%d" % index, True, type=1) + message = self._wait_receive_msg() + ret = int(message[0].decode("utf-8")) + if ret == -1: + raise IndexError("list index out of range") + return ret + + # pylint: enable=redefined-builtin diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/__init__.py b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein new file mode 100755 index 0000000..0291c1b Binary files /dev/null and b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein differ diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein.license b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein.license new file mode 100644 index 0000000..cc69330 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein64 b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein64 new file mode 100755 index 0000000..0143060 Binary files /dev/null and b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein64 differ diff --git a/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein64.license b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein64.license new file mode 100644 index 0000000..cc69330 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/amlogic/a311d/pulseio/libgpiod_pulsein64.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/src/board.py b/src/board.py old mode 100755 new mode 100644 index b3150ed..c5ade27 --- a/src/board.py +++ b/src/board.py @@ -163,6 +163,9 @@ elif board_id == ap_board.ODROID_C4: elif board_id == ap_board.ODROID_N2: from adafruit_blinka.board.hardkernel.odroidn2 import * +elif board_id == ap_board.KHADAS_VIM3: + from adafruit_blinka.board.khadas.khadasvim3 import * + elif board_id == ap_board.ODROID_XU4: from adafruit_blinka.board.hardkernel.odroidxu4 import * diff --git a/src/busio.py b/src/busio.py old mode 100755 new mode 100644 diff --git a/src/digitalio.py b/src/digitalio.py old mode 100755 new mode 100644 index 99f0a08..50f53da --- a/src/digitalio.py +++ b/src/digitalio.py @@ -38,6 +38,8 @@ elif detector.chip.S905X3: from adafruit_blinka.microcontroller.amlogic.s905x3.pin import Pin elif detector.chip.S922X: from adafruit_blinka.microcontroller.amlogic.s922x.pin import Pin +elif detector.chip.A311D: + from adafruit_blinka.microcontroller.amlogic.a311d.pin import Pin elif detector.chip.EXYNOS5422: from adafruit_blinka.microcontroller.samsung.exynos5422.pin import Pin elif detector.chip.APQ8016: diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py old mode 100755 new mode 100644 index 3d71f8a..d5996d9 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -68,6 +68,8 @@ elif chip_id == ap_chip.S905X3: from adafruit_blinka.microcontroller.amlogic.s905x3 import * elif chip_id == ap_chip.S922X: from adafruit_blinka.microcontroller.amlogic.s922x import * +elif chip_id == ap_chip.A311D: + from adafruit_blinka.microcontroller.amlogic.a311d import * elif chip_id == ap_chip.EXYNOS5422: from adafruit_blinka.microcontroller.samsung.exynos5422 import * elif chip_id == ap_chip.APQ8016: diff --git a/src/microcontroller/pin.py b/src/microcontroller/pin.py old mode 100755 new mode 100644 index dd912fb..3f7b20e --- a/src/microcontroller/pin.py +++ b/src/microcontroller/pin.py @@ -55,6 +55,8 @@ elif chip_id == ap_chip.S905X3: from adafruit_blinka.microcontroller.amlogic.s905x3.pin import * elif chip_id == ap_chip.S922X: from adafruit_blinka.microcontroller.amlogic.s922x.pin import * +elif chip_id == ap_chip.A311D: + from adafruit_blinka.microcontroller.amlogic.a311d.pin import * elif chip_id == ap_chip.EXYNOS5422: from adafruit_blinka.microcontroller.samsung.exynos5422.pin import * elif chip_id == ap_chip.APQ8016: