kaptan-actuator: improve config abstractions

Signed-off-by: Onur Özkan <work@onurozkan.dev>
This commit is contained in:
Onur Özkan committed 2026-07-26 00:36:45 +03:00
1 parent 117e1abe97
commit 07a8038857
7 files changed
+136 -146

No files matched your search

+22 -2
View File
@@ -3,10 +3,30 @@
#![no_std]
pub mod dshot;
mod protocol;
pub mod pwm;
pub use protocol::{ArmingDuration, DshotConfig, MotorProtocol, PwmConfig};
#[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),
}
/// Flight-control and MAVLink boundary for motor outputs.
pub trait MotorOutput {