From 638249c2b94298f359fc4c3fb9792033510ad214 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Fri, 10 May 2024 21:27:34 +0200 Subject: [PATCH] add BitmapLegacy --- src/command.rs | 9 ++++++++- src/command_codes.rs | 1 + src/packet.rs | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/command.rs b/src/command.rs index b1c9318..6492577 100644 --- a/src/command.rs +++ b/src/command.rs @@ -26,6 +26,8 @@ pub enum Command { FadeOut, CharBrightness(Window, Vec), Brightness(Brightness), + #[deprecated] + BitmapLegacy, BitmapLinear(Offset, BitVec), BitmapLinearAnd(Offset, BitVec), BitmapLinearOr(Offset, BitVec), @@ -53,6 +55,8 @@ impl Into for Command { Command::Clear => command_code_only(CommandCode::Clear), Command::FadeOut => command_code_only(CommandCode::FadeOut), Command::HardReset => command_code_only(CommandCode::HardReset), + #[allow(deprecated)] + Command::BitmapLegacy => command_code_only(CommandCode::BitmapLegacy), Command::CharBrightness(window, payload) => { window_and_payload(CommandCode::CharBrightness, window, payload) @@ -159,7 +163,10 @@ impl TryFrom for Command { payload.clone(), )) } - CommandCode::BitmapLegacy => { todo!() } + #[allow(deprecated)] + CommandCode::BitmapLegacy => { + Ok(Command::BitmapLegacy) + } CommandCode::BitmapLinear => { todo!() } CommandCode::BitmapLinearWin => { Ok(Command::BitmapLinearWin( diff --git a/src/command_codes.rs b/src/command_codes.rs index 8847bec..c8c16c5 100644 --- a/src/command_codes.rs +++ b/src/command_codes.rs @@ -10,6 +10,7 @@ pub enum CommandCode { Brightness = 0x0007, HardReset = 0x000b, FadeOut = 0x000d, + #[deprecated] BitmapLegacy = 0x0010, BitmapLinear = 0x0012, BitmapLinearWin = 0x0013, diff --git a/src/packet.rs b/src/packet.rs index a3ba5f2..5bda2c2 100644 --- a/src/packet.rs +++ b/src/packet.rs @@ -1,7 +1,9 @@ +#[derive(Debug)] pub struct Header(pub u16, pub u16, pub u16, pub u16, pub u16); pub type Payload = Vec; +#[derive(Debug)] pub struct Packet(pub Header, pub Payload); impl Into> for Packet {