esp-hal: remove warnings in PCNT example and HIL test (#1793)

This commit is contained in:
Juraj Sadel 2024-07-15 12:49:39 +02:00 committed by GitHub
parent 0cae79b4cc
commit 45c8107ecd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 8 deletions

View File

@ -41,14 +41,14 @@ fn main() -> ! {
// Set up a pulse counter: // Set up a pulse counter:
println!("setup pulse counter unit 0"); println!("setup pulse counter unit 0");
let pcnt = Pcnt::new(peripherals.PCNT, Some(interrupt_handler)); let pcnt = Pcnt::new(peripherals.PCNT, Some(interrupt_handler));
let mut u0 = pcnt.unit1; let u0 = pcnt.unit1;
u0.set_low_limit(Some(-100)).unwrap(); u0.set_low_limit(Some(-100)).unwrap();
u0.set_high_limit(Some(100)).unwrap(); u0.set_high_limit(Some(100)).unwrap();
u0.set_filter(Some(min(10u16 * 80, 1023u16))).unwrap(); u0.set_filter(Some(min(10u16 * 80, 1023u16))).unwrap();
u0.clear(); u0.clear();
println!("setup channel 0"); println!("setup channel 0");
let mut ch0 = &u0.channel0; let ch0 = &u0.channel0;
let mut pin_a = io.pins.gpio4; let mut pin_a = io.pins.gpio4;
let mut pin_b = io.pins.gpio5; let mut pin_b = io.pins.gpio5;
@ -64,7 +64,7 @@ fn main() -> ! {
ch0.set_input_mode(channel::EdgeMode::Increment, channel::EdgeMode::Decrement); ch0.set_input_mode(channel::EdgeMode::Increment, channel::EdgeMode::Decrement);
println!("setup channel 1"); println!("setup channel 1");
let mut ch1 = &u0.channel1; let ch1 = &u0.channel1;
ch1.set_ctrl_signal(PcntSource::from_pin( ch1.set_ctrl_signal(PcntSource::from_pin(
&mut pin_b, &mut pin_b,
PcntInputConfig { pull: Pull::Up }, PcntInputConfig { pull: Pull::Up },

View File

@ -25,11 +25,7 @@ mod tests {
clock::ClockControl, clock::ClockControl,
delay::Delay, delay::Delay,
gpio::{Io, Level, Output, Pull}, gpio::{Io, Level, Output, Pull},
pcnt::{ pcnt::channel::{EdgeMode, PcntInputConfig, PcntSource},
channel,
channel::{CtrlMode, EdgeMode, PcntInputConfig, PcntSource},
unit,
},
peripherals::Peripherals, peripherals::Peripherals,
system::SystemControl, system::SystemControl,
}; };