Skip to content

Commit b9fad2d

Browse files
committed
WIP
1 parent 5ebcf73 commit b9fad2d

7 files changed

Lines changed: 1541 additions & 47 deletions

File tree

protocol/SPECIFICATION

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,20 @@
337337
[0..100]
338338
0x0006 uint16be Color Count
339339
[1..3]
340-
0x0008 uint16[3] Color Thresholds
340+
0x0008 uint16be[3] Color Thresholds
341341
Sensor Value
342342
0x000E uint16be Peak Hold Time
343343
[0..100]
344344
Effect Specific Flags:
345-
0x01 Fade Ranges
346-
0x02 Show Bar
347-
0x04 Show Ranges
348-
0x08 Reverse Direction
349-
0x20 Show Peak Value
345+
0x0001 Fade Ranges
346+
0x0002 Show Bar
347+
0x0004 Show Ranges
348+
0x0008 Reverse Direction
349+
0x0020 Show Peak Value
350+
0x0080 Start Color Blink
351+
0x0100 Color 0 Blink
352+
0x0200 Color 1 Blink
353+
0x0400 Color 2 Blink
350354
14 Flame
351355
Color 0: Background
352356
Color 1: Color 1
@@ -490,10 +494,10 @@
490494
0x07 <Constant>
491495
0x08 Reverse Direction
492496
0x10 Reverse Rotation
493-
0x0003 uint8 Flags
494-
0x40 - Enable Source Control 0
495-
0x80 - Enable Source Control 1
496-
0x0004 uint8 Effect Specific Flags
497+
0x0003 uint16be Flags
498+
<Effect Specific Flags>
499+
0x4000 - Enable Source Control 0
500+
0x8000 - Enable Source Control 1
497501
0x0005 uint16be Data Source
498502
0xFFFF - Disable
499503
0..N - ID of Data Source

src/misc/binary_io.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,22 @@ impl BinaryRead for u8 {
197197
}
198198
}
199199

200+
impl BinaryRead for u16 {
201+
fn decode<R: Reader>(reader: &mut R) -> Result<ReaderOutput<R, Self>, Error> {
202+
let value = reader.read_u16be()?;
203+
204+
Ok(R::guard(|_| value))
205+
}
206+
}
207+
208+
impl BinaryRead for i16 {
209+
fn decode<R: Reader>(reader: &mut R) -> Result<ReaderOutput<R, Self>, Error> {
210+
let value = reader.read_i16be()?;
211+
212+
Ok(R::guard(|_| value))
213+
}
214+
}
215+
200216
impl<T, const N: usize> BinaryRead for [T; N]
201217
where
202218
T: BinaryRead,

0 commit comments

Comments
 (0)