From cc9b8c04ce6336d2c9b9a69d15c7f1ac88f0a62f Mon Sep 17 00:00:00 2001 From: Hubald Verzijl Date: Wed, 6 Aug 2025 15:45:29 +0200 Subject: [PATCH] Included impedance topic. --- src/lib.rs | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0f8679a..ec42a07 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,13 +9,13 @@ use serde::{Deserialize, Serialize}; endpoints! { list = ENDPOINT_LIST; omit_std = true; - | EndpointTy | RequestTy | ResponseTy | Path | - | ---------- | --------- | ---------- | ---- | - | PingEndpoint | u32 | u32 | "ping" | - | GetUniqueIdEndpoint | () | [u8; 12] | "get_id" | - | SetGreenLedEndpoint | f32 | () | "led/green" | - | StartAccelerationEndpoint | StartAccel | () | "accel/start" | - | StopAccelerationEndpoint | () | bool | "accel/stop" | + | EndpointTy | RequestTy | ResponseTy | Path | + | ---------- | --------- | ---------- | ---- | + | PingEndpoint | u32 | u32 | "ping" | + | GetUniqueIdEndpoint | () | [u8; 12] | "get_id" | + | SetGreenLedEndpoint | f32 | () | "led/green" | + | StartImpedanceEndpoint | StartImpedance | () | "imp/start" | + | StopImpedanceEndpoint | () | bool | "imp/stop" | } topics! { @@ -30,26 +30,16 @@ topics! { direction = TopicDirection::ToClient; | TopicTy | MessageTy | Path | Cfg | | ------- | --------- | ---- | --- | - | AccelTopic | Acceleration | "accel/data" | | + | ImpedanceTopic | Impedance | "imp/data" | | } #[derive(Serialize, Deserialize, Schema, Debug, PartialEq)] -pub struct Acceleration { - pub x: i16, - pub y: i16, - pub z: i16, +pub struct Impedance { + pub magnitude: f32, + pub phase: f32, } #[derive(Serialize, Deserialize, Schema, Debug, PartialEq)] -pub enum AccelRange { - G2, - G4, - G8, - G16, -} - -#[derive(Serialize, Deserialize, Schema, Debug, PartialEq)] -pub struct StartAccel { +pub struct StartImpedance { pub interval_ms: u32, - pub range: AccelRange, }