Helpers for common CoE application sync-mode objects.
This module is driver-facing. It builds mailbox steps for the common synchronization objects:
0x1C32— SM output parameter0x1C33— SM input parameter
The public application API still uses %EtherCAT.Slave.Sync.Config{} for generic ESC
SYNC/latch intent. Drivers may use these helpers from EtherCAT.Slave.Driver.sync_mode/2
when a slave application also needs CoE object-dictionary sync-mode writes.
This module does not talk to the mailbox itself. It only builds
{:sdo_download, ...} steps for EtherCAT.Slave.Mailbox.CoE to execute later.
The generated steps intentionally cover only the common writable fields:
- subindex
0x01— synchronization mode - subindex
0x02— cycle time
They do not attempt to write device-specific read-only or optional timing fields such as shift/calc-and-copy delays.
Examples
def sync_mode(_config, %EtherCAT.Slave.Sync.Config{mode: :sync0} = sync) do
EtherCAT.Slave.Sync.CoE.steps!(
cycle_ns: 1_000_000,
output: :sync0,
input: :sync0
)
end
def sync_mode(_config, _sync) do
EtherCAT.Slave.Sync.CoE.steps!(
cycle_ns: 1_000_000,
output: :sm_event,
input: {:sm_event, :sm2}
)
end
Summary
Functions
Build CoE mailbox steps for the input sync object 0x1C33.
Build CoE mailbox steps for the output sync object 0x1C32.
Build a combined list of CoE mailbox steps for 0x1C32 and/or 0x1C33.
Types
@type input_mode() :: :free_run | {:sm_event, :sm2 | :sm3} | :sync0 | :sync1
@type mailbox_step() :: EtherCAT.Slave.Driver.mailbox_step()
@type output_mode() :: :free_run | :sm_event | :sync0 | :sync1
Functions
@spec input_steps(input_mode() | nil, pos_integer()) :: [mailbox_step()]
Build CoE mailbox steps for the input sync object 0x1C33.
@spec output_steps(output_mode() | nil, pos_integer()) :: [mailbox_step()]
Build CoE mailbox steps for the output sync object 0x1C32.
@spec steps!(keyword()) :: [mailbox_step()]
Build a combined list of CoE mailbox steps for 0x1C32 and/or 0x1C33.
Options:
:cycle_ns(required) — cycle time written to subindex0x02:output— optional output application mode for0x1C32:input— optional input application mode for0x1C33
Returns a flat list of {:sdo_download, index, subindex, binary} steps.