Skip to content

Commit

Permalink
Relax the elixir_make version constraint (#7)
Browse files Browse the repository at this point in the history
and also fix a few lingering issues
  • Loading branch information
GregMefford authored Aug 17, 2017
1 parent f336d44 commit 3a02f89
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/nerves/neopixel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ defmodule Nerves.Neopixel do
payload =
{channel, {brightness, data}}
|> :erlang.term_to_binary
send s.port, {self, {:command, payload}}
send s.port, {self(), {:command, payload}}
{:reply, :ok, s}
end

Expand Down
8 changes: 4 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ defmodule Nerves.Neopixel.Mixfile do

def project do
[app: :nerves_neopixel,
version: "0.3.0",
version: "0.3.1",
description: "Drive WS2812B \"NeoPixel\" RGB LED strips from a Raspberry Pi using Elixir.",
elixir: "~> 1.3",
make_clean: ["clean"],
compilers: [:elixir_make | Mix.compilers],
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
package: package,
deps: deps]
package: package(),
deps: deps()]
end

def application do
[applications: [:logger]]
end

defp deps do
[{:elixir_make, "~> 0.3.0"}]
[{:elixir_make, "~> 0.3"}]
end

defp package do
Expand Down
22 changes: 17 additions & 5 deletions test/neopixel_test.exs
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
defmodule Nerves.Neopixel.Test do

use ExUnit.Case
doctest Nerves.IO.Neopixel
doctest Nerves.Neopixel

alias Nerves.IO.Neopixel
alias Nerves.Neopixel

test "configuring a Neopixel interface" do
{:ok, pid} = Neopixel.setup pin: 18, count: 5
ch0_config = [pin: 18, count: 3]
ch1_config = [pin: 19, count: 3]
{:ok, pid} = Neopixel.start_link(ch0_config, ch1_config)
assert is_pid(pid)
end

test "rendering a pixel" do
{:ok, pid} = Neopixel.setup pin: 18, count: 5
ch0_config = [pin: 18, count: 3]
ch1_config = [pin: 19, count: 3]
{:ok, pid} = Neopixel.start_link(ch0_config, ch1_config)
assert is_pid(pid)
assert Neopixel.render(pid, <<255, 0, 16>>) == :ok

channel = 0
intensity = 127
data = [
{255, 0, 0},
{0, 255, 0},
{0, 0, 255},
]
assert Neopixel.render(channel, {intensity, data}) == :ok
end
end

0 comments on commit 3a02f89

Please sign in to comment.