Skip to content

Commit

Permalink
Fix RMT spelling (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani authored Jul 21, 2023
1 parent 28ac202 commit d89bd54
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
50 changes: 25 additions & 25 deletions esp-hal-common/src/rmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//!
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -386,21 +386,21 @@ where
}
}

/// An in-progress continous TX transaction
pub struct ContinousTxTransaction<C, const CHANNEL: u8>
/// An in-progress continuous TX transaction
pub struct ContinuousTxTransaction<C, const CHANNEL: u8>
where
C: TxChannel<CHANNEL>,
{
channel: C,
}

impl<C, const CHANNEL: u8> ContinousTxTransaction<C, CHANNEL>
impl<C, const CHANNEL: u8> ContinuousTxTransaction<C, CHANNEL>
where
C: TxChannel<CHANNEL>,
{
/// Stop transaction when the current iteration ends.
pub fn stop_next(self) -> Result<C, (Error, C)> {
<C as private::TxChannelInternal<CHANNEL>>::set_continous(false);
<C as private::TxChannelInternal<CHANNEL>>::set_continuous(false);
<C as private::TxChannelInternal<CHANNEL>>::update();

loop {
Expand All @@ -418,7 +418,7 @@ where

/// Stop transaction as soon as possible.
pub fn stop(self) -> Result<C, (Error, C)> {
<C as private::TxChannelInternal<CHANNEL>>::set_continous(false);
<C as private::TxChannelInternal<CHANNEL>>::set_continuous(false);
<C as private::TxChannelInternal<CHANNEL>>::update();

let ptr = (constants::RMT_RAM_START
Expand Down Expand Up @@ -791,7 +791,7 @@ pub struct Channel7<const CHANNEL: u8> {}

pub trait TxChannel<const CHANNEL: u8>: private::TxChannelInternal<CHANNEL> {
/// 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<u32> + Copy>(
Expand All @@ -809,28 +809,28 @@ pub trait TxChannel<const CHANNEL: u8>: private::TxChannelInternal<CHANNEL> {
}
}

/// 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<u32> + Copy>(
fn transmit_continuously<'a, T: Into<u32> + Copy>(
self,
data: &'a [T],
) -> Result<ContinousTxTransaction<Self, CHANNEL>, Error>
) -> Result<ContinuousTxTransaction<Self, CHANNEL>, 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<u32> + Copy>(
fn transmit_continuously_with_loopcount<'a, T: Into<u32> + Copy>(
self,
loopcount: u16,
data: &'a [T],
) -> Result<ContinousTxTransaction<Self, CHANNEL>, Error>
) -> Result<ContinuousTxTransaction<Self, CHANNEL>, Error>
where
Self: Sized,
{
Expand All @@ -839,7 +839,7 @@ pub trait TxChannel<const CHANNEL: u8>: private::TxChannelInternal<CHANNEL> {
}

let _index = Self::send_raw(data, true, loopcount);
Ok(ContinousTxTransaction { channel: self })
Ok(ContinuousTxTransaction { channel: self })
}
}

Expand Down Expand Up @@ -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);

Expand All @@ -952,7 +952,7 @@ mod private {

fn is_loopcount_interrupt_set() -> bool;

fn send_raw<T: Into<u32> + Copy>(data: &[T], continous: bool, repeat: u16) -> usize {
fn send_raw<T: Into<u32> + Copy>(data: &[T], continuous: bool, repeat: u16) -> usize {
Self::clear_interrupts();

let ptr = (constants::RMT_RAM_START
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d89bd54

Please sign in to comment.