summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
Diffstat (limited to 'decoders')
-rw-r--r--decoders/i2c.py51
-rw-r--r--decoders/nunchuk.py48
-rw-r--r--decoders/transitioncounter.py51
3 files changed, 83 insertions, 67 deletions
diff --git a/decoders/i2c.py b/decoders/i2c.py
index 4e11921..f2b0c2d 100644
--- a/decoders/i2c.py
+++ b/decoders/i2c.py
@@ -125,7 +125,13 @@
# 'signals': [{'SCL': }]}
#
-def decode(inbuf):
+def decode(l):
+ print(l)
+ sigrok.put(l)
+
+
+
+def decode2(inbuf):
"""I2C protocol decoder"""
# FIXME: Get the data in the correct format in the first place.
@@ -233,28 +239,27 @@ def decode(inbuf):
# FIXME: Just for testing...
return str(out)
-def register():
- return {
- 'id': 'i2c',
- 'name': 'I2C',
- 'longname': 'Inter-Integrated Circuit (I2C) bus',
- 'desc': 'I2C is a two-wire, multi-master, serial bus.',
- 'longdesc': '...',
- 'author': 'Uwe Hermann',
- 'email': 'uwe@hermann-uwe.de',
- 'license': 'gplv2+',
- 'in': ['logic'],
- 'out': ['i2c'],
- 'probes': [
- ['scl', 'Serial clock line'],
- ['sda', 'Serial data line'],
- ],
- 'options': {
- 'address-space': ['Address space (in bits)', 7],
- },
- # 'start': start,
- # 'report': report,
- }
+register = {
+ 'id': 'i2c',
+ 'name': 'I2C',
+ 'longname': 'Inter-Integrated Circuit (I2C) bus',
+ 'desc': 'I2C is a two-wire, multi-master, serial bus.',
+ 'longdesc': '...',
+ 'author': 'Uwe Hermann',
+ 'email': 'uwe@hermann-uwe.de',
+ 'license': 'gplv2+',
+ 'in': ['logic'],
+ 'out': ['i2c'],
+ 'probes': [
+ ['scl', 'Serial clock line'],
+ ['sda', 'Serial data line'],
+ ],
+ 'options': {
+ 'address-space': ['Address space (in bits)', 7],
+ },
+ # 'start': start,
+ # 'report': report,
+}
# Use psyco (if available) as it results in huge performance improvements.
try:
diff --git a/decoders/nunchuk.py b/decoders/nunchuk.py
index 77b154e..57be1d7 100644
--- a/decoders/nunchuk.py
+++ b/decoders/nunchuk.py
@@ -47,7 +47,12 @@ example_packets = [
{'type': 'P', 'range': (32, 33), 'data': None, 'ann': ''},
]
-def decode(inbuf):
+def decode(l):
+ print(l)
+ sigrok.put(l)
+
+
+def decode2(inbuf):
"""Nintendo Wii Nunchuk decoder"""
# FIXME: Get the data in the correct format in the first place.
@@ -139,27 +144,26 @@ def decode(inbuf):
# FIXME
return ''
-def register():
- return {
- 'id': 'nunchuk',
- 'name': 'Nunchuk',
- 'longname': 'Nintendo Wii Nunchuk decoder',
- 'desc': 'Decodes the Nintendo Wii Nunchuk I2C-based protocol.',
- 'longdesc': '...',
- 'author': 'Uwe Hermann',
- 'email': 'uwe@hermann-uwe.de',
- 'license': 'gplv2+',
- 'in': ['i2c'],
- 'out': ['nunchuck'],
- 'probes': [
- # TODO
- ],
- 'options': {
- # TODO
- },
- # 'start': start,
- # 'report': report,
- }
+register = {
+ 'id': 'nunchuk',
+ 'name': 'Nunchuk',
+ 'longname': 'Nintendo Wii Nunchuk decoder',
+ 'desc': 'Decodes the Nintendo Wii Nunchuk I2C-based protocol.',
+ 'longdesc': '...',
+ 'author': 'Uwe Hermann',
+ 'email': 'uwe@hermann-uwe.de',
+ 'license': 'gplv2+',
+ 'in': ['i2c'],
+ 'out': ['nunchuck'],
+ 'probes': [
+ # TODO
+ ],
+ 'options': {
+ # TODO
+ },
+ # 'start': start,
+ # 'report': report,
+}
# Use psyco (if available) as it results in huge performance improvements.
try:
diff --git a/decoders/transitioncounter.py b/decoders/transitioncounter.py
index 6bd97c2..4cd1670 100644
--- a/decoders/transitioncounter.py
+++ b/decoders/transitioncounter.py
@@ -17,8 +17,16 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
+import sigrok
-def decode(inbuf):
+def decode(l):
+ """Counts the low->high and high->low transitions in the specified
+ channel(s) of the signal."""
+
+ print(l)
+ sigrok.put(l)
+
+def decode2(inbuf):
"""Counts the low->high and high->low transitions in the specified
channel(s) of the signal."""
@@ -75,27 +83,26 @@ def decode(inbuf):
return outbuf
-def register():
- return {
- 'id': 'transitioncounter',
- 'name': 'Transition counter',
- 'longname': '...',
- 'desc': 'Counts rising/falling edges in the signal.',
- 'longdesc': '...',
- 'author': 'Uwe Hermann',
- 'email': 'uwe@hermann-uwe.de',
- 'license': 'gplv2+',
- 'in': ['logic'],
- 'out': ['transitioncounts'],
- 'probes': [
- # All probes.
- ],
- 'options': {
- # No options so far.
- },
- # 'start': start,
- # 'report': report,
- }
+register = {
+ 'id': 'transitioncounter',
+ 'name': 'Transition counter',
+ 'longname': '...',
+ 'desc': 'Counts rising/falling edges in the signal.',
+ 'longdesc': '...',
+ 'author': 'Uwe Hermann',
+ 'email': 'uwe@hermann-uwe.de',
+ 'license': 'gplv2+',
+ 'in': ['logic'],
+ 'out': ['transitioncounts'],
+ 'probes': [
+ # All probes.
+ ],
+ 'options': {
+ # No options so far.
+ },
+ # 'start': start,
+ # 'report': report,
+}
# Use psyco (if available) as it results in huge performance improvements.
try: