digitalPinHasPWM on the due?

The macro digitalPinHasPWM seams to be missing on Arduino 1.5.2

Can it be defined for the due?

It would be easy to write one using the data on which pins have PWM, a function with a switch to return TRUE if it matches one, FALSE if not.

TheKitty:
It would be easy to write one using the data on which pins have PWM, a function with a switch to return TRUE if it matches one, FALSE if not.

Sure,
but I think as the Arduino IDE does #define it for the other Arduinos it would be nice for the user to find that defined also on the Due. Or doesn't it make sense for that chip? (and if so, why?).

btw: How can I detect the Due?
#ifdef SAM3X8E or is there something more specific?

Yes, I agree the software should be fairly complete to help get programs going.

the define you have is the right one for now.

opened an issue to keep track of this:

as always, if someone wants to try an implementation, I'll be happy to merge it.

C

cmaglie:
opened an issue to keep track of this:
Add digitalPinHasPWM macro for Arduino DUE · Issue #1342 · arduino/Arduino · GitHub

as always, if someone wants to try an implementation, I'll be happy to merge it.

Left a note about me using
#define digitalPinHasPWM(p) ((p) >= 2 && (p) <= 13)

I will probably raise issues on other macros missing, like:
portModeRegister

and then I did not find out yet how to use these:

  • digitalPinToPort
  • digitalPinToBitMask
    any pointers very welcome

Thanks a lot for your help,
very much appreciated.