lp-dp 2023-08-02T01:57:46 for EON/C2

version: lp-dp v0.9.4 for EON/C2
date: 2023-08-02T01:57:46
commit: 63c51d4b134e443b1ffa59dfe0fc2d50d5e0f446
This commit is contained in:
Vehicle Researcher
2023-08-02 01:56:06 +00:00
parent 0ffb1567bc
commit 9ca1ac0042
250 changed files with 7113 additions and 3599 deletions

12
panda/python/utils.py Normal file
View File

@@ -0,0 +1,12 @@
def crc8_pedal(data):
crc = 0xFF # standard init value
poly = 0xD5 # standard crc8: x8+x7+x6+x4+x2+1
size = len(data)
for i in range(size - 1, -1, -1):
crc ^= data[i]
for _ in range(8):
if ((crc & 0x80) != 0):
crc = ((crc << 1) ^ poly) & 0xFF
else:
crc <<= 1
return crc