Packages

Pure-Elixir EtherCAT master built on OTP. Declarative bus configuration, cyclic process data exchange, CoE SDO transfers, and distributed clocks.

Current section

Files

Jump to
ethercat lib ethercat dc config.ex
Raw

lib/ethercat/dc/config.ex

defmodule EtherCAT.DC.Config do
@moduledoc """
Declarative configuration for master-wide Distributed Clocks infrastructure.
Fields:
- `:cycle_ns` — global DC cycle in nanoseconds, default `1_000_000`; must be a whole-millisecond value (`>= 1_000_000`, divisible by `1_000_000`)
- `:await_lock?` — gate activation on DC lock detection, default `false`
- `:lock_threshold_ns` — acceptable absolute sync-diff threshold, default `100`
- `:lock_timeout_ms` — timeout while waiting for lock, default `5_000`
- `:warmup_cycles` — optional pre-compensation cycle count, default `0`
Disable DC entirely by passing `dc: nil` to `EtherCAT.start/1`.
"""
@type t :: %__MODULE__{
cycle_ns: pos_integer(),
await_lock?: boolean(),
lock_threshold_ns: pos_integer(),
lock_timeout_ms: pos_integer(),
warmup_cycles: non_neg_integer()
}
defstruct cycle_ns: 1_000_000,
await_lock?: false,
lock_threshold_ns: 100,
lock_timeout_ms: 5_000,
warmup_cycles: 0
end