Skip to content

Commit 9ab9a64

Browse files
authored
Update README.rst
Rewrite style of README.rst
1 parent 59d78a9 commit 9ab9a64

File tree

1 file changed

+72
-74
lines changed

1 file changed

+72
-74
lines changed

README.rst

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Python Durand - CANopen Responder Device Library
33
================================================
44

5-
CANopen library to implement responder nodes.
5+
A CANopen library to implement responder nodes.
66

7-
Backends:
7+
**Backends:**
88

99
- CAN interfaces via python-can_
1010

@@ -13,12 +13,12 @@ Backends:
1313
Synopsis
1414
========
1515

16-
- Pure python implementation
17-
- Under MIT license (2021 Günther Jena)
18-
- Source is hosted on GitHub.com_
19-
- Tested on Python 3.7, 3.8, 3.9 and 3.10
20-
- Unit tested with pytest_, coding style done with Black_, static type checked with mypy_, static code checked with Pylint_, documented with Sphinx_
21-
- Supporting CiA301_ (EN 50325-4)
16+
- Pure Python implementation
17+
- Licensed under MIT (2021 Günther Jena)
18+
- Source code hosted on GitHub.com_
19+
- Tested on Python 3.7, 3.8, 3.9, and 3.10
20+
- Unit tested with pytest_, coding style enforced with Black_, static type checking with mypy_, static code analysis with Pylint_, documentation generated with Sphinx_
21+
- Supports CiA301_ (EN 50325-4)
2222

2323
.. _pytest: https://docs.pytest.org/en/latest
2424
.. _Black: https://black.readthedocs.io/en/stable/
@@ -31,71 +31,75 @@ Synopsis
3131
Feature List
3232
============
3333

34-
* Object dictionary
34+
* **Object Dictionary:**
3535

36-
* provides callbacks for *validation*, *update*, *download* and *read*
37-
* supports records, arrays and variables
36+
- Provides callbacks for validation, update, download, and read operations
37+
- Supports records, arrays, and variables
3838

39-
* EDS support
39+
* **EDS Support:**
4040

41-
* dynamically generation of EDS file
42-
* automatically provided via object 0x1021 ("Store EDS")
41+
- Dynamic generation of EDS files
42+
- Automatically provided via object 0x1021 ("Store EDS")
4343

44-
* up to 128 SDO servers
44+
* **SDO Servers:**
4545

46-
* expedited, segmented and block transfer for up- and download
47-
* COB-IDs dynamically configurable
48-
* custom up- and download handlers supported
46+
- Supports up to 128 SDO servers
47+
- Expedited, segmented, and block transfer for upload and download
48+
- Dynamically configurable COB-IDs
49+
- Custom upload and download handlers supported
4950

50-
* up to 512 TPDOs and 512 RPDOs
51+
* **PDO Support:**
5152

52-
* dynamically configurable
53-
* transmission types: synchronous (acyclic and every nth sync) and event driven
54-
* inhibit time supported
53+
- Up to 512 TPDOs and 512 RPDOs
54+
- Dynamically configurable
55+
- Transmission types: synchronous (acyclic and every nth sync) and event-driven
56+
- Supports inhibit time
5557

56-
* EMCY producer service
58+
* **EMCY Producer Service:**
5759

58-
* COB-ID dynamically configurable
59-
* inhibit time supported
60+
- Dynamically configurable COB-ID
61+
- Supports inhibit time
6062

61-
* Heartbeat producer service
63+
* **Heartbeat Producer Service:**
6264

63-
* dynamically configurable
65+
- Dynamically configurable
6466

65-
* NMT slave service
67+
* **NMT Slave Service:**
6668

67-
* boot-up service
68-
* callback for state change provided
69+
- Boot-up service
70+
- Callback for state change provided
6971

70-
* SYNC consumer service
72+
* **SYNC Consumer Service:**
7173

72-
* COB-ID dynamically configurable
73-
* callback for received sync provided
74+
- Dynamically configurable COB-ID
75+
- Callback for received sync provided
7476

75-
* CiA305 Layer Setting Service
77+
* **CiA305 Layer Setting Service:**
7678

77-
* fast scan supported
78-
* bitrate and node id configuring supported
79-
* identify remote responder supported
79+
- Supports fast scan
80+
- Configurable bitrate and node ID
81+
- Identify remote responder supported
8082

81-
* CAN interface abstraction
82-
83-
* python-can_ fully supported
84-
* automatic CAN id filtering by subscripted services
83+
* **CAN Interface Abstraction:**
8584

86-
* Scheduling supporting threaded and async operation
85+
- Full support for python-can_
86+
- Automatic CAN ID filtering by subscribed services
8787

