Use a proper .wait() condition to have edges detected in common code,
and avoid the many transitions between C and Python. This dramatically
increases performance of the LPC protocol decoder.
[ gsi: rephrased and reflowed the commit message ]
self.state = 'IDLE'
def decode(self):
+ conditions = [{i: 'e'} for i in range(6)]
while True:
- # TODO: Come up with more appropriate self.wait() conditions.
- pins = self.wait()
-
- # If none of the pins changed, there's nothing to do.
- if self.oldpins == pins:
- continue
+ pins = self.wait(conditions)
# Store current pin values for the next round.
self.oldpins = pins