Closed microbit-carlos closed 1 year ago
Some functions in the CODAL to change the I2C pins would be good. Then it would be similar to SPI.
Created this for I2C:
Some functions in the CODAL to change the I2C pins would be good. Then it would be similar to SPI.
Does CODAL offer a way to change the SPI pins after the object has been created?
Does MicroPython need the SPI classes to be updated as well?
Does MicroPython need the SPI classes to be updated as well?
Ah, okay, just saw the response in https://github.com/microbit-foundation/micropython-microbit-v2/issues/111#issuecomment-1231058017, and based on that I've updated the ticket https://github.com/lancaster-university/codal-microbit-v2/issues/226 to include SPI as well as I2C.
The CODAL changes required spawn several repos and files, so to reduce risk for the v2.1.0 final release we'll do this for v2.2.
CODAL has been updated with the redirect()
methods and this can be implemented using the latest tag (0.2.48 at the time of writing).
CODAL was updated to 0.2.48 and i2c.init()
pin change implemented in ee7574116b627bb53bfcab0b19a507b525507951
I noticed a bug though: if you try to redirect to pins that are already claimed by I2C then it locks up. Eg:
i2c.init(100000, pin0, pin1) # works fine
i2c.init(100000, pin1, pin0) # locks up if the previous line is run first
I suspect that's a bug in CODAL but did not get to the bottom of it.
Thanks Damien, I've opened this issue in the CODAL repo:
Thanks @dpgeorge @microbit-carlos - indeed, precisely as you say. I can reproduce too.
This should now be fixed in the CODAL master branch, pending next release: https://github.com/lancaster-university/codal-microbit-v2/issues/272
Please let me know if you notice this or any other similar issues.
This has been fixed in the CODAL v0.2.50 tag
CODAL is updated to v0.2.51. I tested the above i2c.init()
code and it now works.
https://github.com/microbit-foundation/micropython-microbit-v2/blob/f3db1e6215cd747e8a09f80cb7c35cf9d8f9cad5/src/codal_app/microbithal.cpp#L205-L212
@dpgeorge if this is something that needs implementing in CODAL let me know, or feel free to open an issue in https://github.com/lancaster-university/codal-microbit-v2/issues