https://github.com/pappersverk/inky
A library for managing Inky e-ink displays from Elixir.
https://github.com/pappersverk/inky
elixir inky nerves pimoroni scenic
Last synced: 4 months ago
JSON representation
A library for managing Inky e-ink displays from Elixir.
- Host: GitHub
- URL: https://github.com/pappersverk/inky
- Owner: pappersverk
- License: apache-2.0
- Created: 2018-11-25T18:28:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-13T05:56:57.000Z (almost 3 years ago)
- Last Synced: 2025-10-21T18:46:57.033Z (8 months ago)
- Topics: elixir, inky, nerves, pimoroni, scenic
- Language: Elixir
- Homepage:
- Size: 191 KB
- Stars: 76
- Watchers: 4
- Forks: 10
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Inky
[](https://circleci.com/gh/pappersverk/inky)
[](https://hex.pm/packages/inky)
This is a port of Pimoroni's [python Inky
library](https://github.com/pimoroni/inky) written in Elixir. This library is
intended to support both Inky pHAT and wHAT, but since we only have pHATs, the
wHAT support may not be fully functional.
See the [API reference](https://hexdocs.pm/inky/api-reference.html) for details
on how to use the functionality provided.
### Host Development
An [inky host development](https://github.com/pappersverk/inky_host_dev) library
is underway for allowing host-side development, but until that is finished you
can not see results without using a physical device.
### Scenic Driver
A [basic driver](https://github.com/pappersverk/scenic_driver_inky) for scenic
is in the works, check it out, to follow how it is progressing.
## Getting started
Inky is available on Hex. Add inky to your mix.exs deps:
```elixir
{:inky, "~> 1.0.1"},
```
Run `mix deps.get` to get the new dep.
## Usage
A sample for Inky only, both host development and on-device is available as [pappersverk/sample_inky](https://github.com/pappersverk/sample_inky).
A sample for using it with Scenic both for host development and on-device is available as [pappersverk/sample_scenic_inky](https://github.com/pappersverk/sample_scenic_inky).
## Brief example
In typical usage this would be inside a nerves project. If Inky is installed in
your application you can do the following to test it and your display (note the
config in init, adjust accordingly):
```elixir
# Start your Inky process ...
{:ok, pid} = Inky.start_link(:phat, :red, %{name: InkySample})
painter = fn x, y, w, h, _pixels_so_far ->
wh = w / 2
hh = h / 2
case {x >= wh, y >= hh} do
{true, true} -> :red
{false, true} -> if(rem(x, 2) == 0, do: :black, else: :white)
{true, false} -> :black
{false, false} -> :white
end
end
Inky.set_pixels(InkySample, painter, border: :white)
# Flip a few pixels
Inky.set_pixels(pid, %{{0,0}: :black, {3,49}: :red, {23, 4}: white})
```