Serial protocol to send and receive data effortlessly
Project description
Easy Serial 😎
What is this?
This is a thread safe Python3 implementation of an high level serial protocol currently used in the Forecast project.
This package core functionality is to grant ease of use to end users unfamiliar with the protocol through different layers of abstraction. It is currently built on top of the more known library PySerial, which offers an easy interface to compliant posix/win32 serials.
A simple logger script is also included, which is callable from console:
easyserial-logger
or
easyserial-logger -p <PORT> -b <BAUDRATE>
Installation
From pypi
pip install easyserial
From source
- Clone the repository
- Run the following commands
cd easy-serial
# Using pipenv
pipenv install
# or just using pip
pip install -e .
Example
import easyserial
port = "/dev/ttyACM0"
baudrate = 115200
with easyserial.Serial(port=port, baud=baudrate) as serial:
# Read package example
# tries specifies the number of attempts to read from serial a full package (default: infinite)
package_type, payload = serial.read_package(tries=1)
# In case you want to skip unescaping and checksum checks
package = serial.read(tries=1)
# In order to write to serial
serial.write(package)
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.
Source Distribution
easyserial-0.2.0.tar.gz
(6.5 kB
view hashes)
Built Distribution
Close
Hashes for easyserial-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c1b12860428548efd9240285cac05b1907e89c75c27c98e6801b7427331c8b6 |
|
MD5 | f0a7c1e13d665b54a9402caa1fcf968a |
|
BLAKE2b-256 | 72755895a7e0588908f9fc0dc0746ae4e5104c6af8d710ee8502f4792e63ec4d |