Use circuits_{i2c,gpio} as dependency in an erlang project

Hi all,

I need to control some hardware in a new project, where I want to use and adapt an existing erlang project.
My current approach is to use i2c and gpio from the circuits family.
All together needs to run on a raspberry.

I seem to have a problem with the configuration in the erlang project.
Here is my current rebar.config:

{erl_opts, [debug_info]}.
{deps, [
        {circuits_i2c, "1.1.0"},
        {circuits_gpio, "1.0.1"}

{shell, [
  % {config, "config/sys.config"},
    {apps, [erlangapp]}

{plugins, [rebar_mix]}.
{provider_hooks, [
  {post, [{compile, {mix, consolidate_protocols}}]}

The build output looks ok:

===> Compiling circuits_i2c
Resolving Hex dependencies...
Resolution completed in 0.263s
  bunt 0.2.1
  credo 1.6.7
  dialyxir 1.2.0
  earmark_parser 1.4.29
  elixir_make 0.7.3
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
==> circuits_i2c
 CC hal_i2cdev.o
 CC i2c_nif.o
Compiling 2 files (.ex)

However, the nif library is not created.

To crosscheck, I created a small elixir library, where I could successfully build all.
So I made sure that I have all necessary tools installed.
There the build artifacts are in the directory circuits_*/priv/, which is not created in the erlang library.

Did anybody run in a similar problem already?
Debugging the C Makefile did not succeed so far, because it seems it is being recreated before each build.
I would be grateful for any pointers!

1 Like

11 posts were split to a new topic: GPIO - Erlang GPIO interface