feat: donglora-cobs workspace crate with 31 spec-compliance tests

Extract COBS encoder/decoder into a separate no_std workspace crate
(crates/donglora-cobs) with comprehensive tests against the Cheshire &
Baker 1999 IEEE/ACM specification and Wikipedia canonical vectors.

Tests cover: empty input, single/multiple zeros, block boundaries at
254/255 bytes, alternating patterns, the Ping regression case (tag 0x00),
round-trip verification, and error cases (truncation, unexpected zeros).

Replace inline cobs_decode() in usb/task.rs with the tested crate.
Replace external cobs dependency with workspace crate.
Fix encoder bug at 254-byte block boundary (spurious trailing code byte).
This commit is contained in:
swaits committed 2026-03-29 21:33:08 -06:00
1 parent ee71bb69d3
commit 65c43cda23
5 files changed
+542 -40

No files matched your search

Generated
+5 -10
View File
@@ -119,15 +119,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "cobs"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
dependencies = [
"thiserror",
]
[[package]]
name = "cortex-m"
version = "0.7.7"
@@ -336,11 +327,11 @@ name = "donglora"
version = "0.1.0"
dependencies = [
"cfg-if",
"cobs",
"cortex-m-rt",
"critical-section",
"defmt 0.3.100",
"display-interface",
"donglora-cobs",
"embassy-embedded-hal",
"embassy-executor",
"embassy-futures",
@@ -364,6 +355,10 @@ dependencies = [
"static_cell",
]
[[package]]
name = "donglora-cobs"
version = "0.1.0"
[[package]]
name = "embassy-embedded-hal"
version = "0.2.0"