Skip to content

rebar3/POSIX-only version of tomszilagyi/gen_serial

Notifications You must be signed in to change notification settings

igorclark/gen_serial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gen_serial: generic serial port driver for Erlang

gen_serial is a generic serial port driver written by Tom Szilagyi and Shawn Pearce to allow Erlang applications to use the host's RS-232 serial ports through a single cross platform API.

This repo just packages up the POSIX version as a rebar3 lib with a new rebar.config, gen_serial.app.src and a slightly modified posix/Makefile so it can be built as a rebar OTP app and source dependency, rather than as an Erlang system library. These notes have been modified to reflect the removal of Windows support and the new build/installation mechanism.

Each serial port is managed in its own host OS process, as a C port, ensuring that the stability of the Erlang node is not compromised by the gen_serial driver.

Currently this driver and API has been tested on Linux. It should also work on any POSIX compatible (UNIX-like) system.

A simple test module is also provided as gen_serial_test. This has some test cases which can be run in one Erlang node (using a loopback serial cable with a null modem installed and two serial ports on the host) or between two networked Erlang nodes (using a serial cable with a null modem to connect the two hosts).

Building gen_serial on UNIX platforms is pretty simple:

rebar3 compile

This will compile the Erlang code using rebar3, and invoke the Makefile in c_src/posix to compile the POSIX driver backend.

To add this app as a source dependency to your OTP app, add this to your app's rebar.config:

{ deps, [
    { gen_serial, { git, "https://github.com/igorclark/gen_serial.git", { tag, "0.1.0" } } }
] }.

The backend (native code) is under c_src and can be compiled on UNIX.

See docs for API documentation.

About

rebar3/POSIX-only version of tomszilagyi/gen_serial

Resources

Stars

Watchers

Forks

Packages

No packages published