# `NestGen2.Dial`
[🔗](https://github.com/integration-technology/nest_gen2_sdk/blob/v0.6.6/lib/nest_gen2/dial.ex#L1)

The ring and its press.

The ring is read by an ADBS-A350 optical sensor at a fixed 750 cpi: about
7800 counts per turn. There is no absolute position, so the angle is relative
to start-up (or `reset_angle/0`) and can drift a few degrees over many turns.

Events: `:dial` for every movement, `:dial_step` each time the angle crosses a
multiple of the step size (default 10°, with Nest's click), `:button` on press.

Do not ask users to hold the press: a long hold triggers the power chip's
hardware reset.

# `angle`

```elixir
@spec angle() :: float()
```

Degrees turned clockwise since start-up or the last reset.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `press`

```elixir
@spec press(:down | :up) :: :ok
```

Simulates pressing (`:down`) or releasing (`:up`) the ring.

# `reset_angle`

```elixir
@spec reset_angle() :: :ok
```

# `set_counts_per_turn`

```elixir
@spec set_counts_per_turn(pos_integer()) :: :ok
```

Calibration: sensor counts per full turn (default 7800).

# `set_step`

```elixir
@spec set_step(pos_integer() | nil) :: :ok
```

Degrees between `:dial_step` events, or nil for none.

# `start_link`

# `step`

```elixir
@spec step() :: pos_integer() | nil
```

Degrees between `:dial_step` events, or nil.

# `turn`

```elixir
@spec turn(number()) :: :ok
```

Simulates turning the ring by `degrees` (positive is clockwise), with the same
events a real turn gives. For the host viewer, tests and remote control.

---

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