Skip to content

Commit

Permalink
Added support for Neuron relays
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoralves authored Oct 9, 2018
1 parent ca521fc commit 6a2b5bc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions webserver/core/hardware_layers/neuron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,27 @@ void searchForIO()
}
}
}

/* look for digital outputs (relay) */
strcpy(path_fmt, "/sys/devices/platform/unipi_plc/io_group%d/ro_%d_%02d/ro_value");
for (int group = 1; group < 10; group++)
{
for (int major = 1; major < 10; major++)
{
for (int minor = 1; minor < 10; minor++)
{
sprintf(path, path_fmt, group, major, minor);
char *command = "read";
if (requestSYSFS(path, command) >= 0)
{
/* valid I/O. Add to the list */
strcpy(digital_outputs[index], path);
index++;
digital_outputs[index][0] = '\0';
}
}
}
}

/* look for analog inputs */
strcpy(path_fmt, "/sys/devices/platform/unipi_plc/io_group%d/ai_%d_%d/in_voltage0_raw");
Expand Down

0 comments on commit 6a2b5bc

Please sign in to comment.