| Crates.io | st-fifo-tool |
| lib.rs | st-fifo-tool |
| version | 1.0.0 |
| created_at | 2025-07-31 09:38:05.973474+00 |
| updated_at | 2025-07-31 09:38:05.973474+00 |
| description | A set of utilities useful to interface with the ST MEMS TAG-based IMUs sensor FIFO |
| homepage | |
| repository | https://github.com/STMicroelectronics/st-mems-rust-drivers/tree/main/util/st-fifo-tool |
| max_upload_size | |
| id | 1774762 |
| size | 35,071 |
This repository contains a set of utilities useful to interface with the ST MEMS TAG-based IMUs sensor FIFO: it provides the capability to decode and decompress the data samples.
The APIs are the following:
// Create a st_fifo_tool config:
let config = st_fifo_tool::Config {
device: st_fifo_tool::DeviceType::...,
bdr_xl: ...,
bdr_gy: ...,
bdr_vsens: ...
};
// Initialize the st_fifo_tool
let mut fifo = st_fifo_tool::FifoData::init(&config).unwrap();
// Initialize structs to hold the input/output data
let SLOT_NUMBER: u8 = ...;
let mut raw_slot = [st_fifo_tool::RawSlot::default(); SLOT_NUMBER as usize];
let mut out_slot = [st_fifo_tool::OutSlot::default(); SLOT_NUMBER as usize];
// Reads data (inside a loop)
let mut out_slot_size: u16 = 0;
let f_data = sensor.fifo_out_raw_get().unwrap(); // get raw data from some sensor
let fifo_status = sensor.fifo_status_get().unwrap();
let slots = fifo_status.fifo_level;
for i in 0..slots {
raw_slot[i as usize].fifo_data_out[0] = ((f_data.tag as u8) << 3) | (f_data.cnt << 1);
raw_slot[slots as usize].fifo_data_out[1..].copy_from_slice(&f_data.data);
}
// Decode and sort the data
fifo.decode(&mut out_slot, &raw_slot, &mut out_slot_size, slots);
fifo.sort(&mut out_slot, out_slot_size);
// Count how many samples for SensorType
let mut solts_for_acc = 0 // accelerometer or gyroscope
fifo.extract_sensor(&mut slots_for_acc, &out_slot, out_slot_size, st_fifo_tool::SensorType::Accelerometer);
// Extract samples from the SensorType
fifo.extract_sensor(&mut acc_slot, &out_slot, out_slot_size, st_fifo_tool::SensorType::Accelerometer);
This utility is structured as follows:
More information: http://www.st.com
Copyright © 2022 STMicroelectronics