summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-10-12 14:31:21 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2014-10-12 14:59:46 +0200
commit47405f47db235c06d9f2ad26ae51791136b62a91 (patch)
treec7ee2e251ed3abe20a27af45178368e3fe5ae740
parentb1f2b85bd9a7cb79265f251cbecba84cdc04dd5e (diff)
downloadlibsigrokdecode-47405f47db235c06d9f2ad26ae51791136b62a91.tar.gz
libsigrokdecode-47405f47db235c06d9f2ad26ae51791136b62a91.zip
am230x: Minor cosmetics.
-rw-r--r--decoders/am230x/__init__.py6
-rw-r--r--decoders/am230x/pd.py12
2 files changed, 9 insertions, 9 deletions
diff --git a/decoders/am230x/__init__.py b/decoders/am230x/__init__.py
index 84e36c2..782c095 100644
--- a/decoders/am230x/__init__.py
+++ b/decoders/am230x/__init__.py
@@ -19,11 +19,11 @@
##
'''
-This decoder handles the proprietary single wire communication protocol used by
-the AM230x series of digital humidity and temperature sensors.
+This decoder handles the proprietary single wire communication protocol used
+by the Aosong AM230x/DHTxx series of digital humidity and temperature sensors.
Sample rate:
-A sample rate of at least 200 kHz is recommended to properly detect all the
+A sample rate of at least 200kHz is recommended to properly detect all the
elements of the protocol.
Options:
diff --git a/decoders/am230x/pd.py b/decoders/am230x/pd.py
index 05489d9..d7cbad2 100644
--- a/decoders/am230x/pd.py
+++ b/decoders/am230x/pd.py
@@ -37,9 +37,9 @@ class SamplerateError(Exception):
class Decoder(srd.Decoder):
api_version = 2
id = 'am230x'
- name = 'AM230x'
- longname = 'AM230x humidity and temperature sensors'
- desc = 'Proprietary single wire communication bus.'
+ name = 'AM230x/DHTxx'
+ longname = 'Aosong AM230x/DHTxx'
+ desc = 'Aosong AM230x/DHTxx humidity/temperature sensor protocol.'
license = 'gplv2+'
inputs = ['logic']
outputs = ['am230x']
@@ -95,8 +95,8 @@ class Decoder(srd.Decoder):
def bits2num(self, bitlist):
number = 0
- for i in range(0, len(bitlist)):
- number += bitlist[-1-i] * 2**i
+ for i in range(len(bitlist)):
+ number += bitlist[-1 - i] * 2**i
return number
def calculate_humidity(self, bitlist):
@@ -119,7 +119,7 @@ class Decoder(srd.Decoder):
def calculate_checksum(self, bitlist):
checksum = 0
- for i in range(8, len(bitlist)+1, 8):
+ for i in range(8, len(bitlist) + 1, 8):
checksum += self.bits2num(bitlist[i-8:i])
return checksum % 256