Included LED RPC.

This commit is contained in:
2025-08-06 12:48:00 +02:00
parent 7fed5112a1
commit 4512191795
2 changed files with 10 additions and 36 deletions

View File

@@ -5,8 +5,7 @@ use postcard_rpc::{
};
use std::convert::Infallible;
use bioz_icd_rs::{
AccelRange, BadPositionError, PingEndpoint, GetUniqueIdEndpoint, Rgb8, SetAllLedEndpoint,
SetSingleLedEndpoint, SingleLed, StartAccel, StartAccelerationEndpoint,
AccelRange, PingEndpoint, GetUniqueIdEndpoint, SetGreenLedEndpoint, StartAccel, StartAccelerationEndpoint,
StopAccelerationEndpoint,
};
@@ -73,31 +72,11 @@ impl WorkbookClient {
Ok(id)
}
pub async fn set_rgb_single(
pub async fn set_green_led(
&self,
position: u32,
r: u8,
g: u8,
b: u8,
) -> Result<(), WorkbookError<BadPositionError>> {
self.client
.send_resp::<SetSingleLedEndpoint>(&SingleLed {
position,
rgb: Rgb8 { r, g, b },
})
.await?
.flatten()
}
pub async fn set_all_rgb_single(
&self,
r: u8,
g: u8,
b: u8,
frequency: f32,
) -> Result<(), WorkbookError<Infallible>> {
self.client
.send_resp::<SetAllLedEndpoint>(&[Rgb8 { r, g, b }; 24])
.await?;
self.client.send_resp::<SetGreenLedEndpoint>(&frequency).await?;
Ok(())
}