Skip to main content

Crate neurosky

Crate neurosky 

Source
Expand description

§neurosky

Rust library and terminal UI for the NeuroSky MindWave EEG headset via the ThinkGear serial protocol. Pure Rust — works on all OS.

§Quick start

use neurosky::prelude::*;

let ports = MindWaveDevice::find()?;
let mut device = MindWaveDevice::open(&ports[0])?;
device.auto_connect()?;

loop {
    for packet in device.read()? {
        match packet {
            Packet::Attention(v) => println!("Attention: {v}"),
            Packet::RawValue(v)  => { /* feed dsp::BandPowerExtractor */ }
            _ => {}
        }
    }
}

§Module overview

ModulePurpose
typesThinkGear protocol constants, packet codes, data types
parserStateful binary protocol parser (sync → length → payload → checksum)
deviceHigh-level MindWaveDevice API
dspReal-time EEG DSP pipeline — notch filter, bandpass filters, band power extraction
verifyPure-Rust SHA-256 and ThinkGear packet checksum validation
sandboxOS-level network sandboxing (serial-only device; no network needed)
errorError types
preludeConvenience re-exports

Modules§

device
High-level MindWave device API.
dsp
Digital signal processing pipeline for raw EEG.
error
Error types for the NeuroSky ThinkGear API wrapper.
parser
ThinkGear binary protocol parser.
prelude
Convenience re-exports.
sandbox
Process-level network sandboxing.
types
ThinkGear protocol types and constants.
verify
SHA-256 integrity verification and ThinkGear packet validation.