inky v1.0.2 Inky View Source
The Inky module provides the public API for interacting with the display.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
set_pixels sets pixels and draws to the display (or not!), with new pixel
data or a painter function.
Shows the internally buffered pixels on the display.
Start an Inky GenServer for a display of type type, with the color accent
using the optionally provided options opts.
Stops server.
Link to this section Types
name() View Source
The Inky process name
Link to this section Functions
child_spec(init_arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor.
set_pixels(pid, arg, opts \\ %{}) View Source
set_pixels sets pixels and draws to the display (or not!), with new pixel
data or a painter function.
Returns:
:ok- If no push was requested or if it was and it worked, or{:error, :device_busy}- If a push to the device was requested but could not be performed due to the device reporting a busy status.
Parameters
pid- A pid or validnameoption that can be provided to GenServer.arg- A map of pixels or a painter function.pixels :: map(), a map of pixels to merge into the current state. The map use the structure%{{x, y}: color}to indicate pixel coordinates and a color atom.painter :: (x, y, width, height, pixels), a function that will be invoked to pick a color for all points in the screen, in an undefined order. Should return a color atom.
The color atoms
:white:black:accent- The third color for a display. Usually red och yellow.:red- Equivalent to:accent.:yellow- Equivalent to:accent.
Options
:border- Atom for the border color.:push- Represents the minimum pixel pushing policy the caller wishes to apply for their request. Valid values are listed and explained below.NOTE: the internal state of Inky will still be updated, regardless of which pushing policy is employed.
:await- Perform a blocking wait until the display is ready and you can push to it. Clears any previously set timeout. This is the default.:once- Push to the display if it is not busy, otherwise, report that it was busy.:awaittimeouts are reset if a:oncepush has failed.{:timeout, :await}- Use genserver timeouts to avoid multiple updates. When the timeout triggers, await device with a blocking wait and then push to the display. If the timeout previously was :once, it is replaced.{:timeout, :once}- Use genserver timeouts to avoid multiple updates. When the timeout triggers, update the display if not busy. Does not downgrade a previously set:awaittimeout.:skip- Do not push to display. If there has been a timeout previously set, but that has yet to fire, it will remain set.
show(server, opts \\ %{}) View Source
Shows the internally buffered pixels on the display.
If opts[:async] is true, the call will be asynchronous.
Returns :ok.
start_link(type, accent, opts \\ %{}) View Source
Start an Inky GenServer for a display of type type, with the color accent
using the optionally provided options opts.
The GenServer deals with the HAL state and pushing pixels to the physical display.
Parameters
type- An atom, representing the display type, either:phator:whataccent- An atom, representing the display's third color, one of:black,:redor:yellow.
Options
border- Atom for the border color, defaults to:blackname- GenServer name option for naming the process
See GenServer.start_link/3 for return values.
stop(server) View Source
Stops server.
Returns :ok.