]> sigrok.org Git - libsigrokdecode.git/blame - decoders/onewire/__init__.py
added some ducumentation, shortened the ROM command decoder code
[libsigrokdecode.git] / decoders / onewire / __init__.py
CommitLineData
51990c45
IJ
1##
2## This file is part of the sigrok project.
3##
4## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19##
20
21'''
221-Wire protocol decoder.
23
a2b13347
IJ
24The 1-Wire protocol enables bidirectional communication over a single wire (and
25ground) between a single master and one or multiple slaves. The protocol is
26layered, the provided parser decodes the next layers:
27- Link layer (reset, presence detection, reading/writing bits)
28- Network layer (skip, search, match device ROM addresses)
29The higher layers (transport, presentation) are not decoded, since they are
30mostly device specific and it would take a lot of code to interpret them.
31
32Probes:
331-Wire requires a single signal, but some master implementations might have a
34separate signal use to deliver power to the bus during temperature conversion
35as an example. This power signal is currently not parsed.
36- owr (1-Wire bus)
37- pwr (1-Wire power)
38
39Options:
401-Wire is an asynchronous protocol, so the decoder must know the sample rate.
41The timing for sampling bits, presence and reset is calculated by the decoder,
42but in case the user wishes to use different values, it is possible to
43configure the next timing values (number of sample rate periods):
44- overdrive (if active the decoder will be prepared for overdrive)
45- cnt_normal_bit (time for normal mode sample bit)
46- cnt_normal_presence (time for normal mode sample presence)
47- cnt_normal_reset (time for normal mode reset)
48- cnt_overdrive_bit (time for overdrive mode sample bit)
49- cnt_overdrive_presence (time for overdrive mode sample presence)
50- cnt_overdrive_reset (time for overdrive mode reset)
51This options should be configured only on very rare cases and the user should
52read the decoder source code to understand them correctly.
53
54Annotations:
55Annotations can be shown for each layer of the protocol separately:
56- link (the value of each transmitted bit is shown separately)
57- network (the ROM command, and address are shown)
58- transport (only transport layer byte transfers are shown)
59If link layer annotations are shown, possible issues with sample rate and sample
60timing are also shown.
61
c08aea7e
IJ
62TODO:
63- fix annotations to have event duration instead of begin end time
64- add CRC checks for network layer
65- add transport layer code
66- review link layer code, to check for protocol correctness
51990c45
IJ
67'''
68
69from .onewire import *
70