mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-06 05:11:17 +00:00
Included LED RPC.
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user