Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcpcpc/mpscpi
Instrumentation framework for network-based SCPI communication.
https://github.com/mcpcpc/mpscpi
instrumentation micropython scpi
Last synced: 4 days ago
JSON representation
Instrumentation framework for network-based SCPI communication.
- Host: GitHub
- URL: https://github.com/mcpcpc/mpscpi
- Owner: mcpcpc
- License: bsd-3-clause
- Created: 2024-04-20T14:59:22.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-10-11T20:04:10.000Z (4 months ago)
- Last Synced: 2024-11-26T14:12:54.421Z (2 months ago)
- Topics: instrumentation, micropython, scpi
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# mpscpi
An instrumentation framework for network-based SCPI
communication in MicroPython applications.## Background
In the realm of instrumentation hardware and
software, developers often find themselves responsible
for implementing protocol interfacing. While there are
many proprietary solutions, most open source packages
are either lacking in cohesiveness and/or require
knowledge of low-level programming languages such as C
or C++. This library aims to alleviate this burden by
providing a layer of abstraction between TCP sockets,
asynchronous callback handlers, and SCPI command
parsers. It interprets string-based protocol commands
efficiently.## Installation
### Repository
If not already done, install mpremote.
```shell
python3 -m venv venv
source venv/bin/activate
pip install mpremote
```Use mpremote and mip to install from GitHub.
```shell
mpremote mip install github:mcpcpc/mpscpi
```## Usage
### Quickstart
The following is a basic example of how to spin
up a new server instance.```python
from mpscpi import MPSCPIapp = MPSCPI(__name__)
if __name__ == "__main__":
app.run("127.0.0.1", 5025)
```Note that mpscpi leaves instantiation of the
network interface up to the user; thus, it is
recommended to call the `run()` command only
after connectivity is confirmed.### Custom Callbacks
Custom user functions are implemented using the
built-in callback handlers.```python
app.push("FOO", func=lambda a: None)
app.pull("FOO", func=lambda a: "BAR")
```### Syntax Conventions
- Braces ({}) enclose the parameter choices for a
given command string. The braces are not sent
with the command string.
- Vertical bars (|) separar multiple paramater
choices for a given command string.
- Triangle brackets (<>) indicate that you must
specify a value for the enclosed parameter. The
brackets are not sent with the command string.
Square brackets ([]) indicate optional
parameters that can be omitted. The brackets
are not sent with the command string.## To Do
- Complete IEEE 488.2 protocol compliance (will
accept pull requests).
- Argument string parser class for numeric,
boolean and array data types.## Contact
For further questions or concerns, feel free to
contact me at michaelczigler[at]icloud[dot]com.