Skip to main content

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

https://ucandevices.github.io

Metadata

Release files for ucanlintools 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ucanlintools 0.0.5
File Size Uploaded
ucanlintools-0.0.5.tar.gz 7.8 kB Details

Release files / ucanlintools-0.0.5.tar.gz

Download URL ucanlintools-0.0.5.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5a469970416258b70d852226c7cce27a0d7062a0b6bcaa0218ef8d46d8100097
BLAKE2b-256 checksum
How to use checksums
fef6e5a2b3ce513b7d145f7d5a68005df4dc7ddb4ee55fe25845e14e3bf5d045
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

This release

0.0.5 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page