Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
kesyog committed Jun 1, 2024
1 parent 462f674 commit f704058
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hangman/.cargo/config → hangman/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runner = "probe-rs run --chip nRF52832_xxAA"
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

[env]
ADVERTISED_NAME = "Progressor_1719"
ADVERTISED_NAME = "Progressor_1234"
DEVICE_ID = "42"
DEVICE_VERSION_NUMBER = "1.2.3.4"
CALIBRATION_CURVE = "FFFFFFFFFFFFFFFF00000000"
7 changes: 7 additions & 0 deletions hangman/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ impl Button {
&port.pin_cnf[usize::from(self.pin_number)]
}

/// Enable pin sensing mechanism (SENSE) for button's pin. Useful for allowing button to wake
/// MCU from sleep modes.
///
/// # Safety
///
/// This breaks invariants in the embassy hal's GPIO driver. One should disable the sense line
/// before using the embassy hal's GPIO driver, including pin re-initialization after wakeup.
pub unsafe fn enable_sense(&mut self) {
let cfg = unsafe { self.steal_pin_cnf() };
match self.polarity {
Expand Down
6 changes: 6 additions & 0 deletions hangman/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

use crate::pac;

/// Disable pin sensing mechanism (SENSE) for all GPIO pins, matching the default on-reset state.
///
/// # Safety
///
/// This may break invariants in the embassy hal's GPIO driver. Recommended to only use this before
/// system off or at wakeup before performing any GPIO initialization.
pub unsafe fn disable_all_gpio_sense() {
#[cfg(feature = "nrf52840")]
{
Expand Down
2 changes: 1 addition & 1 deletion hangman/src/weight/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub use task::task_function;
static SAMPLING_INTERVAL_HZ: OnceCell<usize> = OnceCell::new();
// Temporary defaults for test load cell
// TODO: provide better defaults for Hangman P1_0
pub const DEFAULT_CALIBRATION_M: f32 = 4.6750380809321235e-06;
pub const DEFAULT_CALIBRATION_M: f32 = 4.675_038e-6;
pub const DEFAULT_CALIBRATION_B: i32 = -100598;

type RawReading = i32;
Expand Down

0 comments on commit f704058

Please sign in to comment.