diff --git a/Cargo.lock b/Cargo.lock index d2f067047b62c1f59311711cd93390d9f55e16f3..fc7d38c555391bf8dc1248fd682a102b4dbe60d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -438,6 +438,18 @@ dependencies = [ "defmt", ] +[[package]] +name = "deprecate-until" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3767f826efbbe5a5ae093920b58b43b01734202be697e1354914e862e8e704" +dependencies = [ + "proc-macro2", + "quote", + "semver 1.0.23", + "syn 2.0.77", +] + [[package]] name = "document-features" version = "0.2.10" @@ -1295,6 +1307,7 @@ name = "tele0592" version = "1.1.1" dependencies = [ "color-eyre", + "deprecate-until", "embedded-hal 1.0.0", "micromath", "rppal", diff --git a/tele0592/Cargo.toml b/tele0592/Cargo.toml index 03a34ecc68c6e5829367476db661093457608677..7776ccc7edd4421eb7bdaae8b9b2611720d3ddc1 100644 --- a/tele0592/Cargo.toml +++ b/tele0592/Cargo.toml @@ -14,6 +14,7 @@ readme = "README.md" exclude = [".envrc", "default.nix"] [dependencies] +deprecate-until = "0.1.1" embedded-hal = "1.0.0" micromath = { version = "2.1.0", optional = true } diff --git a/tele0592/examples/check-firmware.rs b/tele0592/examples/check-firmware.rs index 7c7a34125d31e31230d2597157efb6ef408157ad..0eaaaa0a3a2ebc1eab701c3a96ed034d4e6f85db 100644 --- a/tele0592/examples/check-firmware.rs +++ b/tele0592/examples/check-firmware.rs @@ -2,6 +2,7 @@ use color_eyre::eyre::Context; use std::{thread, time::Duration}; use tele0592::{Controller as _, Device as _}; +#[allow(clippy::too_many_lines, deprecated)] // deprecated needed for c.get_encoder_ticks() fn main() -> color_eyre::Result<()> { color_eyre::install()?; let mut c = rppal::i2c::I2c::with_bus(8).with_context(|| "opening I²C bus")?; diff --git a/tele0592/src/controller.rs b/tele0592/src/controller.rs index a36840798d4bd7d0fbf5a434d868c69bc22f0c19..0d71eb3e27d1cc09609126f4dc677fa128662fa6 100644 --- a/tele0592/src/controller.rs +++ b/tele0592/src/controller.rs @@ -240,6 +240,10 @@ pub trait Controller: Device { /// /// # Errors /// This method may fail if the communication with the board fails. + #[deprecate_until::deprecate_until( + remove = ">= 2.x", + note = "use `Controller::get_relative_encoder_ticks()` instead" + )] fn get_encoder_ticks(&mut self) -> Result<(i16, i16), Self::I2cError> { let mut buf = [0; 4]; self.write_read([CMD_ENCODER_TICKS], &mut buf)?;