BFSK generator on M0pro

Hi,

I am using the following code (see in attachment), to perform 40 KHz frequency generation on my M0PRO, based on PWM timers. I can adjust frequency and duty cycle thanks to dedicated values in registers. All is OK !

I would now generate BFSK starting on this code, by changing the frequency value in the register. That's easy, OK.

The point is that I don't see how to manage the time duration of each frequency burst, i.e how to start and stop each frequency burst, how to start / stop relevant timers ?

Does somebody can help ?

Many thanks

DR

Gene_frequence_1.ino (2.99 KB)