1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! # WS2812 LED Driver
//!
//! This module provides driver support for WS2812 (NeoPixel) LEDs, which use a
//! single-wire, timing-sensitive protocol. WS2812 LEDs are widely used due to their
//! simplicity and low cost.
//!
//! # Drivers
//!
//! - [`Ws2812Delay`]: Uses bit-banged GPIO
//! - [`blinksy-esp::Ws2812Rmt`]: On ESP devices, uses RMT peripheral
//!
//! ## Key Features
//!
//! - Single-wire protocol (data only, no clock)
//! - 24-bit color (8 bits per channel)
//! - Timing-sensitive protocol
//! - Fixed update rate: 30μs per pixel
//!
//! ## Protocol Details
//!
//! The WS2812 protocol uses precise timing of pulses on a single data line:
//!
//! - A '0' bit is represented by a short high pulse (~400ns) followed by a long low pulse (~850ns)
//! - A '1' bit is represented by a long high pulse (~800ns) followed by a short low pulse (~450ns)
//! - After sending all bits, a reset pulse of at least 50µs is required
//!
//! (References: [Datasheet](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf))
//!
//! Each LED receives 24 bits (RGB) and then passes subsequent data to the next LED in the chain.
//!
//! [`blinksy-esp::Ws2812Rmt`]: https://docs.rs/blinksy-esp/0.10/blinksy-esp/type.Ws2812Rmt.html
use NanosDurationU32 as Nanoseconds;
use crate::;
/// LED implementation for WS2812 protocol.
///
/// This type implements the ClocklessLed trait with the specifics of the WS2812 protocol,
/// including timing requirements and color channel ordering.
;
/// WS2812 driver using GPIO bit-banging with delay timing.
///
/// # Type Parameters
///
/// * `Pin` - The data pin type
/// * `Delay` - The delay implementation type
///
/// Note: This will not work unless your delay timer is able to handle microsecond
/// precision, which most microcontrollers cannot do.
pub type Ws2812Delay<Pin, Delay> = ;