Skip to main content

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

  1. Install riot_pal from pip
    pip install riot_pal
  2. Start python 3
    python3
  3. Create a import modules from riot pal
    >>> from riot_pal import LLMemMapIf, PHILIP_MEM_MAP_PATH
  4. Create a connection
    >>> phil = LLMemMapIf(PHILIP_MEM_MAP_PATH, 'serial', '/dev/ttyACM0')
  5. View available commands
    >>> phil.cmd_list.keys()
  6. View descriptions of commands
    >>> phil.cmd_list['sys.sn.12']['description']
  7. Read a register
    >>> phil.read_reg('sys.sn.12')
  8. Only view data
    >>> phil.read_reg('sys.sn.12')['data']
  9. Write bytes to a register
    >>> phil.write_reg('user_reg.64', [4, 2])
  10. Read new data
    >>> phil.read_reg('user_reg.64', size=10)['data']
  11. Write a number to a register
    >>> phil.write_reg('user_reg.64', 42)
  12. Read new data
    >>> phil.read_reg('user_reg.64', size=4)['data']
  13. Read a structure
    >>> phil.read_struct('sys')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

riot_pal-0.2.3.tar.gz (8.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page