kcan 0.1.4

CAN controller primitives for actuator and motor control.
Documentation
use kcan::{
    DirectCommand, MitCommand, MotorModel, RobStrideCommand, RobStrideModel, direct_command_frame,
    mit_command_frame, robstride_command_frame, robstride_status_query_frame,
};

#[test]
fn root_exports_build_common_frames() -> kcan::Result<()> {
    let mit = mit_command_frame(MotorModel::Ak60_6, 0x03, MitCommand::neutral())?;
    assert_eq!(mit.id().raw(), 0x0803);
    assert_eq!(mit.len(), 8);

    let direct = direct_command_frame(0x03, DirectCommand::Velocity(1_000))?;
    assert_eq!(direct.id().raw(), 0x0303);
    assert_eq!(direct.data(), &[0x00, 0x00, 0x03, 0xE8]);

    let status = robstride_status_query_frame(0x01)?;
    let status_from_command =
        robstride_command_frame(RobStrideModel::Rs01, 0x01, RobStrideCommand::StatusQuery)?;
    assert_eq!(status_from_command, status);
    assert_eq!(status.id().raw(), 0x501);

    Ok(())
}