mirror of
https://github.com/hubaldv/bioz-firmware-rs.git
synced 2025-12-05 20:51:17 +00:00
Implemented postcard-rpc.
This commit is contained in:
@@ -5,4 +5,4 @@ runner = 'probe-rs run --chip STM32H533RE'
|
||||
target = "thumbv8m.main-none-eabihf"
|
||||
|
||||
[env]
|
||||
DEFMT_LOG = "trace"
|
||||
DEFMT_LOG = "info"
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"rust-analyzer.cargo.target": "thumbv8m.main-none-eabihf",
|
||||
"rust-analyzer.checkOnSave.allTargets": false
|
||||
"rust-analyzer.checkOnSave.allTargets": false,
|
||||
// "editor.formatOnSave": true
|
||||
"rust-analyzer.diagnostics.disabled": [
|
||||
"trait-impl-incorrect-safety"
|
||||
]
|
||||
}
|
||||
386
Cargo.lock
generated
386
Cargo.lock
generated
@@ -2,6 +2,18 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.4.2"
|
||||
@@ -20,6 +32,15 @@ dependencies = [
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-polyfill"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.0"
|
||||
@@ -32,28 +53,41 @@ version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
|
||||
dependencies = [
|
||||
"rustc_version",
|
||||
"rustc_version 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bioz-firmware-rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bioz-icd",
|
||||
"bitflags 2.9.1",
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"defmt 1.0.1",
|
||||
"defmt-rtt",
|
||||
"embassy-embedded-hal",
|
||||
"embassy-embedded-hal 0.4.0",
|
||||
"embassy-executor",
|
||||
"embassy-futures",
|
||||
"embassy-stm32",
|
||||
"embassy-sync 0.7.0",
|
||||
"embassy-sync 0.6.2",
|
||||
"embassy-time",
|
||||
"embassy-usb",
|
||||
"embedded-hal 1.0.0",
|
||||
"panic-probe",
|
||||
"postcard-rpc",
|
||||
"static_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bioz-icd"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"postcard-rpc",
|
||||
"postcard-schema",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit_field"
|
||||
version = "0.10.2"
|
||||
@@ -66,6 +100,12 @@ version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
|
||||
|
||||
[[package]]
|
||||
name = "bitfield"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
@@ -99,6 +139,15 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||
|
||||
[[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"
|
||||
@@ -106,7 +155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
|
||||
dependencies = [
|
||||
"bare-metal",
|
||||
"bitfield",
|
||||
"bitfield 0.13.2",
|
||||
"critical-section",
|
||||
"embedded-hal 0.2.7",
|
||||
"volatile-register",
|
||||
@@ -129,7 +178,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -159,7 +208,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -170,7 +219,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -202,7 +251,7 @@ dependencies = [
|
||||
"proc-macro-error2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -252,6 +301,24 @@ dependencies = [
|
||||
"nb 1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-embedded-hal"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1611b7a7ab5d1fbed84c338df26d56fd9bded58006ebb029075112ed2c5e039"
|
||||
dependencies = [
|
||||
"defmt 1.0.1",
|
||||
"embassy-futures",
|
||||
"embassy-hal-internal 0.3.0",
|
||||
"embassy-sync 0.7.0",
|
||||
"embedded-hal 0.2.7",
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"embedded-storage",
|
||||
"embedded-storage-async",
|
||||
"nb 1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-executor"
|
||||
version = "0.7.0"
|
||||
@@ -274,7 +341,7 @@ dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -313,6 +380,17 @@ dependencies = [
|
||||
"defmt 0.3.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net-driver-channel"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25a567ab50319d866ad5e6c583ed665ba9b07865389644d3d82e45bf1497c934"
|
||||
dependencies = [
|
||||
"embassy-futures",
|
||||
"embassy-net-driver",
|
||||
"embassy-sync 0.7.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-stm32"
|
||||
version = "0.2.0"
|
||||
@@ -329,7 +407,7 @@ dependencies = [
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"document-features",
|
||||
"embassy-embedded-hal",
|
||||
"embassy-embedded-hal 0.3.1",
|
||||
"embassy-executor",
|
||||
"embassy-futures",
|
||||
"embassy-hal-internal 0.2.0",
|
||||
@@ -374,7 +452,7 @@ dependencies = [
|
||||
"embedded-io-async",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"heapless",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -385,11 +463,10 @@ checksum = "cef1a8a1ea892f9b656de0295532ac5d8067e9830d49ec75076291fd6066b136"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"defmt 1.0.1",
|
||||
"embedded-io-async",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"heapless",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -425,7 +502,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83"
|
||||
dependencies = [
|
||||
"embassy-executor",
|
||||
"heapless",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-usb"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"embassy-futures",
|
||||
"embassy-net-driver-channel",
|
||||
"embassy-sync 0.6.2",
|
||||
"embassy-usb-driver",
|
||||
"heapless 0.8.0",
|
||||
"ssmarshal",
|
||||
"usbd-hid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -527,6 +620,12 @@ dependencies = [
|
||||
"embedded-storage",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
@@ -563,6 +662,15 @@ dependencies = [
|
||||
"pin-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.3.1"
|
||||
@@ -572,13 +680,36 @@ dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.7.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"
|
||||
dependencies = [
|
||||
"atomic-polyfill",
|
||||
"hash32 0.2.1",
|
||||
"rustc_version 0.4.1",
|
||||
"serde",
|
||||
"spin",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||
dependencies = [
|
||||
"hash32",
|
||||
"hash32 0.3.1",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
@@ -594,6 +725,22 @@ version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "nb"
|
||||
version = "0.1.3"
|
||||
@@ -618,6 +765,12 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "panic-probe"
|
||||
version = "1.0.0"
|
||||
@@ -646,6 +799,59 @@ version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||
|
||||
[[package]]
|
||||
name = "postcard"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24"
|
||||
dependencies = [
|
||||
"cobs",
|
||||
"heapless 0.7.17",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "postcard-derive"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0232bd009a197ceec9cc881ba46f727fcd8060a2d8d6a9dde7a69030a6fe2bb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "postcard-rpc"
|
||||
version = "0.11.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d9107507c90cce8c36e4086f5b15cbee0148126359e81b4ccec5f47b5124893"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"embassy-executor",
|
||||
"embassy-futures",
|
||||
"embassy-sync 0.6.2",
|
||||
"embassy-time",
|
||||
"embassy-usb",
|
||||
"embassy-usb-driver",
|
||||
"heapless 0.8.0",
|
||||
"portable-atomic",
|
||||
"postcard",
|
||||
"postcard-schema",
|
||||
"serde",
|
||||
"static_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "postcard-schema"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5a13d8b1f8b3473b45c2c779b97c18c260ac6458eb045d4be75df8087784400"
|
||||
dependencies = [
|
||||
"postcard-derive",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr2"
|
||||
version = "2.0.0"
|
||||
@@ -665,7 +871,7 @@ dependencies = [
|
||||
"proc-macro-error-attr2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -698,9 +904,24 @@ version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
dependencies = [
|
||||
"semver",
|
||||
"semver 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver 1.0.26",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sdio-host"
|
||||
version = "0.5.0"
|
||||
@@ -716,12 +937,57 @@ dependencies = [
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.219"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.219"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ssmarshal"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
@@ -768,6 +1034,17 @@ version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
@@ -796,7 +1073,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -805,12 +1082,65 @@ version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||
|
||||
[[package]]
|
||||
name = "usb-device"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
|
||||
dependencies = [
|
||||
"heapless 0.8.0",
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usbd-hid"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"ssmarshal",
|
||||
"usb-device",
|
||||
"usbd-hid-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usbd-hid-descriptors"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed"
|
||||
dependencies = [
|
||||
"bitfield 0.14.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usbd-hid-macros"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"hashbrown",
|
||||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"syn 1.0.109",
|
||||
"usbd-hid-descriptors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcell"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
@@ -825,3 +1155,23 @@ checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc"
|
||||
dependencies = [
|
||||
"vcell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
15
Cargo.toml
15
Cargo.toml
@@ -6,21 +6,24 @@ edition = "2021"
|
||||
[dependencies]
|
||||
# Change stm32h563zi to your chip name, if necessary.
|
||||
embassy-stm32 = { version = "0.2.0", features = ["defmt", "stm32h533re", "memory-x", "time-driver-any", "exti", "unstable-pac", "low-power"] }
|
||||
embassy-sync = { version = "0.7.0", features = ["defmt"] }
|
||||
embassy-sync = { version = "0.6.0", features = ["defmt"] }
|
||||
embassy-executor = { version = "0.7.0", features = ["arch-cortex-m", "executor-thread", "defmt"] }
|
||||
embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
|
||||
embassy-embedded-hal = { version = "0.3.1", features = ["defmt"] }
|
||||
embassy-embedded-hal = { version = "0.4.0", features = ["defmt"]}
|
||||
# embassy-net = { version = "0.7.0", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "proto-ipv6"] }
|
||||
# embassy-usb = { version = "0.4.0", features = ["defmt"] }
|
||||
# embassy-futures = { version = "0.1.0"}
|
||||
embassy-usb = { version = "0.4.0", features = ["defmt"] }
|
||||
embassy-futures = { version = "0.1.0"}
|
||||
|
||||
defmt = "1.0.1"
|
||||
defmt-rtt = "1.0.0"
|
||||
|
||||
bitflags = "2.9.1"
|
||||
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
postcard-rpc = {version = "0.11.12", features = ["embassy-usb-0_4-server", "defmt"]}
|
||||
bioz-icd = {path = "../bioz-icd-rs"}
|
||||
|
||||
cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.5"
|
||||
# embedded-hal = "0.2.6"
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
|
||||
# embedded-hal-async = { version = "1.0" }
|
||||
|
||||
125
src/communication.rs
Normal file
125
src/communication.rs
Normal file
@@ -0,0 +1,125 @@
|
||||
use defmt::{info, error};
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||
use embassy_stm32::usb::Driver;
|
||||
use embassy_stm32::{peripherals, usb};
|
||||
|
||||
use postcard_rpc::{
|
||||
define_dispatch,
|
||||
header::VarHeader,
|
||||
server::{
|
||||
impls::embassy_usb_v0_4::{
|
||||
dispatch_impl::{WireRxBuf, WireRxImpl, WireSpawnImpl, WireStorage, WireTxImpl},
|
||||
PacketBuffers,
|
||||
},
|
||||
Dispatch, Server,
|
||||
},
|
||||
};
|
||||
|
||||
use bioz_icd::{PingEndpoint, GetUniqueIdEndpoint, ENDPOINT_LIST, TOPICS_IN_LIST, TOPICS_OUT_LIST};
|
||||
|
||||
pub struct Context;
|
||||
|
||||
type AppDriver = usb::Driver<'static, peripherals::USB>;
|
||||
type AppStorage = WireStorage<ThreadModeRawMutex, AppDriver, 256, 256, 64, 256>;
|
||||
type BufStorage = PacketBuffers<1024, 1024>;
|
||||
type AppTx = WireTxImpl<ThreadModeRawMutex, AppDriver>;
|
||||
type AppRx = WireRxImpl<AppDriver>;
|
||||
type AppServer = Server<AppTx, AppRx, WireRxBuf, MyApp>;
|
||||
|
||||
use static_cell::ConstStaticCell;
|
||||
static PBUFS: ConstStaticCell<BufStorage> = ConstStaticCell::new(BufStorage::new());
|
||||
static STORAGE: AppStorage = AppStorage::new();
|
||||
|
||||
define_dispatch! {
|
||||
app: MyApp;
|
||||
spawn_fn: spawn_fn;
|
||||
tx_impl: AppTx;
|
||||
spawn_impl: WireSpawnImpl;
|
||||
context: Context;
|
||||
|
||||
endpoints: {
|
||||
list: ENDPOINT_LIST;
|
||||
|
||||
| EndpointTy | kind | handler |
|
||||
| ---------- | ---- | ------- |
|
||||
| PingEndpoint | blocking | ping_handler |
|
||||
| GetUniqueIdEndpoint | blocking | get_unique_id_handler |
|
||||
};
|
||||
topics_in: {
|
||||
list: TOPICS_IN_LIST;
|
||||
|
||||
| TopicTy | kind | handler |
|
||||
| ---------- | ---- | ------- |
|
||||
};
|
||||
topics_out: {
|
||||
list: TOPICS_OUT_LIST;
|
||||
};
|
||||
}
|
||||
|
||||
fn usb_config() -> embassy_usb::Config<'static> {
|
||||
let mut config = embassy_usb::Config::new(0x16c0, 0x27DD);
|
||||
config.manufacturer = Some("Hubald Verzijl");
|
||||
config.product = Some("bioz-amplifier");
|
||||
config.serial_number = Some("12345678");
|
||||
|
||||
// Required for windows compatibility.
|
||||
// https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help
|
||||
config.device_class = 0xEF;
|
||||
config.device_sub_class = 0x02;
|
||||
config.device_protocol = 0x01;
|
||||
config.composite_with_iads = true;
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
/// This handles the low level USB management
|
||||
#[embassy_executor::task]
|
||||
pub async fn usb_task(mut usb: embassy_usb::UsbDevice<'static, AppDriver>) {
|
||||
usb.run().await;
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn server_run(mut server: AppServer) {
|
||||
loop {
|
||||
// If the host disconnects, we'll return an error here.
|
||||
// If this happens, just wait until the host reconnects
|
||||
let _ = server.run().await;
|
||||
}
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
pub fn init_communication(usb_driver: Driver<'static, peripherals::USB>, spawner: Spawner) {
|
||||
// Initialize communication peripherals
|
||||
let pbufs = PBUFS.take();
|
||||
let config = usb_config();
|
||||
|
||||
let context = Context;
|
||||
let (device, tx_impl, rx_impl) = STORAGE.init(usb_driver, config, pbufs.tx_buf.as_mut_slice());
|
||||
let dispatcher = MyApp::new(context, spawner.into());
|
||||
let vkk = dispatcher.min_key_len();
|
||||
let server: AppServer = Server::new(
|
||||
tx_impl,
|
||||
rx_impl,
|
||||
pbufs.rx_buf.as_mut_slice(),
|
||||
dispatcher,
|
||||
vkk,
|
||||
);
|
||||
spawner.must_spawn(usb_task(device));
|
||||
spawner.must_spawn(server_run(server));
|
||||
}
|
||||
|
||||
fn ping_handler(_context: &mut Context, _header: VarHeader, rqst: u32) -> u32 {
|
||||
info!("ping");
|
||||
rqst
|
||||
}
|
||||
|
||||
fn get_unique_id_handler(_context: &mut Context, _header: VarHeader, _rqst: ()) -> u64 {
|
||||
error!("get_unique_id");
|
||||
200
|
||||
}
|
||||
|
||||
|
||||
|
||||
40
src/main.rs
40
src/main.rs
@@ -1,7 +1,7 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use defmt::*;
|
||||
use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::{i2c, spi, Config};
|
||||
@@ -11,19 +11,29 @@ use crate::ad5940_registers::{AFECON, AFEGENINTSTA};
|
||||
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
mod ad5940;
|
||||
use ad5940::AD5940;
|
||||
// mod ad5940;
|
||||
// use ad5940::AD5940;
|
||||
|
||||
mod adg2128;
|
||||
use adg2128::State;
|
||||
// mod adg2128;
|
||||
// use adg2128::State;
|
||||
|
||||
mod electrodes;
|
||||
use electrodes::{Electrodes, Electrode, AD5940Pin};
|
||||
// mod electrodes;
|
||||
// use electrodes::{Electrodes, Electrode, AD5940Pin};
|
||||
|
||||
mod ad5940_registers;
|
||||
|
||||
use embassy_stm32::usb::Driver;
|
||||
use embassy_stm32::{bind_interrupts, peripherals, usb};
|
||||
|
||||
mod communication;
|
||||
use communication::init_communication;
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
USB_DRD_FS => usb::InterruptHandler<peripherals::USB>;
|
||||
});
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
async fn main(spawner: Spawner) {
|
||||
|
||||
let mut config = Config::default();
|
||||
{
|
||||
@@ -49,7 +59,7 @@ async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(config);
|
||||
info!("Hello World!");
|
||||
|
||||
// let mut led = Output::new(p.PA5, Level::High, Speed::Low);
|
||||
let mut led = Output::new(p.PA5, Level::High, Speed::Low);
|
||||
|
||||
// // Set up SPI for AD5940
|
||||
// let cs = Output::new(p.PC9, Level::High, Speed::Low);
|
||||
@@ -108,6 +118,10 @@ async fn main(_spawner: Spawner) {
|
||||
// ad5940.sequencer_info_configure(0, ad5940.seq_len, start_address).await;
|
||||
// info!("{}", ad5940.seq_len);
|
||||
|
||||
// Create USB driver and start postcard-rpc server
|
||||
let driver = Driver::new(p.USB, Irqs, p.PA12, p.PA11);
|
||||
init_communication(driver, spawner);
|
||||
|
||||
loop {
|
||||
// Read chip id
|
||||
// let chip_id = ad5940.get_chipid().await.unwrap();
|
||||
@@ -121,10 +135,16 @@ async fn main(_spawner: Spawner) {
|
||||
// info!("Electrodes states: {:?}", result);
|
||||
|
||||
// info!("high");
|
||||
// led.set_high();
|
||||
led.set_high();
|
||||
|
||||
Timer::after_millis(1000).await;
|
||||
|
||||
led.set_low();
|
||||
|
||||
Timer::after_millis(1000).await;
|
||||
|
||||
info!("Toggle!");
|
||||
|
||||
// ad5940.sequencer_trigger().await;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user