libs/kaptan-stm32f7: prepare high-rate board runtime

Signed-off-by: Onur Özkan <work@onurozkan.dev>
This commit is contained in:
Onur Özkan committed 2026-07-25 21:54:29 +03:00
1 parent 57ff85fdbe
commit 4a5d0313ca
4 files changed
+126 -34

No files matched your search

+12 -1
View File
@@ -46,6 +46,13 @@ where
/// Advances the reset-settling state on a board periodic event.
pub fn on_periodic_tick(&mut self) -> ImuEvent<Bus::StartError> {
if self.imu.is_ready() {
return match self.imu.request_sample(self.clock.now()) {
Ok(()) | Err(Mpu6000Error::NotReady) => ImuEvent::Idle,
Err(error) => ImuEvent::Fault(error),
};
}
let _ = self.clock.now();
match self.imu.advance_initialization() {
Ok(()) => ImuEvent::Idle,
@@ -132,6 +139,10 @@ mod tests {
service.on_transfer_complete(SpiCompletion::Complete),
ImuEvent::Initialized
));
assert!(matches!(service.on_data_ready(), ImuEvent::Idle));
assert!(matches!(service.on_periodic_tick(), ImuEvent::Idle));
assert!(matches!(
service.on_transfer_complete(SpiCompletion::Complete),
ImuEvent::Sample(_)
));
}
}