From: Uwe Hermann Date: Wed, 19 Feb 2014 14:07:39 +0000 (+0100) Subject: rgb_led: Minor cosmetics, whitespace. X-Git-Tag: libsigrokdecode-0.3.0~88 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8967e839a3df6aa8766f57e521c81edd3a12be4d;p=libsigrokdecode.git rgb_led: Minor cosmetics, whitespace. --- diff --git a/decoders/rgb_led/__init__.py b/decoders/rgb_led/__init__.py index e08adbe..3d41ea5 100644 --- a/decoders/rgb_led/__init__.py +++ b/decoders/rgb_led/__init__.py @@ -19,8 +19,9 @@ ## ''' -This protocol decoder can decode generic RGB LED string values that are -clocked over SPI in RGB values. +This decoder stacks on top of the 'spi' PD and decodes generic RGB LED string +values that are clocked over SPI in RGB values. ''' from .pd import * + diff --git a/decoders/rgb_led/pd.py b/decoders/rgb_led/pd.py index 38bd64d..f3a6388 100644 --- a/decoders/rgb_led/pd.py +++ b/decoders/rgb_led/pd.py @@ -21,11 +21,11 @@ import sigrokdecode as srd class Decoder(srd.Decoder): - api_version =1 + api_version = 1 id = 'rgb_led' name = 'RGB LED (SPI mode)' longname = 'RGB LED string decoder (SPI mode)' - desc = '' + desc = 'Generic RGB LED string protocol (RGB values clocked over SPI).' license = 'gplv2' inputs = ['spi'] outputs = ['rgb_led'] @@ -33,8 +33,7 @@ class Decoder(srd.Decoder): optional_probes = [] options = {} annotations = [ - ['text', 'Human-readable text'], - ['warnings', 'Human-readable warnings'], + ['rgb', 'RGB values'], ] def __init__(self, **kwargs): @@ -50,7 +49,7 @@ class Decoder(srd.Decoder): def decode(self, ss, es, data): ptype, mosi, miso = data - # Only care about data packets + # Only care about data packets. if ptype != 'DATA': return self.ss, self.es = ss, es @@ -63,7 +62,7 @@ class Decoder(srd.Decoder): if len(self.mosi_bytes) != 3: return - red, green, blue = self.mosi_bytes + red, green, blue = self.mosi_bytes rgb_value = int(red) << 16 rgb_value |= int(green) << 8 rgb_value |= int(blue)