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.
Summary
Functions
Degrees turned clockwise since start-up or the last reset.
Returns a specification to start this module under a supervisor.
Simulates pressing (:down) or releasing (:up) the ring.
Calibration: sensor counts per full turn (default 7800).
Degrees between :dial_step events, or nil for none.
Degrees between :dial_step events, or nil.
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.
Functions
@spec angle() :: float()
Degrees turned clockwise since start-up or the last reset.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec press(:down | :up) :: :ok
Simulates pressing (:down) or releasing (:up) the ring.
@spec reset_angle() :: :ok
@spec set_counts_per_turn(pos_integer()) :: :ok
Calibration: sensor counts per full turn (default 7800).
@spec set_step(pos_integer() | nil) :: :ok
Degrees between :dial_step events, or nil for none.
@spec step() :: pos_integer() | nil
Degrees between :dial_step events, or nil.
@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.