ads111x.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:PyCNC 作者: Nikolay-Kha 项目源码 文件源码
def __init__(self):
        self._os_close = os.close
        # Initialize i2c interface and register it for closing on exit.
        self._dev = os.open("/dev/i2c-1", os.O_SYNC | os.O_RDWR)
        if self._dev < 0:
            raise ImportError("i2c device not found")
        else:
            if fcntl.ioctl(self._dev, I2C_SLAVE, ADS111x_ADDRESS) < 0:
                self._close()
                raise ImportError("Failed to set up i2c address")
            else:
                atexit.register(self._close)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号