self.callback(val, addr, ctrl, *self.args)
class RC6_M0(IR_RX):
self.callback(val, addr, ctrl, *self.args)
class RC6_M0(IR_RX):
- # Even on Pyboard D these 444us nominal pulses can be recorded as up to 705us
+ # Even on Pyboard D the 444μs nominal pulses can be recorded as up to 705μs
+ # Scope shows 360-520 μs (-84μs +76μs relative to nominal)
+ # Header nominal 2666, 889, 444, 889, 444, 444, 444, 444 carrier ON at end
hdr = ((1800, 4000), (593, 1333), (222, 750), (593, 1333), (222, 750), (222, 750), (222, 750), (222, 750))
def __init__(self, pin, callback, *args):
# Block lasts 23ms nominal and has <=44 edges
hdr = ((1800, 4000), (593, 1333), (222, 750), (593, 1333), (222, 750), (222, 750), (222, 750), (222, 750))
def __init__(self, pin, callback, *args):
# Block lasts 23ms nominal and has <=44 edges
raise RuntimeError(OVERRUN if nedges > 28 else BADSTART)
for x, lims in enumerate(self.hdr):
width = ticks_diff(self._times[x + 1], self._times[x])
raise RuntimeError(OVERRUN if nedges > 28 else BADSTART)
for x, lims in enumerate(self.hdr):
width = ticks_diff(self._times[x + 1], self._times[x])
- print('Bad start', x, width, lims)
+ #print('Bad start', x, width, lims)
raise RuntimeError(BADSTART)
x += 1
width = ticks_diff(self._times[x + 1], self._times[x])
raise RuntimeError(BADSTART)
x += 1
width = ticks_diff(self._times[x + 1], self._times[x])
- ctrl = width > 889 # Long bit
- start = x + 2 # Skip 2nd long bit
+ # Long bit is 889μs (0) or 1333μs (1)
+ ctrl = width > 1111 # If 1333, ctrl == True and carrier is off
+ start = x + 2 if ctrl else x + 3 # Skip 2nd long bit
- bits = 0
- bit = 0
- for x in range(start, nedges):
- width = ticks_diff(self._times[x], self._times[x - 1])
+ bits = 1 # MSB is a dummy 1 to mark start of bitstream
+ bit = int(ctrl)
+ for x in range(start, nedges - 1):
+ width = ticks_diff(self._times[x + 1], self._times[x])