spi: add helper for getting bootloader ID (#2074)

* spi: add helper for getting bootloader ID

* fix mypy

---------

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Adeeb Shihadeh 2024-11-07 16:55:30 -08:00 committed by GitHub
parent aab03bc4b6
commit ae4f753582
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -397,6 +397,9 @@ class STBootloaderSPIHandle(BaseSTBootloaderHandle):
data = [struct.pack('>I', address), struct.pack('B', length - 1)]
return self._cmd(0x11, data=data, read_bytes=length)
def get_bootloader_id(self):
return self.read(0x1FF1E7FE, 1)
def get_chip_id(self) -> int:
r = self._cmd(0x02, read_bytes=3)
assert r[0] == 1 # response length - 1