elata_eeg_hal/lib.rs
1//! EEG Hardware Abstraction Layer
2//!
3//! This crate provides a unified interface for EEG devices, allowing models
4//! to work with any supported device without knowing the underlying hardware.
5//!
6//! # Main concepts
7//!
8//! - [`EegDevice`] defines the device lifecycle and sample acquisition API
9//! - [`DeviceInfo`] and [`ChannelConfig`] describe a device's static capabilities
10//! - [`SampleBuffer`] stores multi-channel EEG samples for downstream processing
11//! - [`bands`] exposes standard EEG band ranges reused across the SDK
12//!
13//! # Example
14//!
15//! ```rust
16//! use elata_eeg_hal::{EegSample, SampleBuffer};
17//!
18//! let mut buffer = SampleBuffer::new(256, 4);
19//! let sample = EegSample::new(0, vec![1.0, 2.0, 3.0, 4.0]);
20//! buffer.push(&sample);
21//!
22//! assert_eq!(buffer.sample_count(), 1);
23//! assert_eq!(buffer.channel_data(0), &[1.0]);
24//! ```
25
26mod channel;
27mod device;
28mod error;
29mod sample;
30
31pub use channel::{Channel, ChannelConfig, ChannelType};
32pub use device::{ConfigurableDevice, DeviceInfo, DeviceState, EegDevice};
33pub use error::{HalError, Result};
34pub use sample::{EegSample, SampleBuffer};
35
36/// Standard EEG frequency bands (in Hz)
37pub mod bands {
38 /// Delta band: 0.5-4 Hz (deep sleep)
39 pub const DELTA: (f32, f32) = (0.5, 4.0);
40 /// Theta band: 4-8 Hz (drowsiness, meditation)
41 pub const THETA: (f32, f32) = (4.0, 8.0);
42 /// Alpha band: 8-13 Hz (relaxed, eyes closed)
43 pub const ALPHA: (f32, f32) = (8.0, 13.0);
44 /// Beta band: 13-30 Hz (active thinking, focus)
45 pub const BETA: (f32, f32) = (13.0, 30.0);
46 /// Gamma band: 30-100 Hz (high-level cognition)
47 pub const GAMMA: (f32, f32) = (30.0, 100.0);
48}