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)
评论列表
文章目录