kcan 0.1.6

CAN controller primitives for actuator and motor control.
Documentation
#[cfg(feature = "socketcan")]
fn main() -> kcan::Result<()> {
    use std::time::Duration;

    use kcan::{MotorConfig, MotorController, SocketCanBus};

    let bus = SocketCanBus::open("can0")?;
    let mut motor = MotorController::new(bus, MotorConfig::default())?;

    motor.enable_mit_mode()?;
    motor.set_velocity_erpm(1_000)?;
    motor.send_keepalive()?;

    if let Some(feedback) = motor.receive_feedback(Duration::from_millis(100))? {
        println!(
            "pos={:.2} deg speed={} erpm current={:.2} A temp={} C fault={}",
            feedback.position_degrees,
            feedback.speed_erpm,
            feedback.current_amps,
            feedback.temperature_celsius,
            feedback.error_code
        );
    }

    motor.stop()
}

#[cfg(not(feature = "socketcan"))]
fn main() {
    eprintln!("enable the `socketcan` feature to run this example");
}