Compare commits

...

1 Commits

Author SHA1 Message Date
Pim van den Berg 8e5a1b6434 WIP: add getconfig support 2023-06-05 21:35:34 +02:00
2 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,7 @@ actions = {
"getserial": [0x90, 0xE1],
"getdatatype": [0xA4, 0x00],
"getdatalog": [0xA4, 0x01],
"getconfig": [0xC0, 0x30],
}

View File

@ -12,6 +12,7 @@ actions = {
"getserial": [0x90, 0xE1],
"getdatatype": [0xA4, 0x00],
"getdatalog": [0xA4, 0x01],
"getconfig": [0xC0, 0x30],
}
@ -46,8 +47,11 @@ class I2CMaster:
self.queue = queue
def compose_request(self, action):
# 0x80 = source, 0x04 = msg_type, 0x00 = length
request = [0x80] + actions[action] + [0x04, 0x00]
if action == "getconfig":
request = [0x80] + actions[action] + [0x04, 0x04, 0x00, 0x00, 0x00, 0x0C]
else:
# 0x80 = source, 0x04 = msg_type, 0x00 = length
request = [0x80] + actions[action] + [0x04, 0x00]
request.append(self.calculate_checksum(request))
return request