add BitmapLegacy

This commit is contained in:
Vinzenz Schroeter 2024-05-10 21:27:34 +02:00
parent c7456f0a67
commit 638249c2b9
3 changed files with 11 additions and 1 deletions

View file

@ -26,6 +26,8 @@ pub enum Command {
FadeOut, FadeOut,
CharBrightness(Window, Vec<Brightness>), CharBrightness(Window, Vec<Brightness>),
Brightness(Brightness), Brightness(Brightness),
#[deprecated]
BitmapLegacy,
BitmapLinear(Offset, BitVec), BitmapLinear(Offset, BitVec),
BitmapLinearAnd(Offset, BitVec), BitmapLinearAnd(Offset, BitVec),
BitmapLinearOr(Offset, BitVec), BitmapLinearOr(Offset, BitVec),
@ -53,6 +55,8 @@ impl Into<Packet> for Command {
Command::Clear => command_code_only(CommandCode::Clear), Command::Clear => command_code_only(CommandCode::Clear),
Command::FadeOut => command_code_only(CommandCode::FadeOut), Command::FadeOut => command_code_only(CommandCode::FadeOut),
Command::HardReset => command_code_only(CommandCode::HardReset), Command::HardReset => command_code_only(CommandCode::HardReset),
#[allow(deprecated)]
Command::BitmapLegacy => command_code_only(CommandCode::BitmapLegacy),
Command::CharBrightness(window, payload) => { Command::CharBrightness(window, payload) => {
window_and_payload(CommandCode::CharBrightness, window, payload) window_and_payload(CommandCode::CharBrightness, window, payload)
@ -159,7 +163,10 @@ impl TryFrom<Packet> for Command {
payload.clone(), payload.clone(),
)) ))
} }
CommandCode::BitmapLegacy => { todo!() } #[allow(deprecated)]
CommandCode::BitmapLegacy => {
Ok(Command::BitmapLegacy)
}
CommandCode::BitmapLinear => { todo!() } CommandCode::BitmapLinear => { todo!() }
CommandCode::BitmapLinearWin => { CommandCode::BitmapLinearWin => {
Ok(Command::BitmapLinearWin( Ok(Command::BitmapLinearWin(

View file

@ -10,6 +10,7 @@ pub enum CommandCode {
Brightness = 0x0007, Brightness = 0x0007,
HardReset = 0x000b, HardReset = 0x000b,
FadeOut = 0x000d, FadeOut = 0x000d,
#[deprecated]
BitmapLegacy = 0x0010, BitmapLegacy = 0x0010,
BitmapLinear = 0x0012, BitmapLinear = 0x0012,
BitmapLinearWin = 0x0013, BitmapLinearWin = 0x0013,

View file

@ -1,7 +1,9 @@
#[derive(Debug)]
pub struct Header(pub u16, pub u16, pub u16, pub u16, pub u16); pub struct Header(pub u16, pub u16, pub u16, pub u16, pub u16);
pub type Payload = Vec<u8>; pub type Payload = Vec<u8>;
#[derive(Debug)]
pub struct Packet(pub Header, pub Payload); pub struct Packet(pub Header, pub Payload);
impl Into<Vec<u8>> for Packet { impl Into<Vec<u8>> for Packet {