Implement IR protocol using only one timer

I want to implement the transceiving part of an IR protocol for my Samsung remote on an nRF54822, using an ARM Cortex M0 core. The protocol is very much like the NEC Protocol, and is using a carrier frequency of 38kHz with bursts of the carrier frequency in different time periods to indicate logical '1's and '0's.

Example: 38kHz ON for 540µs, signal OFF for 1.7ms, signal ON for 540µs.

If I use two timers this should be fairly trivial. One timer to keep the 38kHz carrier frequency active at all times, and the other to keep track of when to set the output of timer one at the IR LED. But what if I am using only one timer? I am able to trigger timer clear (count from zero) and timer stop at value Compare. I can also trigger toggle, set and clear on GPIO at compare.

Any ideas on how I can achieve this?

• You can re-configure timer in Timer ISR... So, First it will trigger after 540usec, in that ISR, change timer value to 1.7msec and so on – Swanand Jul 9 '13 at 8:53