Working postcard communication.

This commit is contained in:
2025-08-04 19:49:57 +02:00
parent d494cd75aa
commit 8b7d38f338
4 changed files with 65 additions and 9 deletions

59
Cargo.lock generated
View File

@@ -66,14 +66,15 @@ dependencies = [
name = "bioz-host-rs"
version = "0.1.0"
dependencies = [
"bioz-icd",
"bioz-icd-rs",
"defmt",
"postcard-rpc",
"tokio",
"tokio-serial",
]
[[package]]
name = "bioz-icd"
name = "bioz-icd-rs"
version = "0.1.0"
dependencies = [
"postcard-rpc",
@@ -186,6 +187,38 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
[[package]]
name = "defmt"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78"
dependencies = [
"bitflags 1.3.2",
"defmt-macros",
]
[[package]]
name = "defmt-macros"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e"
dependencies = [
"defmt-parser",
"proc-macro-error2",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "defmt-parser"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e"
dependencies = [
"thiserror",
]
[[package]]
name = "embedded-io"
version = "0.4.0"
@@ -677,6 +710,28 @@ dependencies = [
"serde",
]
[[package]]
name = "proc-macro-error-attr2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "proc-macro-error2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
dependencies = [
"proc-macro-error-attr2",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "proc-macro2"
version = "1.0.95"

View File

@@ -4,13 +4,14 @@ version = "0.1.0"
edition = "2024"
[dependencies]
defmt = { version = "1.0.1" }
[dependencies.bioz-icd]
[dependencies.bioz-icd-rs]
path = "../bioz-icd-rs"
features = ["use-std"]
[dependencies.postcard-rpc]
version = "0.11"
version = "0.11.13"
features = [
"use-std",
"raw-nusb",

View File

@@ -1,11 +1,11 @@
use postcard_rpc::{
header::VarSeqKind,
host_client::{HostClient, HostErr},
standard_icd::{PingEndpoint, WireError, ERROR_PATH},
standard_icd::{WireError, ERROR_PATH},
};
use std::convert::Infallible;
use bioz_icd::{
AccelRange, BadPositionError, GetUniqueIdEndpoint, Rgb8, SetAllLedEndpoint,
use bioz_icd_rs::{
AccelRange, BadPositionError, PingEndpoint, GetUniqueIdEndpoint, Rgb8, SetAllLedEndpoint,
SetSingleLedEndpoint, SingleLed, StartAccel, StartAccelerationEndpoint,
StopAccelerationEndpoint,
};
@@ -46,7 +46,7 @@ impl<T, E> FlattenErr for Result<T, E> {
impl WorkbookClient {
pub fn new() -> Self {
let client = HostClient::new_raw_nusb(
|d| d.product_string() == Some("bioz-amplifier"),
|d| d.product_string() == Some("Bioz Amplifier"),
ERROR_PATH,
8,
VarSeqKind::Seq2,

View File

@@ -1,7 +1,7 @@
#![deny(missing_debug_implementations)]
pub mod client;
pub use bioz_icd as icd;
pub use bioz_icd_rs as icd;
pub async fn read_line() -> String {
tokio::task::spawn_blocking(|| {