def __init__(self, hid):
self.file = open(hid, 'rb+', buffering=0)
fcntl.lockf(self.file, fcntl.LOCK_EX)
flag = fcntl.fcntl(self.file, fcntl.F_GETFL)
fcntl.fcntl(self.file, fcntl.F_SETFL, flag | os.O_NONBLOCK)
# Clock 48 MHz
fcntl.ioctl(self.file, 0xC0054806, bytes([0xA1, 0x01, 0x02]))
# No flow control mode
fcntl.ioctl(self.file, 0xC0054806, bytes([0xA1, 0x03, 0x04]))
self.gpio = [0x00, 0x00]
self.read_buffer = []
self._write_gpio()
评论列表
文章目录