| Crates.io | daqhats-rs |
| lib.rs | daqhats-rs |
| version | 0.1.0 |
| created_at | 2025-07-16 16:40:10.067974+00 |
| updated_at | 2025-07-16 16:40:10.067974+00 |
| description | Rust bindings for the MCC DAQ HAT Library for Raspberry Pi data acquisition devices |
| homepage | https://github.com/vincent-uden/daqhats-rs |
| repository | https://github.com/vincent-uden/daqhats-rs |
| max_upload_size | |
| id | 1755813 |
| size | 594,967 |
Rust bindings for the MCC DAQ HAT Library, providing access to Measurement Computing Corporation's data acquisition HAT devices for Raspberry Pi.
This library is designed for Raspberry Pi systems with MCC DAQ HAT hardware installed. The underlying C library requires:
libgpiod libraryAdd this to your Cargo.toml:
[dependencies]
daqhats-rs = "0.1"
use daqhats_rs::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// List all connected DAQ HATs
let count = unsafe { hat_list(HatIDs_HAT_ID_ANY, std::ptr::null_mut()) };
println!("Found {} DAQ HAT devices", count);
if count > 0 {
// Allocate memory for device info
let mut devices = vec![HatInfo::default(); count as usize];
unsafe {
hat_list(HatIDs_HAT_ID_ANY, devices.as_mut_ptr());
}
for device in devices {
println!("Device at address {}: ID = {}", device.address, device.id);
}
}
Ok(())
}
This library provides direct bindings to the C library, so most functions are marked as unsafe. Users should:
The library will automatically:
bindgenLicensed under either of:
at your option.
Contributions are welcome! Please feel free to submit a Pull Request.