Skip to content

Commit 09c236f

Browse files
authored
Added a "Features" and an "Example usage" section to the README (hardbyte#343)
1 parent 85e1274 commit 09c236f

2 files changed

Lines changed: 49 additions & 7 deletions

File tree

‎README.rst‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ python-can
99

1010
.. |docs| image:: https://readthedocs.org/projects/python-can/badge/?version=stable
1111
:target: https://python-can.readthedocs.io/en/stable/
12-
:alt: Documentation build Status
13-
12+
:alt: Documentation
13+
1414
.. |build_travis| image:: https://travis-ci.org/hardbyte/python-can.svg?branch=develop
1515
:target: https://travis-ci.org/hardbyte/python-can/branches
1616
:alt: Travis CI Server for develop branch
@@ -22,16 +22,57 @@ python-can
2222

2323
The **C**\ ontroller **A**\ rea **N**\ etwork is a bus standard designed
2424
to allow microcontrollers and devices to communicate with each other. It
25-
has priority based bus arbitration, reliable deterministic
25+
has priority based bus arbitration and reliable deterministic
2626
communication. It is used in cars, trucks, boats, wheelchairs and more.
2727

2828
The ``can`` package provides controller area network support for
29-
Python developers; providing `common abstractions to
30-
different hardware devices`, and a suite of utilities for sending and receiving
29+
Python developers; providing common abstractions to
30+
different hardware devices, and a suite of utilities for sending and receiving
3131
messages on a can bus.
3232

3333
The library supports Python 2.7, Python 3.4+ as well as PyPy 2 & 3 and runs on Mac, Linux and Windows.
3434

35+
36+
Features
37+
--------
38+
39+
- common abstractions for CAN communication
40+
- support for many different backends (see the `docs <https://python-can.readthedocs.io/en/master/interfaces.html>`__)
41+
- receiving, sending, and periodically sending messages
42+
- normal and extended arbitration IDs
43+
- limited `CAN FD <https://en.wikipedia.org/wiki/CAN_FD>`__ support
44+
- many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), CSV, SQLite and Canutils log
45+
- efficient in-kernel or in-hardware filtering of messages on supported interfaces
46+
- bus configuration reading from file or environment variables
47+
- more
48+
49+
50+
Example usage
51+
-------------
52+
53+
::
54+
55+
# import the library
56+
import can
57+
58+
# create a bus instance
59+
# many other interfaces are supported as well (see below)
60+
bus = can.Bus(interface='socketcan',
61+
channel='vcan0',
62+
receive_own_messages=True)
63+
64+
# send a message
65+
message = can.Message(arbitration_id=123, extended_id=True,
66+
data=[0x11, 0x22, 0x33])
67+
bus.send(message, timeout=0.2)
68+
69+
# iterate over received messages
70+
for msg in bus:
71+
print("{X}: {}".format(msg.arbitration_id, msg.data))
72+
73+
# or use an asynchronous notifier
74+
notifier = can.Notifier(bus, [can.Logger("recorded.log"), can.Printer()])
75+
3576
You can find more information in the documentation, online at
3677
`python-can.readthedocs.org <https://python-can.readthedocs.org/en/stable/>`__.
3778

@@ -40,7 +81,7 @@ Discussion
4081
----------
4182

4283
If you run into bugs, you can file them in our
43-
`issue tracker <https://github.com/hardbyte/python-can/issues>`__.
84+
`issue tracker <https://github.com/hardbyte/python-can/issues>`__ on GitHub.
4485

4586
There is also a `python-can <https://groups.google.com/forum/#!forum/python-can>`__
4687
mailing list for development discussion.
@@ -51,6 +92,7 @@ questions and answers tagged with ``python+can``.
5192
Wherever we interact, we strive to follow the
5293
`Python Community Code of Conduct <https://www.python.org/psf/codeofconduct/>`__.
5394

95+
5496
Contributing
5597
------------
5698

‎can/io/asc.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ASCReader(object):
2525
"""
2626
Iterator of CAN messages from a ASC logging file.
2727
28-
TODO: turn realtive timestamps back to absolute form
28+
TODO: turn relative timestamps back to absolute form
2929
"""
3030

3131
def __init__(self, filename):

0 commit comments

Comments
 (0)