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
76
77
78
79
//! # LED Layouts
//!
//! A layout defines the physical or logical positions of the LEDs in your setup, as
//! arrangements in 1D, 2D, and 3D space.
//!
//! - For 1D, use [`layout1d!`] to define a type that implements [`Layout1d`]
//! - For 2D, use [`layout2d!`] to define a type that implements [`Layout2d`]
//! - For 3D, use [`layout3d!`] to define a type that implements [`Layout3d`]
//!
//! The layout traits provide a `PIXEL_COUNT` constant, which is the number of LEDs, and a
//! `.points()`. method, which maps each LED pixel into a 1D, 2D, or 3D space between -1.0 and
//! 1.0.
//!
//! ## 1D Layouts
//!
//! For simple linear arrangements, use the [`layout1d!`] macro:
//!
//! ```rust
//! use blinksy::layout1d;
//!
//! // Define a strip with 60 LEDs
//! layout1d!(Layout, 60);
//! ```
//!
//! ## 2D Layouts
//!
//! For 2D layouts, use the [`layout2d!`] macro with one or more [`Shape2d`] definitions:
//!
//! ```rust
//! use blinksy::{layout2d, layout::Shape2d, layout::Vec2};
//!
//! // Define a 16x16 LED grid
//! layout2d!(
//! Layout,
//! [Shape2d::Grid {
//! start: Vec2::new(-1., -1.),
//! horizontal_end: Vec2::new(1., -1.),
//! vertical_end: Vec2::new(-1., 1.),
//! horizontal_pixel_count: 16,
//! vertical_pixel_count: 16,
//! serpentine: true,
//! }]
//! );
//! ```
//!
//! ## 3D Layouts
//!
//! For 3D layouts, use the [`layout3d!`] macro with one or more [`Shape3d`] definitions.
//!
//! [`layout1d!`]: crate::layout1d!
//! [`layout2d!`]: crate::layout2d!
//! [`layout3d!`]: crate::layout3d!
use crate;
pub use *;
pub use *;
pub use *;
pub use *;
/// Trait for associating layout types with dimension markers.
///
/// This trait creates the relationship between a layout type and its dimensionality,
/// which helps enforce correct combinations at compile time.
/// All types implementing Layout1d are compatible with Dim1d.
/// All types implementing Layout2d are compatible with Dim2d.
/// All types implementing Layout3d are compatible with Dim3d.