Apply suggestions from code review

Co-authored-by: Romain Reignier <romainreignier@users.noreply.github.com>
This commit is contained in:
Bruno Bousquet 2024-05-29 09:14:05 -04:00 committed by GitHub
parent 7f4803ddaf
commit a23fa8dcb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
//! Input capture driver. //! PWM Input driver.
use embassy_hal_internal::into_ref; use embassy_hal_internal::into_ref;
@ -8,7 +8,7 @@ use crate::gpio::{AFType, Pull};
use crate::time::Hertz; use crate::time::Hertz;
use crate::Peripheral; use crate::Peripheral;
/// Input capture driver. /// PWM Input driver.
pub struct PwmInput<'d, T: GeneralInstance4Channel> { pub struct PwmInput<'d, T: GeneralInstance4Channel> {
channel: Channel, channel: Channel,
inner: Timer<'d, T>, inner: Timer<'d, T>,
@ -20,7 +20,7 @@ fn regs_gp16(ptr: *mut ()) -> crate::pac::timer::TimGp16 {
} }
impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> { impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> {
/// Create a new input capture driver. /// Create a new PWM input driver.
pub fn new( pub fn new(
tim: impl Peripheral<P = T> + 'd, tim: impl Peripheral<P = T> + 'd,
pin: impl Peripheral<P = impl Channel1Pin<T>> + 'd, pin: impl Peripheral<P = impl Channel1Pin<T>> + 'd,
@ -37,7 +37,7 @@ impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> {
Self::new_inner(tim, freq, Channel::Ch1, Channel::Ch2) Self::new_inner(tim, freq, Channel::Ch1, Channel::Ch2)
} }
/// Create a new input capture driver. /// Create a new PWM input driver.
pub fn new_alt( pub fn new_alt(
tim: impl Peripheral<P = T> + 'd, tim: impl Peripheral<P = T> + 'd,
pin: impl Peripheral<P = impl Channel2Pin<T>> + 'd, pin: impl Peripheral<P = impl Channel2Pin<T>> + 'd,

View File

@ -43,7 +43,7 @@ async fn main(spawner: Spawner) {
let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default()); let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default());
loop { loop {
info!("wait for risign edge"); info!("wait for rising edge");
ic.wait_for_rising_edge(Channel::Ch3).await; ic.wait_for_rising_edge(Channel::Ch3).await;
let capture_value = ic.get_capture_value(Channel::Ch3); let capture_value = ic.get_capture_value(Channel::Ch3);

View File

@ -11,7 +11,7 @@ use embassy_stm32::{bind_interrupts, peripherals, timer};
use embassy_time::Timer; use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
/// Connect PB2 and PB10 with a 1k Ohm resistor /// Connect PA0 and PC13 with a 1k Ohm resistor
#[embassy_executor::task] #[embassy_executor::task]
async fn blinky(led: peripherals::PC13) { async fn blinky(led: peripherals::PC13) {

View File

@ -11,7 +11,7 @@ use embassy_stm32::{bind_interrupts, peripherals, timer};
use embassy_time::Timer; use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
/// Connect PB2 and PB10 with a 1k Ohm resistor /// Connect PB2 and PA6 with a 1k Ohm resistor
#[embassy_executor::task] #[embassy_executor::task]
async fn blinky(led: peripherals::PB2) { async fn blinky(led: peripherals::PB2) {