Go Down

Topic: digitalPinHasPWM on the due? (Read 987 times) previous topic - next topic

OutOfLine

The macro digitalPinHasPWM seams to be missing on Arduino 1.5.2

Can it be defined for the due?

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.

OutOfLine


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?

TheKitty

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

the define you have is the right one for now.

cmaglie


opened an issue to keep track of this:
https://github.com/arduino/Arduino/issues/1342

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

C
C.

OutOfLine



opened an issue to keep track of this:
https://github.com/arduino/Arduino/issues/1342

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.

Go Up