DUE PWM Frequency

There was actually a recent discussion on the Arduino developers mail list about this feature. I believe the final consensus was on analogWriteFrequency(pin, frequency), though there's some lingering controversy over using the pin number vs some way of specifying which timer resource is being programmed. It's not easy to agree on an API that is easy to understand and flexible and general enough to work across different boards with different chips, yet can be implemented efficiently and doesn't abstract the hardware so much that the user is completely unaware of possible compatibility issues.

Maple's API gives you low-level access to the timers, but it's very hardware specific. You can't reasonably expect that code, using raw overflow and prescaler constants for ST's chip, to work the same way across different boards. It might not even work when/if Leaflabs makes another board based on a newer ST chip. That API also produces very unreable code. How can anyone reading the code know the output is 6 kHz? Somehow a prescale factor of 3 and an overflow of 4000 make 6 kHz? Will that be true on every Maple board to come in the future? Certainly AVR and SAM3X and Freescale MK20 need different parameters, because they have dramatically different timer hardware. Maple's API just isn't practical for non-ST chips, and long term I suspect it won't even work well for whatever boards appear in the future with new ST parts.

I've implemented analogWriteFrequency() on Teensy 3.0, so far only as a code drop in a forum topic, but soon to be released as a beta test.

I don't know when or if Christian is planning to implement it on Arduino Due.