I presently have two pins on a Teensy 4 executing PWM at slightly different frequencies such that the voltage difference between the pins are essentially amplitude modulated at the difference in frequency when low-passed. I need to improve upon this by using PWM to frequency modulate a single pin instead.
I am presently using analogwritefrequency to set the PWM frequency. If I can do an interrupt on output edge and call analogwritefrequency each time, I can adjust the PWM frequency once a cycle to implement FM by modulation each period length individually. I looked around and couldn't find cases where anybody had used PWM like this. I don't believe the compute overhead of analogwritefrequency is sufficient to preclude doing this or if there are other hangups. Does this sound feasible?
I am presently using analogwritefrequency to set the PWM frequency. If I can do an interrupt on output edge and call analogwritefrequency each time, I can adjust the PWM frequency once a cycle to implement FM by modulation each period length individually. I looked around and couldn't find cases where anybody had used PWM like this. I don't believe the compute overhead of analogwritefrequency is sufficient to preclude doing this or if there are other hangups. Does this sound feasible?