I am developing an universal remote which can be controlled via Bluetooth. For that I need to decode an IR signal.
I am using TSOP decoder.
The steps I think, I should do is,
-
Use a PPI channel to listen for an HiToLo transition in the TSOP output GPIO pin and whenever that event occur, make it start a timer with 50us time period.
-
At every 50us, sample the TSOP input and store it in an array. (Please tell the best method to store the CC values in an array).
-
I don't know how to detect that the IR transmission has been ended, I am thinking to stop decoding once I get a zero(HIGH TSOP output) for 10ms.
-
Once the decoding has been completed, calculate the time of MARKS and SPACES from the previous array and store it for later transmission.
Another method I could think of, is to start a timer whenever HiToLo transition occur at 'TSOP output pin' and store the edge transition point's time to an array. But the problem here is, how to know that IR reception has been ended? use another timer as timeout timer?
What is the best approach? please help.