A protocol abstraction layer for RIOT and low level devices
Project description
RIOT PAL (RIOT Protocol Abstraction Layer)
Introduction
A set of python modules that abstract away and standardize shell based commands in RIOT and for bare metal memory map access.
Usage of LLMemMapIf
The LLMemMapIf (Low Level Memory Map Interface) is used to interface to a memory map specified from a csv or other format file. It handles the parsing of offsets, sizes, etc. of the device.
To use this interface a memory must be provided, by default the package contains the PHiLIP memory map. More information about PHiLIP can be found at the PHiLIP repo.
PHILIP_MEM_MAP_PATH - Provides a path to the csv used for updating the list of commands for the LLMemMapIf
read_struct - Reads a set of registers defined by the memory map.
read_reg - Read a register defined by the memory map.
- cmd_name(str): The name of the register to read.
- offset(int): The number of elements to offset in an array.
- size(int): The number of elements to read in an array.
write_reg - Writes a register defined by the memory map.
- cmd_name(str): The name of the register to read
- data: The data to write to the register
- offset(int): The number of elements to offset in an array.
Example with PHiLIP
- Install riot_pal from pip
pip install riot_pal
- Start python 3
python3
- Create a import modules from riot pal
>>> from riot_pal import LLMemMapIf, PHILIP_MEM_MAP_PATH
- Create a connection
>>> phil = LLMemMapIf(PHILIP_MEM_MAP_PATH, 'serial', '/dev/ttyACM0')
- View available commands
>>> phil.cmd_list.keys()
- View descriptions of commands
>>> phil.cmd_list['sys.sn.12']['description']
- Read a register
>>> phil.read_reg('sys.sn.12')
- Only view data
>>> phil.read_reg('sys.sn.12')['data']
- Write bytes to a register
>>> phil.write_reg('user_reg.64', [4, 2])
- Read new data
>>> phil.read_reg('user_reg.64', size=10)['data']
- Write a number to a register
>>> phil.write_reg('user_reg.64', 42)
- Read new data
>>> phil.read_reg('user_reg.64', size=4)['data']
- Read a structure
>>> phil.read_struct('sys')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.