Arduino Forum

Products => Arduino Due => Topic started by: OutOfLine on Mar 24, 2013, 10:38 am

Title: digitalPinHasPWM on the due?
Post by: OutOfLine on Mar 24, 2013, 10:38 am
The macro digitalPinHasPWM seams to be missing on Arduino 1.5.2

Can it be defined for the due?
Title: Re: digitalPinHasPWM on the due?
Post by: TheKitty on Mar 25, 2013, 02:01 am
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.
Title: Re: digitalPinHasPWM on the due?
Post by: OutOfLine on Mar 25, 2013, 10:01 am

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?
Title: Re: digitalPinHasPWM on the due?
Post by: TheKitty on Mar 25, 2013, 11:04 am
Yes, I agree the software should be fairly complete to help get programs going.

the define you have is the right one for now.
Title: Re: digitalPinHasPWM on the due?
Post by: cmaglie on Apr 03, 2013, 12:34 am

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
Title: Re: digitalPinHasPWM on the due?
Post by: OutOfLine on Apr 03, 2013, 01:38 pm


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.