#![no_std]
#[cfg(feature = "driver")]
pub mod program;
#[cfg(feature = "driver")]
pub use program::StandardDShotTimings as StandardDShotTimings;
#[cfg(feature = "driver")]
pub use program::BdDShotTimings as BdDShotTimings;
#[cfg(feature = "driver")]
pub mod driver;
pub mod encoder;
#[derive(Debug, Clone)]
#[cfg_attr(feature = "thiserror", derive(thiserror_no_std::Error))]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("Throttle command must be in the range 0-1999, was {throttle}"))]
ThrottleBoundsError { throttle: u16 },
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("Conversion from float to fixed failed in clock divider calculation. Float value: {}", clock_divider_float))]
ClockDividerConversionError { clock_divider_float: f32 },
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("Failed to spawn task"))]
SpawnError(embassy_executor::SpawnError),
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("Failed to recieve value from channel"))]
TryReceiveError(embassy_sync::channel::TryReceiveError),
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("Driver future timed out"))]
TimeoutError(embassy_time::TimeoutError),
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("Invalid ERPM telemetry checksum"))]
InvalidTelemetryChecksum,
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("TX Push Faliure"))]
TxTryPushFaliure,
#[cfg(feature = "driver")]
#[cfg_attr(feature = "thiserror", error("SM Split Faliure, empty pointer!"))]
SmSplitFaliure,
}
#[cfg(feature = "driver")]
impl From<embassy_executor::SpawnError> for Error {
fn from(e: embassy_executor::SpawnError) -> Self {
Error::SpawnError(e)
}
}
#[cfg(feature = "driver")]
impl From<embassy_sync::channel::TryReceiveError> for Error {
fn from(e: embassy_sync::channel::TryReceiveError) -> Self {
Error::TryReceiveError(e)
}
}
#[cfg(feature = "driver")]
impl From<embassy_time::TimeoutError> for Error {
fn from(e: embassy_time::TimeoutError) -> Self {
Error::TimeoutError(e)
}
}