MicroPython support added back in (an unofficial library feature) #18
2bndy5
started this conversation in
Show and tell
Replies: 2 comments 7 replies
-
I'm also currently working on getting the above wrapper implementation integrated into this |
Beta Was this translation helpful? Give feedback.
1 reply
-
So, it's just lacking the shims only ? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Above is the import statement from the
rf24.py
file (as of v1.2.0 release). First it looks for a module namedubus_device
which contains a class namedSPIDevice
, then falls back to looking for the widely availableadafruit_bus_device.spi_device
module. Thisubus_device
file is not located in this library's releases as it is an adapted version of the CircuitPython dependencyadafruit_bus_device.spi_device
containing the original code written by "Scott Shawcroft for Adafruit Industries" (both files share a MIT license).The necessary files needed to make this library work on MicroPython are located in my separate repository called CircuitPython_2_Micropython. These files are:
ubus_device
This is a substitute foradafruit_bus_device.spi_device
that wraps MicroPython'smachine.SPI
class into a context manager compatible module.udigitalio
This file contains a class namedDigitalInOut
. This file is meant to be a substitute for CircuitPython'sdigitalio
module and wraps MicroPython'smachine.Pin
class into an interface compatible withdigitalio.DigitalInOut
class. This file isn't directly imported byrf24.py
, but it is needed to declare the nRF24L01's CE & CSN pins' objects that are passed to theRF24
constructor.These files were tested on a tinypico (ESP32) with
rf24.py
,ubus_device.py
, &udigitalio.py
all located at the filesystem's root directory. I should mention that theudigitalio.py
file is not compatible with the ESP8266 platform running MicroPython due to differences in the pull up/down resistors available (tested on a nodeMCU board). The following snippet demonstrates how to use the above listed files (located at root directory of the platform's file system) in MicroPython:Beta Was this translation helpful? Give feedback.
All reactions