feat(f722): add usb mavlink transport
This commit is contained in:
1 parent
7dc3ccb619
commit
604a7aba86
18 files changed
+1087
-208
No files matched your search
@@ -1,7 +1,7 @@
|
||||
//! Bounded protocol-neutral transmit admission and ownership lifecycle.
|
||||
//!
|
||||
//! Protocol encoders own frame bytes. This crate owns only bounded priority
|
||||
//! admission and the transition from pending frame to active DMA ownership.
|
||||
//! admission and the transition from pending frame to active transport ownership.
|
||||
|
||||
#![no_std]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
pub enum FrameClass {
|
||||
/// Heartbeat and current safety/health status. A pending vital frame may
|
||||
/// displace any pending non-vital frame; active DMA storage is untouched.
|
||||
/// displace any pending non-vital frame; active storage is untouched.
|
||||
Vital,
|
||||
/// Fault transitions and authoritative replies that best-effort samples
|
||||
/// cannot displace.
|
||||
@@ -147,12 +147,12 @@ impl<Frame: Copy, const N: usize> TransmitQueue<Frame, N> {
|
||||
Ok(StartOutcome::Started)
|
||||
}
|
||||
|
||||
/// Releases the active frame after a terminal DMA completion.
|
||||
/// Releases the active frame after the transport no longer borrows it.
|
||||
pub fn complete(&mut self) -> Option<PendingFrame<Frame>> {
|
||||
self.active.take()
|
||||
}
|
||||
|
||||
/// Releases the active frame after a terminal DMA fault.
|
||||
/// Releases the active frame after a terminal transport fault.
|
||||
pub fn fail(&mut self) -> Option<PendingFrame<Frame>> {
|
||||
self.active.take()
|
||||
}
|
||||
@@ -162,6 +162,14 @@ impl<Frame: Copy, const N: usize> TransmitQueue<Frame, N> {
|
||||
self.active.is_some()
|
||||
}
|
||||
|
||||
/// Borrows the frame currently owned by the active transport operation.
|
||||
///
|
||||
/// Packetized transports use this to retain one selected frame while
|
||||
/// advancing it across multiple bounded endpoint writes.
|
||||
pub const fn active(&self) -> Option<&PendingFrame<Frame>> {
|
||||
self.active.as_ref()
|
||||
}
|
||||
|
||||
fn take_next(&mut self) -> Option<PendingFrame<Frame>> {
|
||||
let vital = self
|
||||
.pending
|
||||
@@ -203,6 +211,7 @@ mod tests {
|
||||
Ok(StartOutcome::Started)
|
||||
);
|
||||
assert!(queue.is_active());
|
||||
assert_eq!(queue.active().map(|pending| pending.frame), Some(1));
|
||||
|
||||
assert_eq!(
|
||||
queue.enqueue(PendingFrame {
|
||||
@@ -212,6 +221,7 @@ mod tests {
|
||||
EnqueueResult::Enqueued
|
||||
);
|
||||
assert_eq!(queue.complete().unwrap().frame, 1);
|
||||
assert!(queue.active().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user