pyRPiRTC.py 文件源码

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

项目:rpi.rtc 作者: sourceperl 项目源码 文件源码
def _w_byte(self, byte):
        """
        Write byte to the chip.

        :param byte: byte value
        :type byte: int
        """
        # data pin is now output
        GPIO.setup(self._data_pin, GPIO.OUT)
        # clock the byte to chip
        for _ in range(8):
            GPIO.output(self._clk_pin, GPIO.LOW)
            time.sleep(self.CLK_DELAY)
            # chip read data on clk rising edge
            GPIO.output(self._data_pin, byte & 0x01)
            byte >>= 1
            GPIO.output(self._clk_pin, GPIO.HIGH)
            time.sleep(self.CLK_DELAY)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号