# `EtherCAT.SubDevice`
[🔗](https://github.com/tallakt/yaethercat/blob/v0.1.0/lib/ethercat/sub_device.ex#L1)

A SubDevice as a scan found it: where it is, who it is, what its controller (ESC) can do, and its
SII.

  * `position`, from 0 for the first after the MainDevice
  * `station`, the configured station address the scan gave it, `0x1000` and up by position
  * `alias`, the configured station alias from its SII, 0 for none
  * `vendor_id`, `product_code`, `revision`, `serial`, from its SII as from CoE object 0x1018
  * `order`, the order number its SII gives, as `"EL1809"` or `"EL2535-0002"`
  * `name`, the device name its SII gives, as `"EL1809 16K. Dig. Eingang 24V, 3ms"`
  * `state`, its AL state when it was scanned
  * `esc`, its controller: `type`, `revision`, `build`, `fmmus`, `sync_managers`, `ram` in KiB,
    `bit_operations` (whether its FMMUs map single bits), `dc` (whether it has distributed clocks)
  * `sii`, the whole `EtherCAT.SII`

# `t`

```elixir
@type t() :: %EtherCAT.SubDevice{
  alias: 0..65535,
  esc: map(),
  name: String.t() | nil,
  order: String.t() | nil,
  position: 0..65535,
  product_code: 0..4_294_967_295,
  revision: 0..4_294_967_295,
  serial: 0..4_294_967_295,
  sii: EtherCAT.SII.t(),
  state: EtherCAT.AL.state() | byte(),
  station: 0..65535,
  vendor_id: 0..4_294_967_295
}
```

# `coe?`

```elixir
@spec coe?(t()) :: boolean()
```

Whether the SubDevice speaks CoE.

# `esc`

```elixir
@spec esc(binary()) :: map()
```

What the DL information registers, the ten bytes from 0x0000, say of a SubDevice's controller.

    iex> EtherCAT.SubDevice.esc(<<0x11, 0, 3, 0, 8, 8, 8, 0x3B, 0xFC, 0>>)
    %{type: 0x11, revision: 0, build: 3, fmmus: 8, sync_managers: 8, ram: 8, bit_operations: true, dc: true, dc_64: true}

# `mailbox?`

```elixir
@spec mailbox?(t()) :: boolean()
```

Whether the SubDevice has a mailbox.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
