Skip to main content

Crate brainwires_hardware

Crate brainwires_hardware 

Source
Expand description

§brainwires-hardware

Hardware I/O for the Brainwires Agent Framework.

Provides a unified hardware abstraction layer covering:

ModuleFeature flagDescription
audioaudioAudio capture/playback, STT, TTS (16 cloud providers + local Whisper)
gpiogpioGPIO pin management with safety allow-lists and PWM (Linux)
bluetoothbluetoothBLE advertisement scanning and adapter enumeration
cameracameraWebcam/camera frame capture (V4L2/AVFoundation/MSMF)
usbusbRaw USB device enumeration and bulk/control/interrupt transfers

Home automation protocols (Matter, Zigbee, Z-Wave, Thread) live in the standalone future/home-automation/brainwires-homeauto workspace.

§Feature flags

[dependencies]
brainwires-hardware = { version = "0.11", features = ["audio", "gpio", "bluetooth", "camera"] }
# or enable everything:
brainwires-hardware = { version = "0.11", features = ["full"] }

§Audio

The audio feature enables hardware audio capture/playback via CPAL and 16 cloud STT/TTS provider integrations. Add local-stt for offline Whisper inference and flac for FLAC codec support.

§GPIO (Linux)

The gpio feature exposes safe GPIO pin access using the Linux character device API (gpio-cdev) with an explicit allow-list safety policy.

§Bluetooth

The bluetooth feature uses btleplug for cross-platform BLE scanning (Linux/BlueZ, macOS CoreBluetooth, Windows WinRT).

§Camera

The camera feature enables video frame capture using nokhwa: V4L2 on Linux, AVFoundation on macOS, Media Foundation on Windows.

§USB

The usb feature provides raw USB device enumeration and transfers via nusb — a pure-Rust async USB library with no libusb system dependency.

Re-exports§

pub use audio::AudioBuffer;
pub use audio::AudioCapture;
pub use audio::AudioConfig;
pub use audio::AudioDevice;
pub use audio::AudioError;
pub use audio::AudioPlayback;
pub use audio::AudioResult;
pub use audio::AudioRingBuffer;
pub use audio::DeviceDirection;
pub use audio::OutputFormat;
pub use audio::SampleFormat;
pub use audio::SpeechToText;
pub use audio::SttOptions;
pub use audio::TextToSpeech;
pub use audio::Transcript;
pub use audio::TranscriptSegment;
pub use audio::TtsOptions;
pub use audio::Voice;
pub use audio::decode_wav;
pub use audio::encode_wav;
pub use audio::AzureStt;
pub use audio::AzureTts;
pub use audio::CartesiaTts;
pub use audio::DeepgramStt;
pub use audio::DeepgramTts;
pub use audio::ElevenLabsStt;
pub use audio::ElevenLabsTts;
pub use audio::FishStt;
pub use audio::FishTts;
pub use audio::GoogleTts;
pub use audio::MurfTts;
pub use audio::OpenAiResponsesStt;
pub use audio::OpenAiResponsesTts;
pub use audio::OpenAiStt;
pub use audio::OpenAiTts;
pub use audio::CpalCapture;
pub use audio::CpalPlayback;
pub use audio::decode_flac;
pub use audio::encode_flac;
pub use audio::WhisperStt;
pub use gpio::GpioChipInfo;
pub use gpio::GpioLineInfo;
pub use gpio::GpioPin;
pub use gpio::GpioPinManager;
pub use gpio::GpioSafetyPolicy;
pub use camera::CameraCapture;
pub use camera::CameraDevice;
pub use camera::CameraError;
pub use camera::CameraFormat;
pub use camera::CameraFrame;
pub use camera::FrameRate;
pub use camera::NokhwaCapture;
pub use camera::PixelFormat;
pub use camera::Resolution;
pub use usb::UsbClass;
pub use usb::UsbDevice;
pub use usb::UsbError;
pub use usb::UsbHandle;
pub use usb::UsbSpeed;
pub use audio::EnergyVad;
pub use audio::SpeechSegment;
pub use audio::VoiceActivityDetector;
pub use audio::VadMode;
pub use audio::WebRtcVad;
pub use audio::DtwWakeWordDetector;
pub use audio::MfccExtractor;
pub use audio::EnergyTriggerDetector;
pub use audio::WakeWordDetection;
pub use audio::WakeWordDetector;
pub use audio::AssistantState;
pub use audio::VoiceAssistant;
pub use audio::VoiceAssistantBuilder;
pub use audio::VoiceAssistantConfig;
pub use audio::VoiceAssistantHandler;

Modules§

audio
Audio capture, playback, STT, and TTS.
bluetooth
Bluetooth discovery and scanning. Bluetooth hardware discovery and scanning.
camera
Camera and webcam frame capture. Camera and webcam capture.
gpio
GPIO hardware access (Linux). GPIO hardware access for autonomous agents.
usb
Raw USB device access and transfers. Raw USB device access.