working irl decoding

This commit is contained in:
Joppe Blondel
2026-10-09 14:51:56 +02:00
parent b8c6eaf4c9
commit c84b3fdc97
7 changed files with 352 additions and 70 deletions
+4 -2
View File
@@ -66,8 +66,9 @@ class PulseWriter:
self._level(self.low, self.short_samples)
def marker(self) -> None:
self._level(self.high, 2*self.long_samples)
self._level(self.low, 2*self.long_samples)
for _ in range(4):
self._level(self.high, self.short_samples)
self._level(self.low, self.short_samples)
def bit(self, value: int) -> None:
if value:
@@ -101,6 +102,7 @@ class PulseWriter:
block_data = struct.pack("<B",type) + data[:BLOCK_SIZE].ljust(BLOCK_SIZE, b'\0')
self.bytes(block_data)
self.bytes(struct.pack("<H", crc16(block_data)))
self.byte(0x00) # Make sure the last byte has its last edge
def header(pulses: PulseWriter, path:Path) -> None:
fname = path.name