work with equipment over buses like Serial/i2c/...
Project description
bus_user
Designed to work with equipment over buses like Serial/i2c/...
Features
- Serial bus usage! with simply using commands
License
See the LICENSE file for license rights and limitations (MIT).
Release history
See the HISTORY.md file for release history.
Installation
pip install bus-user
Import
from bus_user import *
GUIDE
!. MOST APPROPRIATE COMMAND PROTOCOL
other protocols mot recommended
- all cmds must be as params (preferred) in equipment or as special command
- [<CMD_NAME>] - read param value or run special command
[IDN] - read value IDN
[DUMP] - run special command - [<CMD_NAME> ] - write value in parameter or run special cmd with param
[VOUT 12.3] - set value into parameter VOUT
1. USAGE COMMANDS MAP
NOTICE: if bus cmd return several lines (DUMP for example) - you will get all of then in list!
from bus_user import *
# SHOW (optional) COMMANDS EXPLICITLY by annotations without values!
# ------------------------------------------------------------------
class MySerialDevice(BusSerial):
IDN: Callable[[Any], TYPE__RW_ANSWER]
ADDR: Callable[[Any], TYPE__RW_ANSWER]
DUMP: Callable[[Any], TYPE__RW_ANSWER]
# USE in code
# -----------
dev = MySerialDevice()
if dev.connect():
answer1 = dev.IDN() # return answer for sent string in port "IDN"
answer2 = dev.VIN() # return answer for sent string in port "VIN"
answer3 = dev.VIN(12) # return answer for sent string in port "VIN 12"
answer4 = dev.VIN("12") # return answer for sent string in port "VIN 12"
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
bus_user-0.0.1.tar.gz
(7.1 kB
view hashes)