Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (55 sloc) 1.97 KB

can

CAN binding for Erlang

CAN or Controller Area Network for short, is a two wire serial protcol for industrial applications.

This implementation currently supports three different backends:

  • can_usb: CANUSB is a USB dongle from LAWICEL AB.
  • can_udp: This is my own invention. A simple repackaging of CAN frames into UDP/IP datagrams sent over local multicast channel.
  • can_sock: A binding to linux SocketCAN interface.

Any number of backend interfaces may be started and attached to the can_router, which is the main interface to receice and send CAN frames.
An application will typically call can_router:attach() and then receive CAN frames from any of the interfaces. To send a frame then simple call can:send/n, this will pass the CAN frame to all the interfaces and connected local applications in the Erlang node.

Dependencies

To build can you will need a working installation of Erlang R15B (or later).
Information on building and installing Erlang/OTP can be found here (more info).

can is built using rebar that can be found here, with building instructions here.

can also requires the following applications to be installed:

Downloading

Clone the repository in a suitable location:

$ git clone git://github.com/tonyrog/can.git

Configurating

Concepts

...

Files

...

Building

Rebar will compile all needed dependencies.
Compile:

$ cd can
$ rebar compile
...
==> can (compile)

Running

$ erl -pa <path>/can/ebin
>can_router:start().

(Instead of specifing the path to the ebin directory you can set the environment ERL_LIBS.)

Stop:

>halt().

Something went wrong with that request. Please try again.