summaryrefslogtreecommitdiff
path: root/decoders/rgb_led_ws281x/pd.py
AgeCommit message (Collapse)Author
2023-07-29rgb_led_ws281x: default to RGB[W] annotation text orderGerhard Sittig
The earlier default was "RGB" (exactly three components), and users had to manually pick "RGBW" when white was involved. Change the default to the automatic "RGB[W]" instead which transparently presents white when applicable, and doesn't fail when white is not involved.
2023-07-29rgb_led_ws281x: emit annotations for individual colour componentsGerhard Sittig
The previous implementation presented bits and per-LED RGB-values (in a from similar to HTML colours). This commit introduces annotations for individual colour components (R/G/B/W) between these two levels of abstraction.
2023-07-29rgb_led_ws281x: add developer comments, link to chip datasheetsGerhard Sittig
Add developer comments at the top of the decoder source. Reference datasheets, discuss vendor's numbers and what's used in the field. Discuss variants (sets of involved colour components, alternative timings, reset detection).
2023-07-29rgb_led_ws281x: support more colour component orders (wire, and text)Gerhard Sittig
The 'type' option was not good enough. Replace it by 'wireorder' (order of colour components on the wire, depends on the RGB LED chip type), and 'textorder' (presentation to users in annotations). Support many more layouts of colour components on the wire. Cover all permutations of R, G, and B. Support a few RGB plus W layouts that are known to be in use. Adding more is just a matter of adding more choices in the option, the implementation transparently follows. Support a few text orders: Reflect the very order of bits on the wire. Automatic support for RGB with optional White, or fixed RGB or RGB-W variants (all are users' choices, default remains "RGB" for backwards compatibility). Support arbitrary combinations of wire order and text order in emitted annotations. Keep support for the weird RGWB text format, which the previous decoder implementation used for "all" RGBW types, and which is referenced by existing test cases. It is uncertain which chip type is supposed to generate this specific RGBW traffic. It is as uncertain why this text order was chosen, which neither is the human readable RGBW format nor matches the wire order. The previous implementation was introduced in commit 47ff9910f7e1, but neither commented nor referenced literature or external sources nor did the commit message contain any clues. This current implementation needs more tests and reviews, but lends itself better to maintenance, fixes and enhancements.
2023-07-29rgb_led_ws281x: rework the .decode() main loop, improve robustnessGerhard Sittig
Concentrate timestamp gathering in the .decode() method, eliminate instance members by using variables that are local to the method. Finally use appropriate PD API v3 invocations. Use edge conditions plus a counted 'skip' to detect the RESET pulse. Use a positive "check the reset condition" logic, simplify the conditions which support the reset pulse tracking, and which flush previously accumulated data when "the bit time doesn't end" (the next edge is missing). Improve robustness in those cases where captures use low oversampling and similar length high and low pulses. The fixed (rather arbitrary?) 625us threshold resulted in several false last-bit values after the API v3 conversion. Heavily comment on this edge/pulse detection and timestamps logic, since it's non-trivial and non-obvious. Keep all behaviour backwards compatible before extending the feature set in future commits.
2023-07-29rgb_led_ws281x: refactor bit/bits handling, use more common codeGerhard Sittig
Pass all .decode() routine's bit handling through a common bit handler. Accumulate the bit values as well as their ss/es timestamps. Reduce code duplication in the bits handler. Use common support code to get the 24/32 bit wide integer from the list of bits. Prepare to handle streams of different per-pixel length or layout. This commit remains backwards compatible, and keeps all warts of the previous implementation including inconsistent annotation order. Just eliminates unnecessary instance members and hidden coupling, to keep timestamp handling in the .decode() method.
2023-07-29rgb_led_ws281x: rephrase .put() calls for readabilityGerhard Sittig
Separate the construction of the list of texts for different zoom levels from the emission of annotations. Use a .putg() helpers to match other decoder implementations. Prefer .format() calls over "modulo" operations on strings.
2023-07-29rgb_led_ws281x: use symbolic names for annotation classesGerhard Sittig
2020-07-18rgb_led_ws281x: Support RGBWStefan
Support of the now common RGBW type LED strips (uses 4 bytes instead of 3). Added an option to select RGB or RGBW
2020-01-01All PDs: Consistently use singular/plural for annotation classes/rows.Uwe Hermann
2019-11-29ws281x: Check for "None" before subtracting.Philipp Marek
2019-04-02decoders: Fix incorrect 'outputs' fields.Uwe Hermann
Only add items to 'outputs' if the respective PD actually has OUTPUT_PYTHON support implemented as of right now. Various decoders might get OUTPUT_PYTHON support later, but the 'outputs' field should reflect the current status.
2019-03-16decoders: Various cosmetic/consistency/typo fixes.Uwe Hermann
2019-03-15decoders: Add/update tags for each PD.Uwe Hermann
2017-12-22all decoders: introduce a reset() methodGerhard Sittig
Move initialization code of protocol decoders from the constructor to a new reset() helper method. The libsigrokdecode backend could run this method several times to clear the decoder's internal state, before new data from another acquisition gets fed to decode() calls.
2017-06-21decoders: Rephrase condition-less .wait() calls (self documentation)Gerhard Sittig
Telling .wait() to "skip one sample" slightly obfuscates the intent of getting the next samples while no condition applies. Explicitly pass no condition arguments instead, to better reflect the purpose. Coincidently these .wait() calls will execute in slightly less expensive code paths in the common code.
2017-06-16rgb_led_ws281x: Convert to PD API version 3.Uwe Hermann
2017-03-04rgb_led_ws281x: Use self.samplenum.Uwe Hermann
This is currently just a cosmetic change, but will make the conversion to the PDv3 API slightly easier and more readable.
2017-01-07license: remove FSF postal address from boiler plate license textGerhard Sittig
Remove the FSF postal address as it might change (it did in the past). Reference the gnu.org website instead which is more stable.
2016-05-26Consistency renames of {ss,es}_ variables.Uwe Hermann
2016-05-15Use consistent __init__() format across all PDs.Uwe Hermann
The previous **kwargs some PDs had is not actually ever used, so drop it.
2016-03-04Add an rgb_led_ws281x decoder.Uwe Hermann
This decoder handles the WS2812B protocol (and possibly WS2811). Example dump already exists: led/ws281x/ws281x_4ch_5mhz.sr. Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>