--- /dev/null
+import sys
+sys.path.append('/home/pi/Adafruit_Micropython_Blinka/src')
+sys.path.append('/home/pi/Adafruit_Python_GPIO')
+
+#from Adafruit_GPIO import Platform
+#print("Platform = ", Platform.platform_detect(), Platform.pi_version())
+
+from adafruit_blinka.agnostic import board as agnostic_board
+print("hello blinka!")
+print("Found system type: %s (sys.plaform %s implementation %s) " % (agnostic_board, sys.platform, sys.implementation.name))
+
+import board
+
+print(dir(board))
+
+#print(adafruit_blinka.adafruit_blinka.agnostic.microcontroller)
environment is established, can choose various routes to make available and re-export
common modules and operations, depending on platform support
"""
-import gc
import sys
-gc.collect()
-
# We intentionally are patching into this namespace as module names so skip the name check.
# pylint: disable=invalid-name
elif microcontroller == "pyboard":
microcontroller = "stm32"
board = "pyboard"
+ elif microcontroller == "linux":
+ from Adafruit_GPIO import Platform
+ if Platform.platform_detect() == Platform.RASPBERRY_PI:
+ if Platform.pi_version() == 1:
+ board = "raspi_1"
+ elif Platform.pi_version() == 2:
+ board = "raspi_2"
+ elif Platform.pi_version() == 3:
+ board = "raspi_3"
implementation = sys.implementation.name
if implementation == "micropython":
from utime import sleep
-elif implementation == "circuitpython":
+elif implementation == "circuitpython" or implementation == "cpython":
from time import sleep
-gc.collect()
--- /dev/null
+# Pins dont exist in CPython so...lets make our own!
+class Pin:
+ def __init__(self, name, bcm_number):
+ self._name = name
+ self._number = bcm_number
+
+SDA = Pin("SDA", 2)
+SCL = Pin("SCL", 3)
+D4 = Pin("BCM 4", 4)
+D17 = Pin("BCM 17", 17)
+D18 = Pin("BCM 18", 18)
+
+# TODO: more here...
from adafruit_blinka.board.nodemcu import *
elif board == "pyboard":
from adafruit_blinka.board.pyboard import *
+elif board == "raspi_2" or board == "raspi_3":
+ from adafruit_blinka.board.raspi_23 import *
elif "sphinx" in sys.modules:
pass
else: