36 lines
893 B
Rust
36 lines
893 B
Rust
//! Protocol-neutral physical-motor protocol reference.
|
|
//!
|
|
//! This crate deliberately remains in the workspace for future, separately
|
|
//! reviewed physical-flight work. No checked-in board platform links it, and
|
|
//! its types model DShot/PWM framing and
|
|
//! local arming sequences only; they grant neither peripheral access nor
|
|
//! flight authority.
|
|
|
|
#![no_std]
|
|
|
|
pub mod dshot;
|
|
pub mod pwm;
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub struct ArmingDuration(u16);
|
|
|
|
impl ArmingDuration {
|
|
pub const fn from_millis(milliseconds: u16) -> Option<Self> {
|
|
if milliseconds != 0 && milliseconds <= 8_000 {
|
|
Some(Self(milliseconds))
|
|
} else {
|
|
None
|
|
}
|
|
}
|
|
|
|
pub const fn milliseconds(self) -> u16 {
|
|
self.0
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum MotorProtocol {
|
|
Pwm(pwm::Config),
|
|
Dshot(dshot::Config),
|
|
}
|