Skip to content

Commit 806b20e

Browse files
Add small EMCY example.
1 parent e76c305 commit 806b20e

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

doc/emcy.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ the device profiles.
1515
Examples
1616
--------
1717

18+
To list the currently active emergencies for a particular node, one can use the
19+
``.active`` attribute which is a list of :class:`canopen.emcy.EmcyError`
20+
objects::
1821

22+
active_codes = [emcy.code for emcy in node.emcy.active]
23+
all_codes = [emcy.code for emcy in node.emcy.log]
24+
25+
The :class:`canopen.emcy.EmcyError` objects are actually exceptions so that they
26+
can be easily raised if that's what you want::
27+
28+
if node.emcy.active:
29+
raise node.emcy.active[-1]
1930

2031

2132
API

doc/od.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,5 @@ API
136136
an underscore + the subindex in hex format.
137137

138138

139-
Exceptions
140-
~~~~~~~~~~
141-
142139
.. autoexception:: canopen.ObjectDictionaryError
143140
:members:

doc/sdo.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ API
175175
actual length of the array.
176176

177177

178-
Exceptions
179-
~~~~~~~~~~
180-
181178
.. autoexception:: canopen.SdoAbortedError
182179
:members:
183180

0 commit comments

Comments
 (0)