say ok on login, not x
This commit is contained in:
+6
-4
@@ -1,6 +1,7 @@
|
||||
import struct
|
||||
from driver.protocol import I2CPCClient, time
|
||||
from driver.patches import *
|
||||
import time
|
||||
|
||||
from typing import TypeVar, ParamSpec
|
||||
|
||||
@@ -23,8 +24,8 @@ class BaseTEF668X:
|
||||
self.p.write_i2c(self.address, b"\x1c\x00\x00")
|
||||
self.p.write_i2c(self.address, b"\x1c\x00\x74")
|
||||
def send_patch(_patch: bytes):
|
||||
for i in range(0, len(_patch), 24):
|
||||
data = _patch[i:i+24]
|
||||
for i in range(0, len(_patch), 20):
|
||||
data = _patch[i:i+20]
|
||||
if self.p.write_i2c(self.address, b"\x1b" + data)[0] != 0: raise Exception
|
||||
send_patch(bytes(patch))
|
||||
self.p.write_i2c(self.address, b"\x1c\x00\x00")
|
||||
@@ -35,15 +36,16 @@ class BaseTEF668X:
|
||||
|
||||
def APPL_Get_Operation_Status(self):
|
||||
data = self.p.write_read_i2c(self.address, b"\x40\x80\x01", 2)
|
||||
start = time.monotonic()
|
||||
while data[0] != 0:
|
||||
data = self.p.write_read_i2c(self.address, b"\x40\x80\x01", 2)
|
||||
time.sleep(0.01)
|
||||
if (time.monotonic() - start) > 1: raise TimeoutError("Could not get status")
|
||||
return data[-1]
|
||||
|
||||
def APPL_Set_ReferenceClock(self, clock: int, type_clock: bool):
|
||||
return self.p.write_i2c(self.address, b"\x40\x04\x01" + struct.pack(">IH", clock, type_clock))
|
||||
def APPL_Activate(self):
|
||||
return self.p.write_i2c(self.address, b"\x40\x05\x01\x00\x01")
|
||||
def APPL_Activate(self): return self.p.write_i2c(self.address, b"\x40\x05\x01\x00\x01")
|
||||
|
||||
def init(self, patch = tef_102_patch, patch_lut = tef_102_patch_lut, clock: int = 9216000):
|
||||
self._reset()
|
||||
|
||||
Reference in New Issue
Block a user