ringer.py 文件源码

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

项目:red-phone 作者: mixmasteru 项目源码 文件源码
def checkbutton(self):
        """
        debounced button
        :return:
        """
        ret = 0
        ts = time.time()

        if ts - self._last_check <= 0.05:
            ret = 0
        else:
            state = GPIO.input(self._button)  # Read button state
            if (not self._last_state) and state:
                print("got it")
                ret = 1

            self._last_state = state
            self._last_check = time.time()
        return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号