Introduction

PeakRDL BEAM is a python package which can be used to generate a register abstraction layer for supported BEAM languages (Erlang and Elixir) a SystemRDL definition.

Features:

  • Generates Erlang record definitions

  • Field bit offset, width, mask, etc -define macros.

  • Generates register bit-field and accessor help functions.

Installing

Install from PyPi using pip

python3 -m pip install peakrdl-beam

Quick Start

The easiest way to use PeakRDL-beam is via the PeakRDL command line tool:

# Install the command line tool
python3 -m pip install peakrdl

# Generate an Erlang module and header
peakrdl beam example.rdl -o example.erl

Using the generated module and header, you can access your device registers by name!

-include("example.hrl")

main() ->
    Data = read_register_from_hw(),

    CtrlRecord = example:des_example__CTRL_f(Data),

    io:format("CTRL register ~p~n", [CtrlRecord#atxmega_spi__CTRL.mode]).