TCA9548A I2C多路复用器的CircuitPython驱动程序。
adafruit-circuitpython-tca9548a的Python项目详细描述
用法示例
# This example shows using two TSL2491 light sensors attached to TCA9548A channels 0 and 1.# Use with other I2C sensors would be similar.importtimeimportboardimportbusioimportadafruit_tsl2591importadafruit_tca9548a# Create I2C bus as normali2c=busio.I2C(board.SCL,board.SDA)# Create the TCA9548A object and give it the I2C bustca=adafruit_tca9548a.TCA9548A(i2c)# For each sensor, create it using the TCA9548A channel instead of the I2C objecttsl1=adafruit_tsl2591.TSL2591(tca[0])tsl2=adafruit_tsl2591.TSL2591(tca[1])# Loop and profit!whileTrue:print(tsl1.lux,tsl2.lux)time.sleep(0.1)
贡献
欢迎投稿!请阅读我们的Code of Conduct 在帮助这个项目保持热情之前。
本地建筑
压缩发布文件
要在本地构建此库,您需要安装 circuitpython-build-tools包装。
python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools
安装后,请确保您处于虚拟环境中:
source .env/bin/activate
然后运行生成:
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-tca9548a --library_location .
斯芬克斯文件
sphinx用于根据代码中的rst文件和注释构建文档。第一, 安装依赖项(请随意重用上面的虚拟环境):
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme
现在,激活虚拟环境后:
cd docs
sphinx-build -E -W -b html . _build/html
这将把文档输出到docs/_build/html。在浏览器中打开index.html以 查看它们。它还将(由于-w)错误的任何警告,像特拉维斯将。这是个很好的方法 本地验证它将通过。