From 3e3e319c39ef7464fe88e1d9d910500f60779c11 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Tue, 27 May 2025 21:36:04 +0300 Subject: [PATCH 1/2] infallible IO --- examples/blinky.rs | 4 +- examples/blinky_delay.rs | 4 +- examples/button.rs | 5 +- examples/can-echo.rs | 8 +- examples/comp.rs | 5 +- examples/spi-example.rs | 6 +- examples/spi-sd.rs | 2 +- examples/uart-dma-tx.rs | 2 +- examples/usb_serial.rs | 6 +- src/gpio.rs | 277 ++++++++++++++++++++++++--------------- src/prelude.rs | 8 +- tests/nucleo-g474.rs | 22 ++-- 12 files changed, 204 insertions(+), 145 deletions(-) diff --git a/examples/blinky.rs b/examples/blinky.rs index 05a0a6fb..35c8caeb 100644 --- a/examples/blinky.rs +++ b/examples/blinky.rs @@ -29,12 +29,12 @@ fn main() -> ! { loop { info!("Set Led low"); for _ in 0..10_000_000 { - led.set_low().unwrap(); + led.set_low(); } info!("Set Led High"); for _ in 0..10_000_000 { - led.set_high().unwrap(); + led.set_high(); } } } diff --git a/examples/blinky_delay.rs b/examples/blinky_delay.rs index 8b55119f..35e9b5ea 100644 --- a/examples/blinky_delay.rs +++ b/examples/blinky_delay.rs @@ -40,11 +40,11 @@ fn main() -> ! { loop { info!("Toggle"); - led.toggle().unwrap(); + led.toggle(); info!("SYST delay"); delay_syst.delay(1000.millis()); info!("Toggle"); - led.toggle().unwrap(); + led.toggle(); info!("TIM2 delay"); delay_tim2.delay_ms(1000); } diff --git a/examples/button.rs b/examples/button.rs index 7064e363..766cf33a 100644 --- a/examples/button.rs +++ b/examples/button.rs @@ -14,7 +14,6 @@ use core::cell::RefCell; use core::sync::atomic::{AtomicBool, Ordering}; use cortex_m::{asm::wfi, interrupt::Mutex}; use cortex_m_rt::entry; -use embedded_hal::digital::OutputPin; type ButtonPin = gpio::PC13>; @@ -86,10 +85,10 @@ fn main() -> ! { if G_LED_ON.load(Ordering::Relaxed) { println!("Turn Led On!"); - led.set_high().unwrap(); + led.set_high(); } else { println!("Turn Led Off!"); - led.set_low().unwrap(); + led.set_low(); } } } diff --git a/examples/can-echo.rs b/examples/can-echo.rs index 3126e0d4..5301ad8a 100644 --- a/examples/can-echo.rs +++ b/examples/can-echo.rs @@ -57,8 +57,8 @@ fn main() -> ! { let can1 = { info!("Init CAN 1"); - let rx = gpiob.pb8.into_alternate().set_speed(Speed::VeryHigh); - let tx = gpiob.pb9.into_alternate().set_speed(Speed::VeryHigh); + let rx = gpiob.pb8.into_alternate().speed(Speed::VeryHigh); + let tx = gpiob.pb9.into_alternate().speed(Speed::VeryHigh); info!("-- Create CAN 1 instance"); let mut can = dp.FDCAN1.fdcan(tx, rx, &rcc); @@ -82,8 +82,8 @@ fn main() -> ! { // let can2 = { // info!("Init CAN 2"); - // let rx = gpiob.pb5.into_alternate().set_speed(Speed::VeryHigh); - // let tx = gpiob.pb13.into_alternate().set_speed(Speed::VeryHigh); + // let rx = gpiob.pb5.into_alternate().speed(Speed::VeryHigh); + // let tx = gpiob.pb13.into_alternate().speed(Speed::VeryHigh); // info!("-- Create CAN 2 instance"); // let mut can = dp.FDCAN2.fdcan(tx, rx, &rcc); diff --git a/examples/comp.rs b/examples/comp.rs index e06635ec..1b4deb5a 100644 --- a/examples/comp.rs +++ b/examples/comp.rs @@ -17,7 +17,6 @@ use rt::entry; fn main() -> ! { use hal::comparator::{refint_input, ComparatorExt, ComparatorSplit, Config, Hysteresis}; use hal::gpio::GpioExt; - use hal::prelude::OutputPin; use hal::rcc::RccExt; use hal::stm32; use stm32g4xx_hal as hal; @@ -55,8 +54,8 @@ fn main() -> ! { loop { // Read comp1 output and update led1 accordingly match comp1.output() { - true => led1.set_high().unwrap(), - false => led1.set_low().unwrap(), + true => led1.set_high(), + false => led1.set_low(), } } } diff --git a/examples/spi-example.rs b/examples/spi-example.rs index 33b86c2b..34194167 100644 --- a/examples/spi-example.rs +++ b/examples/spi-example.rs @@ -45,7 +45,7 @@ fn main() -> ! { .SPI1 .spi((sclk, miso, mosi), spi::MODE_0, 400.kHz(), &mut rcc); let mut cs = gpioa.pa8.into_push_pull_output(); - cs.set_high().unwrap(); + cs.set_high(); // "Hello world!" let message = b"Hello world!"; @@ -53,10 +53,10 @@ fn main() -> ! { loop { for &byte in message { - cs.set_low().unwrap(); + cs.set_low(); spi.send(byte).unwrap(); received_byte = nb::block!(FullDuplex::read(&mut spi)).unwrap(); - cs.set_high().unwrap(); + cs.set_high(); info!("{}", received_byte as char); } diff --git a/examples/spi-sd.rs b/examples/spi-sd.rs index 6a98d877..89305077 100644 --- a/examples/spi-sd.rs +++ b/examples/spi-sd.rs @@ -35,7 +35,7 @@ fn main() -> ! { let cs = { let mut cs = gpiof.pf8.into_push_pull_output(); - cs.set_high().unwrap(); + cs.set_high(); cs }; diff --git a/examples/uart-dma-tx.rs b/examples/uart-dma-tx.rs index 544e84ec..c52b10e6 100644 --- a/examples/uart-dma-tx.rs +++ b/examples/uart-dma-tx.rs @@ -75,7 +75,7 @@ fn main() -> ! { while !transfer.get_transfer_complete_flag() {} delay_syst.delay(1000.millis()); - led.toggle().unwrap(); + led.toggle(); transfer.restart(|_tx| {}); } } diff --git a/examples/usb_serial.rs b/examples/usb_serial.rs index 59e43328..96cc320e 100644 --- a/examples/usb_serial.rs +++ b/examples/usb_serial.rs @@ -31,7 +31,7 @@ fn main() -> ! { let gpioa = dp.GPIOA.split(&mut rcc); let mut led = gpioa.pa5.into_push_pull_output(); - led.set_low().ok(); + led.set_low(); let usb_dm = gpioa.pa11.into_alternate(); let usb_dp = gpioa.pa12.into_alternate(); @@ -63,7 +63,7 @@ fn main() -> ! { match serial.read(&mut buf) { Ok(count) if count > 0 => { - led.set_high().ok(); + led.set_high(); // Echo back in upper case for c in buf[0..count].iter_mut() { @@ -85,6 +85,6 @@ fn main() -> ! { _ => {} } - led.set_low().ok(); + led.set_low(); } } diff --git a/src/gpio.rs b/src/gpio.rs index dddf0af1..9f374b0d 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -5,6 +5,8 @@ use crate::rcc::{Enable, Rcc, Reset}; use crate::stm32::EXTI; use crate::syscfg::SysCfg; +use crate::pac; + /// Default pin mode pub type DefaultMode = Input; @@ -49,17 +51,39 @@ pub struct Output { pub struct PushPull; /// GPIO Pin speed selection +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum Speed { + /// Low speed Low = 0, + /// Medium speed Medium = 1, + /// High speed High = 2, + /// Very high speed VeryHigh = 3, } -/// Trigger edgw +impl From for pac::gpioa::ospeedr::OUTPUT_SPEED { + fn from(value: Speed) -> Self { + match value { + Speed::Low => Self::LowSpeed, + Speed::Medium => Self::MediumSpeed, + Speed::High => Self::HighSpeed, + Speed::VeryHigh => Self::VeryHighSpeed, + } + } +} + +/// GPIO interrupt trigger edge selection +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum SignalEdge { + /// Rising edge of voltage Rising, + /// Falling edge of voltage Falling, + /// Rising and falling edge of voltage RisingFalling, } @@ -250,7 +274,6 @@ macro_rules! gpio { /// GPIO pub mod $gpiox { use core::marker::PhantomData; - use embedded_hal_old::digital::v2::{toggleable, InputPin, OutputPin, StatefulOutputPin}; use crate::stm32::{EXTI, $GPIOX}; use crate::exti::{ExtiExt, Event}; use crate::rcc::Rcc; @@ -284,126 +307,150 @@ macro_rules! gpio { _mode: PhantomData, } - impl OutputPin for $PXx> { + impl $PXx> { + pub fn set_high(&mut self) { + // NOTE(unsafe) atomic write to a stateless register + unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.bs(self.i).set_bit()) }; + } + + pub fn set_low(&mut self) { + // NOTE(unsafe) atomic write to a stateless register + unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.br(self.i).set_bit()) }; + } + + pub fn is_set_high(&self) -> bool { + !self.is_set_low() + } + + pub fn is_set_low(&self) -> bool { + // NOTE(unsafe) atomic read with no side effects + unsafe { (*$GPIOX::ptr()).odr().read().odr(self.i).is_low()} + } + + pub fn toggle(&mut self) { + if self.is_set_low() { + self.set_high() + } else { + self.set_low() + } + } + } + + impl embedded_hal_old::digital::v2::OutputPin for $PXx> { type Error = (); fn set_high(&mut self) -> Result<(), ()> { - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.bs(self.i).set_bit()) }; + self.set_high(); Ok(()) } fn set_low(&mut self) -> Result<(), ()> { - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.br(self.i).set_bit()) }; + self.set_low(); Ok(()) } } - impl embedded_hal::digital::ErrorType for $PXx> { + impl embedded_hal::digital::ErrorType for $PXx { type Error = core::convert::Infallible; } impl embedded_hal::digital::OutputPin for $PXx> { fn set_high(&mut self) -> Result<(), Self::Error> { - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.bs(self.i).set_bit()) }; + self.set_high(); Ok(()) } fn set_low(&mut self) -> Result<(), Self::Error> { - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.br(self.i).set_bit()) }; + self.set_low(); Ok(()) } } - impl StatefulOutputPin for $PXx> { + impl embedded_hal_old::digital::v2::StatefulOutputPin for $PXx> { fn is_set_high(&self) -> Result { - let is_set_high = !self.is_set_low()?; - Ok(is_set_high) + Ok(self.is_set_high()) } fn is_set_low(&self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_set_low = unsafe { (*$GPIOX::ptr()).odr().read().odr(self.i).is_low()}; - Ok(is_set_low) + Ok(self.is_set_low()) } } impl embedded_hal::digital::StatefulOutputPin for $PXx> { fn is_set_high(&mut self) -> Result { - let is_set_high = !self.is_set_low()?; - Ok(is_set_high) + Ok((*self).is_set_high()) } fn is_set_low(&mut self) -> Result { + Ok((*self).is_set_low()) + } + } + + impl $PXx> { + pub fn is_high(&self) -> bool { + !self.is_low() + } + + pub fn is_low(&self) -> bool { // NOTE(unsafe) atomic read with no side effects - let is_set_low = unsafe { (*$GPIOX::ptr()).odr().read().odr(self.i).is_low() }; - Ok(is_set_low) + unsafe { (*$GPIOX::ptr()).idr().read().idr(self.i).is_low() } } } - impl toggleable::Default for $PXx> {} + impl embedded_hal_old::digital::v2::toggleable::Default for $PXx> {} - impl InputPin for $PXx> { + impl embedded_hal_old::digital::v2::InputPin for $PXx> { type Error = (); fn is_high(&self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok(self.is_high()) } fn is_low(&self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr(self.i).is_low() }; - Ok(is_low) + Ok(self.is_low()) } } - impl embedded_hal::digital::InputPin for $PXx> { + impl embedded_hal::digital::InputPin for $PXx> { fn is_high(&mut self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok((*self).is_high()) } fn is_low(&mut self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr(self.i).is_low() }; - Ok(is_low) + Ok((*self).is_low()) } } + impl $PXx> { + pub fn is_high(&self) -> bool { + !self.is_low() + } - impl InputPin for $PXx> { + pub fn is_low(&self) -> bool { + // NOTE(unsafe) atomic read with no side effects + unsafe { (*$GPIOX::ptr()).idr().read().idr(self.i).is_low() } + } + } + + impl embedded_hal_old::digital::v2::InputPin for $PXx> { type Error = (); fn is_high(&self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok(self.is_high()) } fn is_low(&self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr(self.i).is_low() }; - Ok(is_low) + Ok(self.is_low()) } } - impl embedded_hal::digital::ErrorType for $PXx> { - type Error = core::convert::Infallible; - } - impl embedded_hal::digital::InputPin for $PXx> { fn is_high(&mut self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok((*self).is_high()) } fn is_low(&mut self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr(self.i).is_low() }; - Ok(is_low) + Ok((*self).is_low()) } } @@ -552,13 +599,16 @@ macro_rules! gpio { } /// Set pin speed - pub fn set_speed(self, speed: Speed) -> Self { - let offset = 2 * $i; + pub fn set_speed(&mut self, speed: Speed) { unsafe { - (*$GPIOX::ptr()).ospeedr().modify(|r, w| { - w.bits((r.bits() & !(0b11 << offset)) | ((speed as u32) << offset)) - }); + (*$GPIOX::ptr()).ospeedr() + .modify(|_, w| w.ospeedr($i).variant(speed.into())); } + } + + /// Set pin speed + pub fn speed(mut self, speed: Speed) -> Self { + self.set_speed(speed); self } @@ -619,95 +669,117 @@ macro_rules! gpio { pub fn downgrade(self) -> $PXx> { $PXx { i: $i, _mode: self._mode } } + + pub fn set_high(&mut self) { + // NOTE(unsafe) atomic write to a stateless register + unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.bs($i).set_bit()) }; + } + + pub fn set_low(&mut self) { + // NOTE(unsafe) atomic write to a stateless register + unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.br($i).set_bit()) }; + } + + pub fn is_set_high(&self) -> bool { + !self.is_set_low() + } + + pub fn is_set_low(&self) -> bool { + // NOTE(unsafe) atomic read with no side effects + unsafe { (*$GPIOX::ptr()).odr().read().odr($i).is_low()} + } + + pub fn toggle(&mut self) { + if self.is_set_low() { + self.set_high() + } else { + self.set_low() + } + } } - impl OutputPin for $PXi> { + impl embedded_hal_old::digital::v2::OutputPin for $PXi> { type Error = (); fn set_high(&mut self) -> Result<(), ()> { - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.bs($i).set_bit()) }; + self.set_high(); Ok(()) } fn set_low(&mut self) -> Result<(), ()>{ - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.br($i).set_bit()) }; + self.set_low(); Ok(()) } } - impl embedded_hal::digital::ErrorType for $PXi> { + impl embedded_hal::digital::ErrorType for $PXi { type Error = core::convert::Infallible; } impl embedded_hal::digital::OutputPin for $PXi> { fn set_high(&mut self) -> Result<(), Self::Error> { - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.bs($i).set_bit()) }; + self.set_high(); Ok(()) } fn set_low(&mut self) -> Result<(), Self::Error>{ - // NOTE(unsafe) atomic write to a stateless register - unsafe { (*$GPIOX::ptr()).bsrr().write(|w| w.br($i).set_bit()) }; + self.set_low(); Ok(()) } } - impl StatefulOutputPin for $PXi> { + impl embedded_hal_old::digital::v2::StatefulOutputPin for $PXi> { fn is_set_high(&self) -> Result { - let is_set_high = !self.is_set_low()?; - Ok(is_set_high) + Ok(self.is_set_high()) } fn is_set_low(&self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_set_low = unsafe { (*$GPIOX::ptr()).odr().read().odr($i).is_low()}; - Ok(is_set_low) + Ok(self.is_set_low()) } } impl embedded_hal::digital::StatefulOutputPin for $PXi> { fn is_set_high(&mut self) -> Result { - let is_set_high = !self.is_set_low()?; - Ok(is_set_high) + Ok((*self).is_set_high()) } fn is_set_low(&mut self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_set_low = unsafe { (*$GPIOX::ptr()).odr().read().odr($i).is_low() }; - Ok(is_set_low) + Ok((*self).is_set_low()) } } - impl toggleable::Default for $PXi> {} + impl embedded_hal_old::digital::v2::toggleable::Default for $PXi> {} + + impl $PXi> { + pub fn is_high(&self) -> bool { + !self.is_low() + } - impl InputPin for $PXi> { + pub fn is_low(&self) -> bool { + // NOTE(unsafe) atomic read with no side effects + unsafe { (*$GPIOX::ptr()).idr().read().idr($i).is_low() } + } + } + + impl embedded_hal_old::digital::v2::InputPin for $PXi> { type Error = (); fn is_high(&self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok(self.is_high()) } fn is_low(&self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr($i).is_low() }; - Ok(is_low) + Ok(self.is_low()) } } - impl embedded_hal::digital::InputPin for $PXi> { + impl embedded_hal::digital::InputPin for $PXi> { fn is_high(&mut self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok((*self).is_high()) } fn is_low(&mut self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr($i).is_low() }; - Ok(is_low) + Ok((*self).is_low()) } } @@ -719,37 +791,36 @@ macro_rules! gpio { pub fn downgrade(self) -> $PXx> { $PXx { i: $i, _mode: self._mode } } - } - impl embedded_hal::digital::ErrorType for $PXi> { - type Error = core::convert::Infallible; + pub fn is_high(&self) -> bool { + !self.is_low() + } + + pub fn is_low(&self) -> bool { + // NOTE(unsafe) atomic read with no side effects + unsafe { (*$GPIOX::ptr()).idr().read().idr($i).is_low() } + } } impl embedded_hal::digital::InputPin for $PXi> { fn is_high(&mut self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok((*self).is_high()) } fn is_low(&mut self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr($i).is_low()}; - Ok(is_low) + Ok((*self).is_low()) } } - impl InputPin for $PXi> { + impl embedded_hal_old::digital::v2::InputPin for $PXi> { type Error = (); fn is_high(&self) -> Result { - let is_high = !self.is_low()?; - Ok(is_high) + Ok(self.is_high()) } fn is_low(&self) -> Result { - // NOTE(unsafe) atomic read with no side effects - let is_low = unsafe { (*$GPIOX::ptr()).idr().read().idr($i).is_low()}; - Ok(is_low) + Ok(self.is_low()) } } diff --git a/src/prelude.rs b/src/prelude.rs index afb06da5..0e624c06 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,10 +1,4 @@ -pub use embedded_hal::{ - delay::DelayNs, - digital::{InputPin, OutputPin, StatefulOutputPin}, - i2c::I2c, - pwm::SetDutyCycle, - spi::SpiBus, -}; +pub use embedded_hal::{delay::DelayNs, i2c::I2c, pwm::SetDutyCycle, spi::SpiBus}; pub use embedded_hal_old::{ adc::OneShot as _, diff --git a/tests/nucleo-g474.rs b/tests/nucleo-g474.rs index 8d142796..7172e2e1 100644 --- a/tests/nucleo-g474.rs +++ b/tests/nucleo-g474.rs @@ -27,11 +27,7 @@ pub fn now() -> MicrosDurationU32 { #[defmt_test::tests] mod tests { - use embedded_hal::{ - delay::DelayNs, - digital::{InputPin, OutputPin}, - pwm::SetDutyCycle, - }; + use embedded_hal::{delay::DelayNs, pwm::SetDutyCycle}; use fixed::types::I1F15; use fugit::RateExtU32; use stm32g4xx_hal::{ @@ -67,17 +63,17 @@ mod tests { let _pa1_important_dont_use_as_output = gpioa.pa1.into_floating_input(); let mut pin = gpioa.pa8.into_push_pull_output(); - pin.set_high().unwrap(); + pin.set_high(); delay.delay(1.millis()); // Give the pin plenty of time to go high - assert!(pin.is_high().unwrap()); + assert!(pin.is_high()); { let gpioa = unsafe { &*GPIOA::PTR }; assert!(!is_pax_low(gpioa, 8)); } - pin.set_low().unwrap(); + pin.set_low(); delay.delay(1.millis()); // Give the pin plenty of time to go low - assert!(pin.is_low().unwrap()); + assert!(pin.is_low()); { let gpioa = unsafe { &*GPIOA::PTR }; assert!(is_pax_low(gpioa, 8)); @@ -104,17 +100,17 @@ mod tests { gpioa.pupdr().modify(|_, w| w.pupdr8().pull_up()); } - pin.set_high().unwrap(); + pin.set_high(); delay.delay(1.millis()); // Give the pin plenty of time to go high - assert!(pin.is_high().unwrap()); + assert!(pin.is_high()); { let gpioa = unsafe { &*GPIOA::PTR }; assert!(!is_pax_low(gpioa, 8)); } - pin.set_low().unwrap(); + pin.set_low(); delay.delay(1.millis()); // Give the pin plenty of time to go low - assert!(pin.is_low().unwrap()); + assert!(pin.is_low()); { let gpioa = unsafe { &*GPIOA::PTR }; assert!(is_pax_low(gpioa, 8)); From 996f47c609a4244a839f35ae6f00932e0516387c Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Wed, 28 May 2025 00:08:11 +0300 Subject: [PATCH 2/2] test --- tests/nucleo-g474.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/nucleo-g474.rs b/tests/nucleo-g474.rs index 7172e2e1..40aac3d2 100644 --- a/tests/nucleo-g474.rs +++ b/tests/nucleo-g474.rs @@ -65,7 +65,6 @@ mod tests { pin.set_high(); delay.delay(1.millis()); // Give the pin plenty of time to go high - assert!(pin.is_high()); { let gpioa = unsafe { &*GPIOA::PTR }; assert!(!is_pax_low(gpioa, 8)); @@ -73,7 +72,6 @@ mod tests { pin.set_low(); delay.delay(1.millis()); // Give the pin plenty of time to go low - assert!(pin.is_low()); { let gpioa = unsafe { &*GPIOA::PTR }; assert!(is_pax_low(gpioa, 8));