88-
TODO
89-
* build object dictionary via reading an EDS file
90-
* supporting MPDOs
91-
* TIME consumer service
92-
* Up- and download handler as io streams
88+
* **Scheduling:**
89+
90+
- Supports threaded and async operation
91+
92+
**TODO:**
93+
94+
- Build object dictionary via reading an EDS file
95+
- Support MPDOs
96+
- TIME consumer service
97+
- Up- and download handler as I/O streams
9398

9499
Examples
95100
========
96101

97-
Creating a node
98-
---------------
102+
**Creating a Node:**
99103

100104
.. code-block:: python
101105
@@ -104,29 +108,26 @@ Creating a node
104108
105109
bus = can.Bus(bustype='socketcan', channel='vcan0')
106110
network = CANBusNetwork(bus)
107-
108111
node = Node(network, node_id=0x01)
109112
110-
Congratulations! You have a CiA-301 compliant node running. Layer Setting Service is also supported out of the box.
113+
Congratulations! You now have a CiA-301 compliant node running. The Layer Setting Service is also supported out of the box.
111114

112-
Adding objects
113-
--------------
115+
**Adding Objects:**
114116

115117
.. code-block:: python
116118
117119
od = node.object_dictionary
118120
119-
# add variable at index 0x2000
121+
# Add variable at index 0x2000
120122
od[0x2000] = Variable(DatatypeEnum.UNSIGNED16, access='rw', value=10, name='Parameter 1')
121123
122-
# add record at index 0x2001
124+
# Add record at index 0x2001
123125
record = Record(name='Parameter Record')
124126
record[1] = Variable(DatatypeEnum.UNSIGNED8, access='ro', value=0, name='Parameter 2a')
125127
record[2] = Variable(DatatypeEnum.REAL32, access='rw', value=0, name='Parameter 2b')
126128
od[0x2001] = record
127129
128-
Access values
129-
-------------
130+
**Accessing Values:**
130131

131132
The objects can be read and written directly by accessing the object dictionary:
132133

@@ -135,15 +136,14 @@ The objects can be read and written directly by accessing the object dictionary:
135136
print(f'Value of Parameter 1: {od.read(0x2000, 0)}')
136137
od.write(0x2001, 1, value=0xAA)
137138
138-
Add callbacks
139-
-------------
139+
**Adding Callbacks:**
140140

141-
A more event driven approach is using of callbacks. Following callbacks are available:
141+
A more event-driven approach is to use callbacks. The following callbacks are available:
142142

143-
* `validate_callbacks` - called before a value in the object dictionary is going to be updated
144-
* `update_callbacks` - called when the value has been changed (via `od.write` or via CAN bus)
145-
* `download_callbacks` - called when the value has been changed via CAN bus
146-
* `read_callback` - called when a object is read (return value is used )
143+
- `validate_callbacks`: Called before a value in the object dictionary is updated
144+
- `update_callbacks`: Called when the value has been changed (via `od.write` or via CAN bus)
145+
- `download_callbacks`: Called when the value has been changed via CAN bus
146+
- `read_callback`: Called when an object is read (return value is used)
147147

148148
.. code-block:: python
149149
@@ -152,22 +152,20 @@ A more event driven approach is using of callbacks. Following callbacks are avai
152152
od.download_callbacks[(0x2000, 0)].add(lambda v: print(f'Download for Parameter 1: {v}'))
153153
od.set_read_callback(0x2001, 1, lambda: 17)
154154
155-
PDO mapping
156-
-----------
155+
**PDO Mapping:**
157156

158-
PDOs can dynamically mapped via the SDO server or programmatically. The PDO indices
159-
start at 0.
157+
PDOs can be dynamically mapped via the SDO server or programmatically. The PDO indices start at 0.
160158

161159
.. code-block:: python
162160
163161
node.tpdo[0].mapping = [(0x2001, 1), (0x2001, 2)]
164-
node.tpdo[0].transmission_type = 1 # transmit on every SYNC
162+
node.tpdo[0].transmission_type = 1 # Transmit on every SYNC
165163
166164
node.rpdo[0].mapping = [(0x2000, 0)]
167-
node.tpdo[0].transmission_type = 255 # event driven (processed when received)
165+
node.tpdo[0].transmission_type = 255 # Event-driven (processed when received)
168166
169-
Install
170-
=======
167+
Installation
168+
============
171169

172170
.. code-block:: bash
173171
@@ -178,8 +176,8 @@ Credits
178176

179177
This library would not be possible without:
180178

181-
* python-canopen_: CANopen library (by Christian Sandberg)
182-
* python-can_: CAN interface library (by Brian Thorne)
179+
- python-canopen_: CANopen library (by Christian Sandberg)
180+
- python-can_: CAN interface library (by Brian Thorne)
183181

184182
.. _python-canopen: https://github.com/christiansandberg/canopen
185183
.. _python-can: https://github.com/hardbyte/python-can

0 commit comments

Comments
 (0)