Backend GenServer, dispatching PWM calls either to the real sysfs interface
(Pwmx.Backend.Sysfs) on a Linux host that exposes /sys/class, or to an
in-memory simulation (Pwmx.Backend.Virtual) elsewhere.
A default, application-supervised instance is registered under the name
Pwmx.Backend. Every public function takes the backend server as its first
argument (a pid or a registered name), so additional, isolated instances can
be started, this is what lets tests run against a private virtual board:
{:ok, backend} = Pwmx.Backend.start_link(name: :my_board, mode: :virtual)
Pwmx.Backend.list_chips(backend)Options
:name: the name to register the instance under. Defaults toPwmx.Backend.:mode::auto(default),:virtualor:real.:autouses the sysfs backend when/sys/classexists (and always the virtual one underMIX_ENV=test).:virtual_chips: a map ofchip_name => output_countdescribing the board the virtual backend simulates. Defaults to the:pwmx, :virtual_chipsapplication environment, or%{"virtualchip0" => 4}.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for GenServer.init/1.
@spec list_chips(GenServer.server()) :: {:ok, [binary()]} | {:error, any()}