]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge branch 'master' of https://github.com/binhollc/Adafruit_Blinka
authorFrancis Guevarra <francis@binho.io>
Mon, 2 Dec 2019 23:47:58 +0000 (15:47 -0800)
committerFrancis Guevarra <francis@binho.io>
Mon, 2 Dec 2019 23:47:58 +0000 (15:47 -0800)
setup.py
src/adafruit_blinka/microcontroller/bcm283x/pulseio/PulseIn.py
src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein
src/adafruit_blinka/microcontroller/ft232h/spi.py
src/board.py
src/busio.py
src/micropython.py

index c326d66d75b96b4d82eceecc2f2bfc703100a6f3..a8f9b1c73c985d098428c274cc153ff2d41eeb37 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,7 @@ setup(
     install_requires=[
         "Adafruit-PlatformDetect",
         "Adafruit-PureIO",
-        "spidev; sys_platform=='linux'",
+        "spidev>=3.4; sys_platform=='linux'",
         "sysv_ipc; platform_system != 'Windows'"
     ] + board_reqs,
     license='MIT',
index b918c86a02e369c051eb8d069f9373f73daa7eff..289d1064ffb51d1cc21ee55d342e77226e32cb1e 100644 (file)
@@ -48,7 +48,7 @@ class PulseIn:
         cmd = [dir_path+"/libgpiod_pulsein",
                "--pulses", str(maxlen),
                "--queue", str(self._mq.key)]
-        if not idle_state:
+        if idle_state:
             cmd.append("-i")
         cmd.append("gpiochip0")
         cmd.append(str(pin))
index c58b443f52f916fe6b1b003acd84cbef81daa097..3bbb65fe39b3daa3c1388d3c7cc44860a2f8654e 100755 (executable)
Binary files a/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein and b/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein differ
index 2d42ae0da8d546c9c4132d3e2730c3917e2f546e..a260e7206e42ed2f4e89f8468e481d01f37f7301 100644 (file)
@@ -17,7 +17,12 @@ class SPI:
     def init(self, baudrate=100000, polarity=0, phase=0, bits=8,
                   firstbit=MSB, sck=None, mosi=None, miso=None):
         self._port.set_frequency(baudrate)
+        # FTDI device can only support mode 0 and mode 2
+        # due to the limitation of MPSSE engine.
+        # This means CPHA must = 0
         self._port._cpol = polarity
+        if phase != 0:
+            raise ValueError("Only SPI phase 0 is supported by FT232H.")
         self._port._cpha = phase
 
     @property
index e8b5dc43b88f6653ca3545aefea5bbed7cfe5687..e0079008f2b686b9865036eadd5590c9239618b8 100755 (executable)
@@ -58,6 +58,9 @@ elif detector.board.RASPBERRY_PI_B_REV2:
 elif board_id == ap_board.BEAGLEBONE_BLACK:
     from adafruit_blinka.board.beaglebone_black import *
 
+elif board_id == ap_board.BEAGLEBONE_GREEN_WIRELESS:
+    from adafruit_blinka.board.beaglebone_black import *
+
 elif board_id == ap_board.BEAGLEBONE_POCKETBEAGLE:
     from adafruit_blinka.board.beaglebone_pocketbeagle import *
 
index be09cd08833c79e41a7e378bf2b02ca7578122cf..b478ec06c6a37cdef99720b71712607e1f0d0253 100755 (executable)
@@ -7,6 +7,8 @@ See `CircuitPython:busio` in CircuitPython for more details.
 * Author(s): cefn
 """
 
+import threading
+
 from adafruit_blinka import Enum, Lockable, agnostic
 from adafruit_blinka.agnostic import board_id, detector
 import adafruit_platformdetect.board as ap_board
@@ -39,6 +41,8 @@ class I2C(Lockable):
                 "No Hardware I2C on (scl,sda)={}\nValid I2C ports: {}".format((scl, sda), i2cPorts)
             )
 
+        self._lock = threading.RLock()
+
     def deinit(self):
         try:
             del self._i2c
@@ -46,9 +50,11 @@ class I2C(Lockable):
             pass
 
     def __enter__(self):
+        self._lock.acquire()
         return self
 
     def __exit__(self, exc_type, exc_value, traceback):
+        self._lock.release()
         self.deinit()
 
     def scan(self):
index b5af9b39a5c5627d735dfdd3ecf0dcd756907fdd..620646f85882ec03383e00cf33a6aa5a2a955488 100755 (executable)
@@ -1,2 +1,14 @@
 def const(x):
     return x
+
+
+def native(f):
+    return f
+
+
+def viper(f):
+    raise SyntaxError("invalid micropython decorator")
+
+
+def asm_thumb(f):
+    raise SyntaxError("invalid micropython decorator")
\ No newline at end of file