Local Interconnect Network (LIN) support for python
Project description
LIN Python lib
Library is under development API will change
Features
- LIN frame transmission / reception
- LDF signals encoding / decoding (only signal and frames currently working, schedule table parsing not implemented, max signal size is 1 byte)
- Works on windows, linux, mac. Supported hardware , uCAN LIN USB CONVERTER
Installation
pip install ucanlintools
Example usage
To load ldf
from ucanlintools.LDF_parser import parseLDF
ldf = parseLDF("D:\\ldfe.ldf")
message = ldf.get_message_by_name('FRAME_A')
print(message.signals)
To decode/ encode frame
aaa = message.encode({'SIGNAL_A': 1})
bbb = b'\x00\x00\x00\x00\x00\x00'
message.decode(bbb)
To setup LIN USB Converter
lin = ucanlintools.LUC('COM7')
lin.set_frame_rx_handler(rx_any)
lin.set_new_frame_rx_handler(rx_new_data)
lin.openAsMaster()
lin.addReceptionFrameToTable(52,8)
lin.addReceptionFrameToTable(54,8)
lin.enable()
Example data reception handler
def rx_new_data(f):
global message
print (hex(f.id) + ": " +(f.data.hex()))
if (message.id == f.id):
message.decode(f.data)
print(message.diff_str())
For more info see
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
ucanlintools-0.0.9.tar.gz
(8.0 kB
view details)
File details
Details for the file ucanlintools-0.0.9.tar.gz
.
File metadata
- Download URL: ucanlintools-0.0.9.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
061c2f398a63f195399292f9f4bd6b73831d956d32833af6ac5dd0cdf41be498
|
|
MD5 |
88a58157e032647df722fe7294250e33
|
|
BLAKE2b-256 |
8505340051629d12aeb5549ccbe08a57dd002a414e55f3f80a22425c268f1a9e
|