From 807332840596dd15acdca2e1776f9316ab01e684 Mon Sep 17 00:00:00 2001 From: Naxdy Date: Wed, 3 Apr 2024 17:17:21 +0200 Subject: [PATCH] chore(project): clean up unused imports --- src/config.rs | 14 +++++--------- src/gcc_hid.rs | 2 +- src/input.rs | 12 +++--------- src/main.rs | 11 +---------- src/stick.rs | 4 +--- 5 files changed, 11 insertions(+), 32 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2a2bee7..228b908 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,15 +2,12 @@ * Storage for controller configuration, including helper functions & types, as well as sane defaults. * Also includes necessary logic for configuring the controller & calibrating the sticks. */ -use core::{ - cmp::{max, min}, - f32::consts::PI, -}; +use core::{cmp::min, f32::consts::PI}; use defmt::{debug, error, info, warn, Format}; use embassy_futures::yield_now; use embassy_rp::{ - flash::{Async, Blocking, Flash, ERASE_SIZE}, + flash::{Async, Flash, ERASE_SIZE}, peripherals::FLASH, }; use packed_struct::{derive::PackedStruct, PackedStruct}; @@ -19,8 +16,7 @@ use crate::{ gcc_hid::{SIGNAL_CHANGE_RUMBLE_STRENGTH, SIGNAL_INPUT_CONSISTENCY_MODE_STATUS}, helpers::{PackedFloat, ToPackedFloatArray, ToRegularArray, XyValuePair}, input::{ - read_ext_adc, Stick, StickAxis, StickState, FLOAT_ORIGIN, SPI_ACS_SHARED, SPI_CCS_SHARED, - SPI_SHARED, + read_ext_adc, Stick, StickAxis, FLOAT_ORIGIN, SPI_ACS_SHARED, SPI_CCS_SHARED, SPI_SHARED, }, stick::{ calc_stick_values, legalize_notches, AppliedCalibration, CleanedCalibrationPoints, @@ -32,7 +28,7 @@ use crate::{ use embassy_sync::{ blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex, ThreadModeRawMutex}, - pubsub::{PubSubBehavior, Subscriber}, + pubsub::Subscriber, signal::Signal, }; use embassy_time::{Duration, Ticker, Timer}; @@ -445,6 +441,7 @@ pub struct OverrideStickState { pub which_stick: Stick, } +#[allow(dead_code)] #[derive(Clone, Copy, Debug, Format)] enum AwaitableButtons { A, @@ -889,7 +886,6 @@ impl<'a> StickCalibrationProcess<'a> { &self.cal_points.map(|e| e.x), &self.cal_points.map(|e| e.y), &stick_config, - self.which_stick, ); stick_config.angles = *legalize_notches( diff --git a/src/gcc_hid.rs b/src/gcc_hid.rs index 370b593..443275a 100644 --- a/src/gcc_hid.rs +++ b/src/gcc_hid.rs @@ -13,7 +13,7 @@ use embassy_rp::{ }; use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal}; -use embassy_time::{Duration, Instant, Ticker, Timer}; +use embassy_time::{Duration, Instant, Ticker}; use embassy_usb::{ class::hid::{HidReaderWriter, ReportId, RequestHandler, State}, control::OutResponse, diff --git a/src/input.rs b/src/input.rs index 33b649d..b43e141 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1,17 +1,12 @@ use defmt::{debug, info, trace, Format}; -use embassy_futures::{join::join, yield_now}; +use embassy_futures::yield_now; use embassy_rp::{ - flash::{Async, Flash}, gpio::{AnyPin, Input, Output, Pin}, - peripherals::{ - FLASH, PIN_10, PIN_11, PIN_16, PIN_17, PIN_18, PIN_19, PIN_20, PIN_21, PIN_22, PIN_23, - PIN_24, PIN_5, PIN_8, PIN_9, PWM_CH4, PWM_CH6, SPI0, SPI1, - }, - pwm::Pwm, + peripherals::SPI0, spi::{Blocking, Spi}, }; use embassy_sync::{ - blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex, ThreadModeRawMutex}, + blocking_mutex::raw::{CriticalSectionRawMutex, ThreadModeRawMutex}, mutex::Mutex, pubsub::PubSubChannel, signal::Signal, @@ -28,7 +23,6 @@ use crate::{ gcc_hid::GcReport, helpers::XyValuePair, stick::{linearize, notch_remap, StickParams}, - FLASH_SIZE, }; /// Used to send the button state to the usb task and the calibration task diff --git a/src/main.rs b/src/main.rs index 7bcd0d3..9ccf733 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,25 +12,17 @@ mod input; mod stick; use config::config_task; -use config::ControllerConfig; use defmt::{debug, info}; use embassy_executor::Executor; -use embassy_executor::InterruptExecutor; -use embassy_futures::join::join; -use embassy_rp::flash::Blocking; -use embassy_rp::interrupt; -use embassy_rp::interrupt::InterruptExt; use embassy_rp::{ bind_interrupts, flash::{Async, Flash}, gpio::{self, AnyPin, Input}, multicore::{spawn_core1, Stack}, - peripherals::{SPI0, USB}, - pwm::Pwm, + peripherals::USB, spi::{self, Spi}, usb::{Driver, InterruptHandler}, }; -use embassy_time::Instant; use gcc_hid::usb_transfer_task; use gpio::{Level, Output}; @@ -39,7 +31,6 @@ use static_cell::StaticCell; use crate::config::enter_config_mode_task; use crate::gcc_hid::rumble_task; -use crate::input::input_integrity_benchmark; use {defmt_rtt as _, panic_probe as _}; diff --git a/src/stick.rs b/src/stick.rs index 15e2caf..b02028a 100644 --- a/src/stick.rs +++ b/src/stick.rs @@ -6,9 +6,8 @@ use defmt::{debug, info, trace, Format}; use libm::{atan2f, cosf, fabs, fabsf, fmaxf, fminf, roundf, sinf, sqrtf}; use crate::{ - config::{ControllerConfig, StickConfig, DEFAULT_ANGLES, DEFAULT_NOTCH_STATUS}, + config::{StickConfig, DEFAULT_ANGLES, DEFAULT_NOTCH_STATUS}, helpers::{ToRegularArray, XyValuePair}, - input::Stick, }; /// fit order for the linearization @@ -427,7 +426,6 @@ impl AppliedCalibration { cal_points_x: &[f32; NO_OF_CALIBRATION_POINTS], cal_points_y: &[f32; NO_OF_CALIBRATION_POINTS], stick_config: &StickConfig, - which_stick: Stick, ) -> Self { let mut stick_params = StickParams::from_stick_config(stick_config);