#![allow(unused)]
use tmc2209_uart::{MicrostepResolution, Tmc2209};
#[cfg(feature = "blocking")]
fn configure_stealthchop<U, E>(uart: U) -> Result<(), tmc2209_uart::Error<E>>
where
U: embedded_io::Read<Error = E> + embedded_io::Write<Error = E>,
{
let mut driver = Tmc2209::new(uart, 0);
driver.set_current(16, 8, 4)?;
driver.set_microsteps(MicrostepResolution::M256)?;
driver.enable_stealthchop()?;
driver.configure_stealthchop(
36, 14, true, true, )?;
driver.set_stealthchop_threshold(500)?;
driver.configure_chopper(
3, 4, 1, 2, )?;
driver.set_vsense(false)?;
driver.set_enabled(true)?;
driver.set_velocity(1000)?;
let _is_stealth = driver.is_stealthchop_active()?;
let _actual_cs = driver.actual_current_scale()?;
Ok(())
}
fn main() {
println!("TMC2209 StealthChop Example");
println!("This example shows how to configure silent operation.");
}