]> sigrok.org Git - libsigrokdecode.git/blob - decoders/onewire/__init__.py
added some ducumentation, shortened the ROM command decoder code
[libsigrokdecode.git] / decoders / onewire / __init__.py
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 '''
22 1-Wire protocol decoder.
23
24 The 1-Wire protocol enables bidirectional communication over a single wire (and
25 ground) between a single master and one or multiple slaves. The protocol is
26 layered, 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)
29 The higher layers (transport, presentation) are not decoded, since they are
30 mostly device specific and it would take a lot of code to interpret them.
31
32 Probes:
33 1-Wire requires a single signal, but some master implementations might have a
34 separate signal use to deliver power to the bus during temperature conversion
35 as an example. This power signal is currently not parsed.
36 - owr (1-Wire bus)
37 - pwr (1-Wire power)
38
39 Options:
40 1-Wire is an asynchronous protocol, so the decoder must know the sample rate.
41 The timing for sampling bits, presence and reset is calculated by the decoder,
42 but in case the user wishes to use different values, it is possible to
43 configure 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)
51 This options should be configured only on very rare cases and the user should
52 read the decoder source code to understand them correctly.
53
54 Annotations:
55 Annotations 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)
59 If link layer annotations are shown, possible issues with sample rate and sample
60 timing are also shown.
61
62 TODO:
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
67 '''
68
69 from .onewire import *
70