//! CAN controller primitives for actuator and motor control.
//!
//! `kcan` provides the hardware-independent protocol pieces needed to control
//! CAN-connected actuators: frame packing, feedback decoding, safety clamping,
//! unit conversion, and control-loop helpers.

#![forbid(unsafe_code)]

pub mod actuator;
pub mod bus;
pub mod control;
pub mod error;
pub mod manager;
pub mod monitor;
pub mod motor;
pub mod protocol;
pub mod protocols;
#[cfg(feature = "socketcan")]
pub mod socketcan_transport;
#[cfg(feature = "tui")]
pub mod tui;

pub use actuator::{
    ActuatorConfig, ActuatorFeedback, ActuatorHealth, ActuatorMetric, ActuatorProtocol,
    ActuatorSnapshot,
};
pub use bus::{CanBus, CanFrame, CanId};
pub use control::{
    LowPassFilterConfig, PIDConfig, PIDController, SecondOrderLowPassFilter, SolverType,
};
pub use error::{Error, Result};
pub use manager::MotorManager;
pub use monitor::{
    CAN_TRACE_CSV_HEADER, CanFrameClass, CanFrameRecord, CanMonitor, CanMonitorStats,
    CanTraceRecord, FormattedCanFrame, parse_can_trace_csv, replay_can_trace, sample_can_monitor,
};
pub use motor::{HelperPolicy, MotorConfig, MotorController, RefreshStats};
pub use protocol::{
    ControlMode, DirectCommand, DirectPayload, FaultCode, FeedbackFilter, MitCommand,
    MitHelperCommand, MitLimits, MotorFeedback, MotorModel, MotorSpec, OriginMode,
};
pub use protocols::robstride::{
    RobStrideCommand, RobStrideFeedback, RobStrideFrameKind, RobStrideMitCommand, RobStrideModel,
    RobStridePositionCommand, RobStrideRawCommand, RobStrideSpec, RobStrideSpeedCommand,
};
#[cfg(feature = "socketcan")]
pub use socketcan_transport::SocketCanBus;
#[cfg(feature = "tui")]
pub use tui::{
    CanMonitorCommand, TuiCanMonitor, TuiCommand, TuiControlIntent, TuiDashboard, TuiMode,
    TuiTarget,
};
