Skip to main content

SyncManager

Struct SyncManager 

Source
pub struct SyncManager<'d, const N: usize> { /* private fields */ }
Expand description

In some real-time control applications (e.g., to make two robotic arms move simultaneously), you do not want any time drift between different channels. The RMT driver can help to manage this by creating a so-called Sync Manager.

The procedure of RMT sync transmission is shown here.

Implementations§

Source§

impl<'d, const N: usize> SyncManager<'d, N>

Source

pub fn new(channels: [TxChannelDriver<'d>; N]) -> Result<Self, EspError>

Create a synchronization manager for multiple TX channels, so that the managed channel can start transmitting at the same time.

§Note

All the channels managed by the sync manager should be enabled before creating the sync manager.

§Errors
  • ESP_ERR_INVALID_ARG: Create sync manager failed because of invalid argument
  • ESP_ERR_NOT_SUPPORTED: Create sync manager failed because it is not supported by hardware
  • ESP_ERR_INVALID_STATE: Create sync manager failed because not all channels are enabled
  • ESP_ERR_NO_MEM: Create sync manager failed because out of memory
  • ESP_ERR_NOT_FOUND: Create sync manager failed because all sync controllers are used up and no more free one
  • ESP_FAIL: Create sync manager failed because of other error
Source

pub fn reset(&mut self) -> Result<(), EspError>

Reset synchronization manager.

§Errors
  • ESP_ERR_INVALID_ARG: Reset the synchronization manager failed because of invalid argument
  • ESP_FAIL: Reset the synchronization manager failed because of other error
Source

pub fn channels_mut(&mut self) -> &mut [TxChannelDriver<'d>; N]

Returns a mutable reference to the managed TX channels.

Source

pub fn channels(&self) -> &[TxChannelDriver<'d>; N]

Returns a reference to the managed TX channels.

Source

pub fn into_channels(self) -> [TxChannelDriver<'d>; N]

Consumes the sync manager and returns the managed TX channels.

Trait Implementations§

Source§

impl<'d, const N: usize> Drop for SyncManager<'d, N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'d, const N: usize> Freeze for SyncManager<'d, N>

§

impl<'d, const N: usize> !RefUnwindSafe for SyncManager<'d, N>

§

impl<'d, const N: usize> !Send for SyncManager<'d, N>

§

impl<'d, const N: usize> !Sync for SyncManager<'d, N>

§

impl<'d, const N: usize> Unpin for SyncManager<'d, N>

§

impl<'d, const N: usize> UnsafeUnpin for SyncManager<'d, N>

§

impl<'d, const N: usize> !UnwindSafe for SyncManager<'d, N>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.