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>
impl<'d, const N: usize> SyncManager<'d, N>
Sourcepub fn new(channels: [TxChannelDriver<'d>; N]) -> Result<Self, EspError>
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 argumentESP_ERR_NOT_SUPPORTED: Create sync manager failed because it is not supported by hardwareESP_ERR_INVALID_STATE: Create sync manager failed because not all channels are enabledESP_ERR_NO_MEM: Create sync manager failed because out of memoryESP_ERR_NOT_FOUND: Create sync manager failed because all sync controllers are used up and no more free oneESP_FAIL: Create sync manager failed because of other error
Sourcepub fn reset(&mut self) -> Result<(), EspError>
pub fn reset(&mut self) -> Result<(), EspError>
Reset synchronization manager.
§Errors
ESP_ERR_INVALID_ARG: Reset the synchronization manager failed because of invalid argumentESP_FAIL: Reset the synchronization manager failed because of other error
Sourcepub fn channels_mut(&mut self) -> &mut [TxChannelDriver<'d>; N]
pub fn channels_mut(&mut self) -> &mut [TxChannelDriver<'d>; N]
Returns a mutable reference to the managed TX channels.
Sourcepub fn channels(&self) -> &[TxChannelDriver<'d>; N]
pub fn channels(&self) -> &[TxChannelDriver<'d>; N]
Returns a reference to the managed TX channels.
Sourcepub fn into_channels(self) -> [TxChannelDriver<'d>; N]
pub fn into_channels(self) -> [TxChannelDriver<'d>; N]
Consumes the sync manager and returns the managed TX channels.