adafruit / Adafruit_CircuitPython_TCA9548A

CircuitPython driver for the TCA9548A I2C Multiplexer.
MIT License
26 stars 14 forks source link

Add Mock Library to support development outside RPi #21

Closed codenio closed 3 years ago

codenio commented 3 years ago

Hi, adding a mock package in this same library, would allow people to develop their code outside RPi

I am currently using the following way to mock adafruit_tca9548a outside RPi, and it works.

try:
    import RPi.GPIO as GPIO
    import adafruit_tca9548a
except:
    import Mock.GPIO as GPIO
    import adafruit_tca9548a.mock as adafruit_tca9548a

Thoughts..?

ladyada commented 3 years ago

you should be able to use this package outside of raspberry pi, no need to use RPi.GPIO library at all, blinka handles just about every single board computer

codenio commented 3 years ago

how about ubuntu ? for development in normal computers where you dont have access to single board computers..

ladyada commented 3 years ago

yes blinka works with desktop linux just fine if you have an MCP2221 or FT232H GPIO adapter - you could make a mock device for when there's no hardware at all but that would go into blinka https://learn.adafruit.com/search?q=blinka

codenio commented 3 years ago

in case if is to be added in blinka, then entire RPi needs to be mocked.

FYI, had done this trough VPi, to support developement when there is no hardware available

ladyada commented 3 years ago

that would be a path yes!