SPI: send hw type with version (#1490)

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Adeeb Shihadeh 2023-07-02 23:50:30 -07:00 committed by GitHub
parent abcbfb44b4
commit d693e89df2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -95,6 +95,10 @@ void spi_rx_done(void) {
#endif
data_len += 12U;
// HW type
spi_buf_tx[data_pos + data_len] = hw_type;
data_len += 1U;
// SPI protocol version
spi_buf_tx[data_pos + data_len] = 0x1;
data_len += 1U;

View File

@ -21,10 +21,13 @@ class TestSpi:
def test_protocol_version(self, p):
v = p._handle.get_protocol_version()
uid = binascii.hexlify(v[:-1]).decode()
uid = binascii.hexlify(v[:12]).decode()
assert uid == p.get_uid()
assert v[-1:] == b"\x01"
hwtype = v[12]
assert hwtype == ord(p.get_type())
assert v[-1] == 1
def test_all_comm_types(self, mocker, p):
spy = mocker.spy(p._handle, '_wait_for_ack')