]>
vault307.fbx.one Git - micorpython_ir.git/blob - ir_rx/samsung.py
382dcbf7e812630fd89de30ed219ffc5eb3f24ad
1 # samsung.py Decoder for IR remote control using synchronous code
2 # Supports Samsung TV remote protocols.
4 # Author: J.E. Tannenbaum
5 # Copyright J.E.Tannenbaum 2021 Released under the MIT license
7 from utime
import ticks_us
, ticks_diff
8 from ir_rx
import IR_RX
11 def __init__(self
, pin
, callback
, *args
):
12 super().__init
__(pin
, 68, 80, callback
, *args
)
16 return target
* 0.8 < v
< target
* 1.2
18 lb
= self
.edge
- 1 # Possible length of burst
21 dt
= ticks_diff(self
._times
[x
+ 1], self
._times
[x
])
22 if x
> 0 and dt
> 10000: # Reached gap between repeats
26 lb
= len(burst
) # Actual length
28 if near(burst
[0], 4500) and near(burst
[1], 4500) and lb
== 67:
29 # Skip the starting bits and the checksum at the end of the sequence
30 for x
in range(2, lb
- 1, 2):
32 # Test for logical 1 (One byte low, next byte high)
33 if burst
[x
] < 1000 and burst
[x
+ 1] > 1000:
36 # Set up for new data burst and run user callback
37 self
.do_callback(cmd
, 0, 0)