mirror of
https://github.com/hubaldv/bioz-icd-rs.git
synced 2025-12-06 05:31:17 +00:00
Included LED RPC.
This commit is contained in:
22
src/lib.rs
22
src/lib.rs
@@ -6,9 +6,6 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
// ---
|
||||
|
||||
pub type SingleLedSetResult = Result<(), BadPositionError>;
|
||||
pub type AllLedArray = [Rgb8; 24];
|
||||
|
||||
endpoints! {
|
||||
list = ENDPOINT_LIST;
|
||||
omit_std = true;
|
||||
@@ -16,8 +13,7 @@ endpoints! {
|
||||
| ---------- | --------- | ---------- | ---- |
|
||||
| PingEndpoint | u32 | u32 | "ping" |
|
||||
| GetUniqueIdEndpoint | () | [u8; 12] | "get_id" |
|
||||
| SetSingleLedEndpoint | SingleLed | SingleLedSetResult | "led/set_one" |
|
||||
| SetAllLedEndpoint | AllLedArray | () | "led/set_all" |
|
||||
| SetGreenLedEndpoint | f32 | () | "led/green" |
|
||||
| StartAccelerationEndpoint | StartAccel | () | "accel/start" |
|
||||
| StopAccelerationEndpoint | () | bool | "accel/stop" |
|
||||
}
|
||||
@@ -37,22 +33,6 @@ topics! {
|
||||
| AccelTopic | Acceleration | "accel/data" | |
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq)]
|
||||
pub struct SingleLed {
|
||||
pub position: u32,
|
||||
pub rgb: Rgb8,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq, Copy, Clone)]
|
||||
pub struct Rgb8 {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq)]
|
||||
pub struct BadPositionError;
|
||||
|
||||
#[derive(Serialize, Deserialize, Schema, Debug, PartialEq)]
|
||||
pub struct Acceleration {
|
||||
pub x: i16,
|
||||
|
||||
Reference in New Issue
Block a user