diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e542c89d2..fab8679c5fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add initial LP-IO support for ESP32-C6 (#639) - Implement sleep with some wakeup methods for `esp32` (#574) -- Add a new RMT driver (#653) +- Add a new RMT driver (#653, #667) ### Changed diff --git a/esp-hal-common/src/rmt.rs b/esp-hal-common/src/rmt.rs index cd1ccd4b609..d6254259a80 100644 --- a/esp-hal-common/src/rmt.rs +++ b/esp-hal-common/src/rmt.rs @@ -28,7 +28,7 @@ //! signals. //! * The **ESP32-S2** has 4 channels, each of them can be either receiver or //! transmitter. -//! * The **ESP32-S3** has 8 channels, `Channel0`-`Channel3` hardcdoded for +//! * The **ESP32-S3** has 8 channels, `Channel0`-`Channel3` hardcoded for //! transmitting signals and `Channel4`-`Channel7` hardcoded for receiving //! signals. //! @@ -103,7 +103,7 @@ pub enum Error { /// Convenience representation of a pulse code entry. /// -/// Allows for the assignment of two levels and their lenghts +/// Allows for the assignment of two levels and their lengths #[derive(Clone, Copy, Debug, Default)] pub struct PulseCode { /// Logical output level in the first pulse code interval @@ -386,21 +386,21 @@ where } } -/// An in-progress continous TX transaction -pub struct ContinousTxTransaction +/// An in-progress continuous TX transaction +pub struct ContinuousTxTransaction where C: TxChannel, { channel: C, } -impl ContinousTxTransaction +impl ContinuousTxTransaction where C: TxChannel, { /// Stop transaction when the current iteration ends. pub fn stop_next(self) -> Result { - >::set_continous(false); + >::set_continuous(false); >::update(); loop { @@ -418,7 +418,7 @@ where /// Stop transaction as soon as possible. pub fn stop(self) -> Result { - >::set_continous(false); + >::set_continuous(false); >::update(); let ptr = (constants::RMT_RAM_START @@ -791,7 +791,7 @@ pub struct Channel7 {} pub trait TxChannel: private::TxChannelInternal { /// Start transmitting the given pulse code sequence. - /// This returns a [SingleShotTxTransaction] which can be used to wait for + /// This returns a [`SingleShotTxTransaction`] which can be used to wait for /// the transaction to complete and get back the channel for further /// use. fn transmit<'a, T: Into + Copy>( @@ -809,28 +809,28 @@ pub trait TxChannel: private::TxChannelInternal { } } - /// Start transmitting the given pulse code continously. - /// This returns a [ContinousTxTransaction] which can be used to stop the + /// Start transmitting the given pulse code continuously. + /// This returns a [`ContinuousTxTransaction`] which can be used to stop the /// ongoing transmission and get back the channel for further use. /// The length of sequence cannot exceed the size of the allocated RMT RAM. - fn transmit_continously<'a, T: Into + Copy>( + fn transmit_continuously<'a, T: Into + Copy>( self, data: &'a [T], - ) -> Result, Error> + ) -> Result, Error> where Self: Sized, { - self.transmit_continously_with_loopcount(0, data) + self.transmit_continuously_with_loopcount(0, data) } - /// Like [transmit_continously] but also sets a loop count. - /// [ContinousTxTransaction] can be used to check if the loop count is + /// Like [`Self::transmit_continuously`] but also sets a loop count. + /// [`ContinuousTxTransaction`] can be used to check if the loop count is /// reached. - fn transmit_continously_with_loopcount<'a, T: Into + Copy>( + fn transmit_continuously_with_loopcount<'a, T: Into + Copy>( self, loopcount: u16, data: &'a [T], - ) -> Result, Error> + ) -> Result, Error> where Self: Sized, { @@ -839,7 +839,7 @@ pub trait TxChannel: private::TxChannelInternal { } let _index = Self::send_raw(data, true, loopcount); - Ok(ContinousTxTransaction { channel: self }) + Ok(ContinuousTxTransaction { channel: self }) } } @@ -928,7 +928,7 @@ mod private { fn clear_interrupts(); - fn set_continous(continous: bool); + fn set_continuous(continuous: bool); fn set_wrap_mode(wrap: bool); @@ -952,7 +952,7 @@ mod private { fn is_loopcount_interrupt_set() -> bool; - fn send_raw + Copy>(data: &[T], continous: bool, repeat: u16) -> usize { + fn send_raw + Copy>(data: &[T], continuous: bool, repeat: u16) -> usize { Self::clear_interrupts(); let ptr = (constants::RMT_RAM_START @@ -969,7 +969,7 @@ mod private { } Self::set_threshold((constants::RMT_CHANNEL_RAM_SIZE / 2) as u8); - Self::set_continous(continous); + Self::set_continuous(continuous); Self::set_generate_repeat_interrupt(repeat); Self::set_wrap_mode(true); Self::set_memsize(1); @@ -1130,10 +1130,10 @@ mod chip_specific { }); } - fn set_continous(continous: bool) { + fn set_continuous(continuous: bool) { let rmt = unsafe { &*crate::peripherals::RMT::PTR }; - rmt.ch_tx_conf0[$num].modify(|_, w| w.tx_conti_mode().bit(continous)); + rmt.ch_tx_conf0[$num].modify(|_, w| w.tx_conti_mode().bit(continuous)); } fn set_wrap_mode(wrap: bool) { @@ -1414,10 +1414,10 @@ mod chip_specific { }); } - fn set_continous(continous: bool) { + fn set_continuous(continuous: bool) { let rmt = unsafe { &*crate::peripherals::RMT::PTR }; - rmt.[< ch $ch_num conf1 >].modify(|_, w| w.tx_conti_mode().bit(continous)); + rmt.[< ch $ch_num conf1 >].modify(|_, w| w.tx_conti_mode().bit(continuous)); } fn set_wrap_mode(_wrap: bool) {