fn write_error<HalError>(
tx_buf: &mut [u8],
err: &CryptoServiceError<HalError>,
) -> usizewhere
HalError: Debug,Expand description
Map a [CryptoServiceError] into a status + payload and write it.
Driver-level failures are split into two cases:
- [
AteccErrorKind::Chip]: the chip itself returned a non-zero status byte. Surface that as [ResponseStatus::AteccChipError] (0x05) with the raw chip status byte inpayload[0]. Lets the host translate toParseError,ExecutionError, etc., for triage. - Anything else (HAL nack, wake failure, CRC mismatch, timeout, …):
surface as [
ResponseStatus::AteccCommunicationError] (0x04) with a one-byte sub-code inpayload[0]derived from [AteccErrorKind::as_sub_code].