elata-eeg-hal 0.1.0

Hardware Abstraction Layer for EEG devices
Documentation
  • Coverage
  • 98.25%
    56 out of 57 items documented1 out of 1 items with examples
  • Size
  • Source code size: 19.68 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.94 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 34s Average build duration of successful builds.
  • all releases: 34s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Elata-Biosciences/elata-bio-sdk
    83 7 5
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DoctorKhan

elata-eeg-hal

Hardware abstraction layer for EEG devices in the Elata SDK.

This crate defines the shared types and traits used across EEG integrations:

  • EegDevice for device lifecycle and sample acquisition
  • ConfigurableDevice for optional runtime configuration
  • DeviceInfo, DeviceState, and channel metadata types
  • EegSample and SampleBuffer for moving multi-channel data through analysis pipelines
  • standard EEG band constants in bands

What it is for

Use elata-eeg-hal when you are:

  • implementing a new EEG device adapter
  • building analysis code that should work across multiple EEG devices
  • writing tests against synthetic or recorded EEG sources

Basic example

use elata_eeg_hal::{ChannelConfig, DeviceInfo, DeviceState, EegDevice, Result, SampleBuffer};

struct DemoDevice {
    info: DeviceInfo,
    state: DeviceState,
}

impl DemoDevice {
    fn new() -> Self {
        Self {
            info: DeviceInfo::new("Demo", "Elata", 256, ChannelConfig::muse()),
            state: DeviceState::Disconnected,
        }
    }
}

impl EegDevice for DemoDevice {
    fn info(&self) -> DeviceInfo {
        self.info.clone()
    }

    fn state(&self) -> DeviceState {
        self.state
    }

    fn connect(&mut self) -> Result<()> {
        self.state = DeviceState::Connected;
        Ok(())
    }

    fn disconnect(&mut self) -> Result<()> {
        self.state = DeviceState::Disconnected;
        Ok(())
    }

    fn start_stream(&mut self) -> Result<()> {
        self.state = DeviceState::Streaming;
        Ok(())
    }

    fn stop_stream(&mut self) -> Result<()> {
        self.state = DeviceState::Connected;
        Ok(())
    }

    fn read_samples(&mut self, _buffer: &mut SampleBuffer) -> Result<usize> {
        Ok(0)
    }
}

Pair this crate with elata-eeg-signal for DSP utilities and elata-eeg-models for higher-level EEG analysis.