canopen implements a CANopen stack.
See www.can-cia.org for a description of CANopen.
To build canopen you will need a working installation of Erlang R15B (or
later).
Information on building and installing Erlang/OTP
can be found here
(more info).
canopen is built using rebar that can be found here, with building instructions here.
canopen also requires the following applications to be installed:
- sl - https://github.com/tonyrog/sl
- eapi - https://github.com/tonyrog/eapi
- can - https://github.com/tonyrog/can
Clone the repository in a suitable location:
$ git clone git://github.com/tonyrog/canopen.git
canopen can be started with a number of options.
For details either check co_api.erl - start_link() or in the full implementation documentation, see below on how to create it.
Arguments to all applicable erlang applications are specified in an erlang configuration file.
An example can be found in "sys.config".
Rebar will compile all needed dependencies.
Compile:
$ cd canopen
$ rebar compile
...
==> canopen (compile)
There is a quick way to run the application for testing:
$ erl -config sys -pa <path>/canopen/ebin
>canopen:start().
(Instead of specifing the path to the ebin directory you can set the environment ERL_LIBS.)
Stop:
>halt().
To generate a proper release follow the instructions in Release Handling or look in the Rebar tutorial.
Before the last step you have to update the file "canopen/rel/files/sys.config" with your own settings. You probably also have to update "canopen/rel/reltool.config" with the correct path to your application (normally "{lib_dirs, ["../.."]}") and all apps you need.
{app, sasl, [{incl_cond, include}]},
{app, stdlib, [{incl_cond, include}]},
{app, kernel, [{incl_cond, include}]},
{app, sl, [{incl_cond, include}]},
{app, eapi, [{incl_cond, include}]},
{app, can, [{incl_cond, include}]},
{app, canopen, [{incl_cond, include}]}
And then you run:
$ rebar generate
.
When generating a new release the old has to be (re)moved.
Start node:
$ cd rel
$ canopen/bin/canopen start
(If you want to have access to the erlang node use
console
instead of
start
.)
canopen is documented using edoc. To generate the documentation do:
$ cd canopen
$ rebar doc