laser_dac/lib.rs
1//! Unified DAC backend abstraction for laser projectors.
2//!
3//! This crate provides a common interface for communicating with various
4//! laser DAC (Digital-to-Analog Converter) hardware, allowing you to write
5//! laser frames without worrying about device-specific protocols.
6//!
7//! # Supported DACs
8//!
9//! - **Helios** - USB laser DAC (feature: `helios`)
10//! - **Ether Dream** - Network laser DAC (feature: `ether-dream`)
11//! - **IDN** - ILDA Digital Network protocol (feature: `idn`)
12//! - **LaserCube WiFi** - WiFi-connected laser DAC (feature: `lasercube-wifi`)
13//! - **LaserCube USB** - USB laser DAC / LaserDock (feature: `lasercube-usb`)
14//!
15//! # Features
16//!
17//! - `all-dacs` (default): Enable all DAC protocols
18//! - `usb-dacs`: Enable USB DACs (Helios, LaserCube USB)
19//! - `network-dacs`: Enable network DACs (Ether Dream, IDN, LaserCube WiFi)
20//!
21//! # Coordinate System
22//!
23//! All backends use normalized coordinates:
24//! - X: -1.0 (left) to 1.0 (right)
25//! - Y: -1.0 (bottom) to 1.0 (top)
26//! - Colors: 0-65535 for R, G, B, and intensity
27//!
28//! Each backend handles conversion to its native format internally.
29
30pub mod backend;
31pub mod discovery;
32pub mod discovery_worker;
33mod error;
34pub mod protocols;
35pub mod types;
36pub mod worker;
37
38// Error types
39pub use error::{Error, Result};
40
41// Backend trait and common types
42pub use backend::{DacBackend, WriteResult};
43
44// Discovery and worker types
45pub use discovery::{DacDiscovery, DiscoveredDevice};
46pub use discovery_worker::DacDiscoveryWorker;
47pub use worker::DacWorker;
48
49// Types
50pub use types::{
51 DacConnectionState, DacDevice, DacType, DiscoveredDac, EnabledDacTypes, LaserFrame, LaserPoint,
52};
53
54// Conditional exports based on features
55
56// Helios
57#[cfg(feature = "helios")]
58pub use backend::HeliosBackend;
59#[cfg(feature = "helios")]
60pub use protocols::helios;
61
62// Ether Dream
63#[cfg(feature = "ether-dream")]
64pub use backend::EtherDreamBackend;
65#[cfg(feature = "ether-dream")]
66pub use protocols::ether_dream;
67
68// IDN
69#[cfg(feature = "idn")]
70pub use backend::IdnBackend;
71#[cfg(feature = "idn")]
72pub use protocols::idn;
73
74// LaserCube WiFi
75#[cfg(feature = "lasercube-wifi")]
76pub use backend::LasercubeWifiBackend;
77#[cfg(feature = "lasercube-wifi")]
78pub use protocols::lasercube_wifi;
79
80// LaserCube USB
81#[cfg(feature = "lasercube-usb")]
82pub use backend::LasercubeUsbBackend;
83#[cfg(feature = "lasercube-usb")]
84pub use protocols::lasercube_usb;
85
86// Re-export rusb for consumers that need the Context type (for LaserCube USB)
87#[cfg(feature = "lasercube-usb")]
88pub use protocols::lasercube_usb::rusb;