]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge pull request #75 from caternuson/iss74
authorLimor "Ladyada" Fried <limor@ladyada.net>
Thu, 3 Jan 2019 15:02:32 +0000 (07:02 -0800)
committerGitHub <noreply@github.com>
Thu, 3 Jan 2019 15:02:32 +0000 (07:02 -0800)
Add linux detect to busio.UART

src/busio.py

index 61bebabaec00f66d231902f52a52ad2ae98ee3ef..81b20c22838139eaf6ca173984e848f3b13aafcb 100755 (executable)
@@ -149,7 +149,10 @@ class UART(Lockable):
                  timeout=1000,
                  receiver_buffer_size=64,
                  flow=None):
-        from machine import UART as _UART
+        if detector.board.any_embedded_linux:
+            raise RuntimeError('busio.UART not supported on this platform. Please use pyserial instead.')
+        else:
+            from machine import UART as _UART
         from microcontroller.pin import uartPorts
 
         self.baudrate = baudrate