refactor: move firmware workspace under firmware

This commit is contained in:
Onur Özkan committed 2026-08-10 16:58:55 +03:00
1 parent 153b0bf262
commit f03fc119a4
222 files changed
+56 -13

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
[package]
name = "kaptan-time"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
version.workspace = true
[lints]
workspace = true
+32
View File
@@ -0,0 +1,32 @@
//! Monotonic flight-controller time values and clock contract.
#![no_std]
/// Monotonic microsecond instant since boot.
///
/// Platform clocks must extend narrower counters before constructing this type.
/// A value never wraps during one power cycle.
#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
pub struct Timestamp(u64);
impl Timestamp {
/// Creates an instant from monotonic microseconds since boot.
pub const fn from_microseconds(microseconds: u64) -> Self {
Self(microseconds)
}
/// Returns the instant in monotonic microseconds since boot.
pub const fn as_microseconds(self) -> u64 {
self.0
}
}
/// Supplies monotonically increasing instants to reusable runtime services.
///
/// Implementations may extend a hardware counter internally. `now` takes a
/// mutable receiver so an implementation can record wrap state without hidden
/// interior mutability or synchronization.
pub trait MonotonicClock {
/// Captures the current monotonic instant since boot.
fn now(&mut self) -> Timestamp;
}