pub fn encode_counter_value(value: u32) -> [u8; 8]Expand description
Encode a target counter value into the 8-byte storage representation the ATECC608B expects in the configuration zone.
value == 0 produces the factory initialization, the canonical
“fresh chip” state. Any value in 0..=COUNTER_MAX_VALUE is accepted
and produces a valid storage; values above are clamped to
COUNTER_MAX_VALUE because the chip cannot represent more.
Mirrors calib_write_config_counter from CryptoAuthLib exactly. The
[u8; 8] returned is what gets written to bytes 52..60 (Counter0)
or 60..68 (Counter1) of the configuration zone blob.
§Examples
ⓘ
// Factory init: count = 0 → FF FF FF FF 00 00 00 00.
assert_eq!(encode_counter_value(0), [0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0]);