Skip to content

Commit a36e27d

Browse files
committed
feat(ws2812spi): Implement invert
1 parent 7dc686e commit a36e27d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Programming Language. This version features:
2626
Currently implemented features:
2727

2828
* Loading settings from the hyperion.ng database
29-
* Basic WS2812SPI device (no invert, no latch time)
29+
* WS2812SPI device (no latch time)
3030
* JSON, Protobuf, Flatbuffers and Boblight server
3131
* Black border detector, color channel adjustments, smoothing
3232

src/instance/device/ws2812spi.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use spidev::{SpiModeFlags, Spidev, SpidevOptions, SpidevTransfer};
44
use super::{common::*, DeviceError};
55
use crate::models;
66

7-
// TODO: Support invert
87
// TODO: Support latch_time
98

109
pub type Ws2812SpiDevice = Rewriter<Ws2812SpiImpl>;
@@ -68,6 +67,12 @@ impl WritingDevice for Ws2812SpiImpl {
6867
*dst = 0;
6968
}
7069

70+
if config.invert {
71+
for byte in &mut self.buf {
72+
*byte = !*byte;
73+
}
74+
}
75+
7176
Ok(())
7277
}
7378

0 commit comments

Comments
 (0)