forked from NaxdyOrg/NaxGCC-FW
chore(project): clean up unused imports
This commit is contained in:
parent
d0960f2c2d
commit
8073328405
5 changed files with 11 additions and 32 deletions
|
@ -2,15 +2,12 @@
|
||||||
* Storage for controller configuration, including helper functions & types, as well as sane defaults.
|
* Storage for controller configuration, including helper functions & types, as well as sane defaults.
|
||||||
* Also includes necessary logic for configuring the controller & calibrating the sticks.
|
* Also includes necessary logic for configuring the controller & calibrating the sticks.
|
||||||
*/
|
*/
|
||||||
use core::{
|
use core::{cmp::min, f32::consts::PI};
|
||||||
cmp::{max, min},
|
|
||||||
f32::consts::PI,
|
|
||||||
};
|
|
||||||
|
|
||||||
use defmt::{debug, error, info, warn, Format};
|
use defmt::{debug, error, info, warn, Format};
|
||||||
use embassy_futures::yield_now;
|
use embassy_futures::yield_now;
|
||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
flash::{Async, Blocking, Flash, ERASE_SIZE},
|
flash::{Async, Flash, ERASE_SIZE},
|
||||||
peripherals::FLASH,
|
peripherals::FLASH,
|
||||||
};
|
};
|
||||||
use packed_struct::{derive::PackedStruct, PackedStruct};
|
use packed_struct::{derive::PackedStruct, PackedStruct};
|
||||||
|
@ -19,8 +16,7 @@ use crate::{
|
||||||
gcc_hid::{SIGNAL_CHANGE_RUMBLE_STRENGTH, SIGNAL_INPUT_CONSISTENCY_MODE_STATUS},
|
gcc_hid::{SIGNAL_CHANGE_RUMBLE_STRENGTH, SIGNAL_INPUT_CONSISTENCY_MODE_STATUS},
|
||||||
helpers::{PackedFloat, ToPackedFloatArray, ToRegularArray, XyValuePair},
|
helpers::{PackedFloat, ToPackedFloatArray, ToRegularArray, XyValuePair},
|
||||||
input::{
|
input::{
|
||||||
read_ext_adc, Stick, StickAxis, StickState, FLOAT_ORIGIN, SPI_ACS_SHARED, SPI_CCS_SHARED,
|
read_ext_adc, Stick, StickAxis, FLOAT_ORIGIN, SPI_ACS_SHARED, SPI_CCS_SHARED, SPI_SHARED,
|
||||||
SPI_SHARED,
|
|
||||||
},
|
},
|
||||||
stick::{
|
stick::{
|
||||||
calc_stick_values, legalize_notches, AppliedCalibration, CleanedCalibrationPoints,
|
calc_stick_values, legalize_notches, AppliedCalibration, CleanedCalibrationPoints,
|
||||||
|
@ -32,7 +28,7 @@ use crate::{
|
||||||
|
|
||||||
use embassy_sync::{
|
use embassy_sync::{
|
||||||
blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex, ThreadModeRawMutex},
|
blocking_mutex::raw::{CriticalSectionRawMutex, RawMutex, ThreadModeRawMutex},
|
||||||
pubsub::{PubSubBehavior, Subscriber},
|
pubsub::Subscriber,
|
||||||
signal::Signal,
|
signal::Signal,
|
||||||
};
|
};
|
||||||
use embassy_time::{Duration, Ticker, Timer};
|
use embassy_time::{Duration, Ticker, Timer};
|
||||||
|
@ -445,6 +441,7 @@ pub struct OverrideStickState {
|
||||||
pub which_stick: Stick,
|
pub which_stick: Stick,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Clone, Copy, Debug, Format)]
|
#[derive(Clone, Copy, Debug, Format)]
|
||||||
enum AwaitableButtons {
|
enum AwaitableButtons {
|
||||||
A,
|
A,
|
||||||
|
@ -889,7 +886,6 @@ impl<'a> StickCalibrationProcess<'a> {
|
||||||
&self.cal_points.map(|e| e.x),
|
&self.cal_points.map(|e| e.x),
|
||||||
&self.cal_points.map(|e| e.y),
|
&self.cal_points.map(|e| e.y),
|
||||||
&stick_config,
|
&stick_config,
|
||||||
self.which_stick,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
stick_config.angles = *legalize_notches(
|
stick_config.angles = *legalize_notches(
|
||||||
|
|
|
@ -13,7 +13,7 @@ use embassy_rp::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal};
|
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::{
|
use embassy_usb::{
|
||||||
class::hid::{HidReaderWriter, ReportId, RequestHandler, State},
|
class::hid::{HidReaderWriter, ReportId, RequestHandler, State},
|
||||||
control::OutResponse,
|
control::OutResponse,
|
||||||
|
|
12
src/input.rs
12
src/input.rs
|
@ -1,17 +1,12 @@
|
||||||
use defmt::{debug, info, trace, Format};
|
use defmt::{debug, info, trace, Format};
|
||||||
use embassy_futures::{join::join, yield_now};
|
use embassy_futures::yield_now;
|
||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
flash::{Async, Flash},
|
|
||||||
gpio::{AnyPin, Input, Output, Pin},
|
gpio::{AnyPin, Input, Output, Pin},
|
||||||
peripherals::{
|
peripherals::SPI0,
|
||||||
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,
|
|
||||||
spi::{Blocking, Spi},
|
spi::{Blocking, Spi},
|
||||||
};
|
};
|
||||||
use embassy_sync::{
|
use embassy_sync::{
|
||||||
blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex, ThreadModeRawMutex},
|
blocking_mutex::raw::{CriticalSectionRawMutex, ThreadModeRawMutex},
|
||||||
mutex::Mutex,
|
mutex::Mutex,
|
||||||
pubsub::PubSubChannel,
|
pubsub::PubSubChannel,
|
||||||
signal::Signal,
|
signal::Signal,
|
||||||
|
@ -28,7 +23,6 @@ use crate::{
|
||||||
gcc_hid::GcReport,
|
gcc_hid::GcReport,
|
||||||
helpers::XyValuePair,
|
helpers::XyValuePair,
|
||||||
stick::{linearize, notch_remap, StickParams},
|
stick::{linearize, notch_remap, StickParams},
|
||||||
FLASH_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Used to send the button state to the usb task and the calibration task
|
/// Used to send the button state to the usb task and the calibration task
|
||||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -12,25 +12,17 @@ mod input;
|
||||||
mod stick;
|
mod stick;
|
||||||
|
|
||||||
use config::config_task;
|
use config::config_task;
|
||||||
use config::ControllerConfig;
|
|
||||||
use defmt::{debug, info};
|
use defmt::{debug, info};
|
||||||
use embassy_executor::Executor;
|
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::{
|
use embassy_rp::{
|
||||||
bind_interrupts,
|
bind_interrupts,
|
||||||
flash::{Async, Flash},
|
flash::{Async, Flash},
|
||||||
gpio::{self, AnyPin, Input},
|
gpio::{self, AnyPin, Input},
|
||||||
multicore::{spawn_core1, Stack},
|
multicore::{spawn_core1, Stack},
|
||||||
peripherals::{SPI0, USB},
|
peripherals::USB,
|
||||||
pwm::Pwm,
|
|
||||||
spi::{self, Spi},
|
spi::{self, Spi},
|
||||||
usb::{Driver, InterruptHandler},
|
usb::{Driver, InterruptHandler},
|
||||||
};
|
};
|
||||||
use embassy_time::Instant;
|
|
||||||
use gcc_hid::usb_transfer_task;
|
use gcc_hid::usb_transfer_task;
|
||||||
use gpio::{Level, Output};
|
use gpio::{Level, Output};
|
||||||
|
|
||||||
|
@ -39,7 +31,6 @@ use static_cell::StaticCell;
|
||||||
|
|
||||||
use crate::config::enter_config_mode_task;
|
use crate::config::enter_config_mode_task;
|
||||||
use crate::gcc_hid::rumble_task;
|
use crate::gcc_hid::rumble_task;
|
||||||
use crate::input::input_integrity_benchmark;
|
|
||||||
|
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,8 @@ use defmt::{debug, info, trace, Format};
|
||||||
use libm::{atan2f, cosf, fabs, fabsf, fmaxf, fminf, roundf, sinf, sqrtf};
|
use libm::{atan2f, cosf, fabs, fabsf, fmaxf, fminf, roundf, sinf, sqrtf};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{ControllerConfig, StickConfig, DEFAULT_ANGLES, DEFAULT_NOTCH_STATUS},
|
config::{StickConfig, DEFAULT_ANGLES, DEFAULT_NOTCH_STATUS},
|
||||||
helpers::{ToRegularArray, XyValuePair},
|
helpers::{ToRegularArray, XyValuePair},
|
||||||
input::Stick,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// fit order for the linearization
|
/// fit order for the linearization
|
||||||
|
@ -427,7 +426,6 @@ impl AppliedCalibration {
|
||||||
cal_points_x: &[f32; NO_OF_CALIBRATION_POINTS],
|
cal_points_x: &[f32; NO_OF_CALIBRATION_POINTS],
|
||||||
cal_points_y: &[f32; NO_OF_CALIBRATION_POINTS],
|
cal_points_y: &[f32; NO_OF_CALIBRATION_POINTS],
|
||||||
stick_config: &StickConfig,
|
stick_config: &StickConfig,
|
||||||
which_stick: Stick,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut stick_params = StickParams::from_stick_config(stick_config);
|
let mut stick_params = StickParams::from_stick_config(stick_config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue